Introduction to Microcontroller Programming
About PICmicro Chips
Clocking Your PICmicro Devices
E-Blocks
Flowcode Step By Step
PICmicro Projects
Labs
|
- Expand your program by dragging a Loop icon below the 'PrintString' Component Macro.
- Change the text in the 'PrintString' Component Macro to "Hundredths:" (with quotation marks).
- Drag a Calculation icon into the Loop. Set up a variable called "Count" as an 'Int' type. Double-click on the Calculation icon. In the 'Calculations:' text box type "Count = Count + 1". This will add 1 to the value of variable count every time the icon is executed.
- Next drag another Component Macro into the Loop. Double-click the Component Macro and find 'Cursor' under the 'LCD' macros and enter '0,1' in the parameters. This will position the cursor on the first character of the second line.
- Next drag another Component Macro onto the workspace and do the same but select 'PrintNumber' instead and enter "Count" as the parameters.
- Next drag a Delay icon into the program and set the delay to 10ms or a hundredth of a second.
- Go over the program and click on each icon entering comments on what each icon does. This seems like a lot of effort, but if you can discipline yourself to entering comments you will save time in the long run as your programs will be easier to read.
- Run the program. You have now made a counter that will count (approximately) the time elapsed in hundredths of seconds.
|