For
MrDEB education, let me explain my above comment.
Code:
For x = 0 To 7 //set all portc LED off
PORTC.bits(x) = 0
Next
This loop runs through 8 times and generates a whole lot of machine code to set each bit of PortC to zero.
This command does the same thing in one step.
The percent sign indicates a binary number of 8 bits, all set to zero.
%00000000 (binary) = 0 in decimal.
Same result as above. All bits set to zero.
Let's say you wanted to make all the outputs high to turn all the LEDs on. A similar loop could do it.
Code:
For x = 0 To 7 //set all portc LED off
PORTC.bits(x) = 1
Next
But it would be easier to use this.
The binary number sets all bits to 1 in one step.
What does this do?
256 is the decimal number equal to %11111111, so it sets all eight bits to 1.
What about this?
The $ indicates a hex number. F = %1111 in binary, so FF =:%11111111. Same thing again. All LEDs on in one step.
Finally, before I go back to sleep, think about what this would do.
Code:
While 1 = 1
PortC = %10101010
DelayMS(1000)
PortC = %01010101
DelayMS(1000)
Wend
Think it through. It's not difficult.