That did the trick Joe. Thanks.
Here's the final product:
Code:
'initialize device
@ device pic16f737, INTRC_OSC_NOCLKOUT, MCLR_OFF, WDT_OFF
OSCCON = $60 'internal 4mHz oscillator
'Initialize ports
TRISA = 0 ' RA0 to RA3 inputs for DIP switch, RA4 - RA7 for pushbuttons
PORTA = 0
TRISC = $FF
'initialize variables
Tx var PORTB.1
Index var byte
X var word
switches var byte
'Initialize LCD
Pause 1000 'pause 1/2 sec to let LCD initialize
serout Tx,10, [22] 'turn display on, no cursor
serout Tx,10, [17] 'turn backlight on
serout Tx,10, [12] 'Clear screen
pause 5
serout Tx,10, ["Panel Selected:"]
pause 1000
loop:
Index = PORTc & $0F ' Read DIP switch AND mask lsb
LOOKUP2 Index,[1,3,3,4,5,6,7,8,9,10,11,12,13,14,15,16],X
serout Tx,10, [154," ",154] ' clear previous entry
serout Tx, 10, [#X]
pause 50
LEDS:
switches = (PORTC>>4) & $0F 'take msb & save as "switches"
if switches > 0 then
porta = switches 'enter value "switches" to portA
endif
Goto loop:
END
Bookmarks