Hi,
I know this is something I will kick myself for..
Simple circuit with PortC 4,5,6 and 7 set as inputs. But PortC. 5 will not trigger the test LED as shown in program below. Have changed PIC (18F2525) and checked circuit.
Any help will save whats left of my sanity!
Bob
**********************************************
DEFINE OSC 20 ' PIC18F2525
INTCON2.7 = 0 ' Enable weak pull-ups
ADCON0 = $00 ' Disable Analog
ADCON1 = $0F ' PORTB ALL DIGITAL
CMCON = $07 ' Compartors off
TRISB = %11110000 ' 0,1,2 & 3 set to OP
TRISC = %11110100 ' 0,1 & 3 set to OP.
PORTB=$0F
PORTC=$08
T4 VAR BYTE ' temp byte store
LedG VAR PORTB.0
LedY VAR PORTB.1
LedR VAR PORTB.3
BUZ VAR PORTC.3
start:
BUZ=1 ' buzzer off
LedR = 0 ' led off
LedG = 0 ' led off
LedY = 0 ' led off
PAUSE 500
t4=portc/16 ' Read the high 4 IPs. move to low byte
if (t4 & 0010)=0 then
ledY=1
pause 500
endif
if (t4 & 0100)=0 then
ledY=1
pause 500
endif
if (t4 & 1000)=0 then
ledG=1
pause 500
endif
if (t4 & 0001)=0 then
ledG=1
pause 500
endif
GOTO start
end
****************************************
Bookmarks