No what is happening is (Assuming variable called COUNT = 0 so 0 is loaded into portA).acestu wrote:when I press the button the macro is called sending power to the whole of port A
When you press the button, the interrupt macro is accessed.
COUNT is assigned with 15
Code: Select all
COUNT=15
Now variable called COUNT is assigned with 15.
Now when program returns to main since COUNT = 15 when the program gets to: Decimal 15 = binary 1111 is now sent to port A so all LED's light
If you changed
COUNT=15
to say COUNT = 1
Then only 1st LED will light when pressed switch. It will make no difference if you keep pressing switch, only 1 will be assigned to COUNT so the LEDS will never change from the single 1 LED lit.
That is correct. 1 is added to what ever COUNT is currently set at.acestu wrote:
as in when it adds 1 to count it is not just 1 on its own , it is 1 plus whatever is already there , and I think what you are saying is that these numbers are sent to port a and it is showing in light the equivelant binary set.
So if COUNT =11
after
Code: Select all
COUNT = COUNT + 1
No your not correct.acestu wrote:Am I correct in thinking that the word "COUNT" is a set command and not just a variable name of your choice ?
COUNT is just the name of the variable the creator of the Flowchart decided to use. I did not pick that variable name as it was already in the flowchart you posted.
To summarize:
Based on Flowchat I posted.
COUNT = 0
Main loop keeps looping sending value of COUNT= 0 to portA
Switch pressed, loop halts, Interrupt macro is accessed, COUNT is assigned with 15, interrupt macro exited.
Main loop now continues forever sending value of COUNT= 15 to portA
Hope this helps.
Martin