MikroC can do software simulation to check your codes... I'll show the basic method below...
To start with, make sure the debugger is set to "Software Simulator". It's on the lower left hand side of the screen. The other option is for MikroC custom-made ICD2 equivalent... Unfortunately, MikroC does not support the ICD2 from Microchip... their way of making extra buck by requiring you to buy their ICD2...
Then, you start the Debugger by pressing F9 or use the menu or the icon... Icon is on the right hand side... the one with the green arrow pointing downward...
Once the debugger started, a Watch window will open... this is you view toward everything... basically you select the variable you want to see, from the list, then click 'Add'...
After you click 'Add', the variable selected, in this case PORTB, will appear in the watch window. Click on the '0' next to PORTB and a small icon will appear next to the '0'. Click that icon to bring up the viewing option... In this case, just select binary... using binary, we can see how the bits look like...
After clicking OK, you're back to the watch window... Press 'F8' to step through your code... you'll see a blue bar highlighting the next instruction to be executed... PORTB value will change accordingly...
That's it... you've just simulated your code... if it work in the simulator, it stands very good chance to work in the actual circuit...
PIC-Based Battery Monitor
-
My friends, as usual, drove me to craziness again and led me to design,
fabricate and test a smart battery monitor... The usual blinking lights and
so on.....
13 years ago
No comments:
Post a Comment