I am trying to get my 628 to read PORTA as input for a BCD switch. I am having problems though.
I tried CMCON = 7 and TRISA = %00001111
I set the switch on PORTA.0 - PORTA.3
Couldnt get anything to go..
So I switched to the following code just to test with, still no joy...
I need some pointers on this imput business...
Code follows :
define osc 4
TRISB = %11110000
PB0 VAR PORTB.0
PB1 VAR PORTB.1
PB2 VAR PORTB.2
PB3 VAR PORTB.3
SW0 VAR PORTB.4
SW1 VAR PORTB.5
SW2 VAR PORTB.6
SW3 VAR PORTB.7
SCAN:
If SW0 = 1 then
HIGH PB0
ELSE
LOW PB0
ENDIF
If SW1 = 1 then
HIGH PB1
ELSE
LOW PB1
ENDIF
If SW0 = 2 then
HIGH PB2
ELSE
LOW PB2
ENDIF
If SW0 = 3 then
HIGH PB3
ELSE
LOW PB3
ENDIF
goto scan
Bookmarks