I’ve had quite a time getting mikroC Pro working properly for a PIC16F887 using a MPLAB ICD3 debugger and I thought I would note some of the things I did to make it work.
Category Archives: Microcontrollers
Uninitialized Variables with LPCXpresso
Believe it or not but every static variable in C is initialized whether you explicitly set a value or not. If you don’t set a variable then the variable will be initialized to 0. Almost all of the time that behaviour is exactly what you need.
I was working on a watchdog timer module this week and I ran into a problem. When I design a watchdog module, I make sure that every major task and/or function is working properly before resetting the watchdog timer. If the module detects an error then I like to save the error into RAM so that it is available for debugging later after the CPU resets. This has saved a ton of time over the years.
A Simple Task Manager
I’ve been working on a new microcontroller project this week and it got me thinking about task schedulers and real time operating systems (RTOSs). I define a microcontroller as a small CPU with a little bit of RAM and FLASH such as a PIC or Cortex-M0. Software designers get carried away when it comes to managing tasks and think that a context switching RTOS makes sense because that’s how it’s done on regular computers (PCs). RTOS’s do make sense in large systems where anyone’s code can be executed and the product designer has no control. But in small microcontroller designs they are overkill.