I might have misread the original intent, but you did ask:
How is it possible to handle ONLY those four bits wihtout modifying the other (MSB) four bits?
"Under the hood" PBP will either write to the port as a Byte, or set/clear individual bits. This means you have 2 basic approaches:
1) Dave's approach, which deals with the port as a byte. This uses some bit manipulation to preserve the status of the MSBs.
2) And what I was trying to get at, but was not very clear, and that is to set each bit individually.
Just so I've got it straight, as your FOR...NEXT loop counts from 0 to 3 you would like to see a pattern on PORTAs LSB like: 0001, 0010, 0100, 1000. Is this correct?
If this is the case, then this should work:
Code:
Digit VAR Byte
DCD_temp VAR Byte
FOR Digit = 0 TO 3
DCD_temp = DCD Digit
PORTA.0 = DCD_temp.0
PORTA.1 = DCD_temp.1
PORTA.2 = DCD_temp.2
PORTA.3 = DCD_temp.3
NEXT Digit
SteveB
Bookmarks