
Originally Posted by
dsicon
i have some code like this:
'***********
Code:
WriteByte var byte 'WriteByte holds the on off states for 8 LEDs
LED32 var byte 'LED32 holds the bit position for LED32 on the pcb in the WriteByte byte
LED32 = 3 ' bit3 in WriteByte, LED32 is connected to bit3 of a port expander chip, not a PIC pin
WriteByte.3 = 0 'this turns on LED32 but is not very readable
'*************
but the above code is not very readable, i would like to write:
WriteByte.LED32 = 0
but above statement throws a compile error
what is the best way to handle this ? sadly, i think i used to know, an array ?
I think this is what you are getting at.
Code:
WriteByte VAR BYTE
LED32 VAR WriteByte.3
LED32 = 0
But, lets say that this LED is actually attached to pin 3 of PORTB. In this case, you could use this:
Or this:
Code:
WriteByte VAR PORTB
LED32 VAR WriteByte.3
HTH
Bookmarks