Hi there,
If got a little problem (but strange to me). I'm trying to use portE of my pic18F4455. Now i'm using it as an input, but later I also want to use it as an output.
The problem is that only pin RE3 look to work fine.
Here the code I'm using:
Code:
Include "modedefs.bas"
DEFINE OSC 4
E_0 VAR WORD
E_1 VAR WORD
E_2 VAR WORD
E_3 VAR WORD
TestLED VAR PORTC.6
RS232TX VAR PORTD.2
Intro:
ADCON0 = 7
ADCON1 = 7
ADCON2 = 7
CMCON = 7
TRISC = 255
HIGH TestLED
Pause 100
LOW TestLED
PAUSE 100
HIGH TestLED
Pause 100
LOW TestLED
SEROUT RS232TX,N9600, ["Start...",13,10]
GOTO Main
Main:
E_0 = PORTe.0
E_1 = PORTe.1
E_2 = PORTe.2
E_3 = PORTe.3
SEROUT RS232TX,N9600, ["E0=", #E_0, " E1=", #E_1, " E2=", #E_2, " E3=", #E_3 ,13,10]
Pause 200
GOTO Main
In the serial output only the RE3-value changes from 1 to 0, when I switch the pin from high to low
Output:
E0=0 E1=0 E2=0 E3=1
E0=0 E1=0 E2=0 E3=0
What am I doing wrong?
Bookmarks