Introduction to Microcontroller Programming
About PICmicro Chips
Clocking Your PICmicro Devices E-Blocks Flowcode Step By Step
PICmicro Projects
Labs |
Set up the Calculation
TOTAL = TOTAL + SHEEP
We are going to simulate the light beam using a single push switch on Port A bit 0 - the switch marked 'SW0' on the switch board.
(As we are using only one switch, the biggest number we can produce on Port A is 1.)
When the Calculation icon is activated, the number stored in the variable 'SHEEP' is added to the 'TOTAL' variable. When a sheep breaks the light beam, in other words, then 'TOTAL' is increased by 1. When no sheep is present, 'TOTAL' remains unchanged.
|