Thanks Darrel,
Is this what you meant?
Variable X0 is the segment pattern and is sent to the output ports.
TRISB. I use OR to maintain portB.1 as input
TRISA. I use OR to maintain PortA.2 and PortA.3 as inputs
Is there an better approach?
'initialize ports
TRISA = %00001100 'configure port A outputs = 0
TRISB = %00000010 'configure port B outputs = 0
Thanks,
Mark
'write segments to ports A and B
PORTB.0 = X0.0 ' Send segments to LED 0 = ON
PORTA.4 = X0.1
PORTA.6 = X0.2
PORTB.3 = X0.3
PORTB.4 = X0.4
PORTB.5 = X0.5
PORTB.6 = X0.6
PORTB.7 = X0.7
TRISB = X0 OR %00000010 ' OFF segments = 1 (set to inputs)
X1=X0 AND %01010000 ' isolate X1= PortA.4 and PortA.6 bits
TRISA = X1 OR %00001100 'maintain PortA.2 and PortA.3 inputs
Bookmarks