Alright...time to completely forget ALL about this serial business...
TX Side:
Code:
DEFINE OSC 20 'Defines oscillator rate
ADCON1=$ff : Output PortD.0 'output on PortD.0
LOOP: PortD.0 = 1 : pause 500 : PortD.0 = 0 : pause 500 : goto loop
END
Should flash an LED connected to PortD.0 once per second, 1/2 on, 1/2 off...
RX Side:
Code:
DEFINE OSC 20
temp var byte : Input PortB.7
Loop:
if PortB.7 = 1 then 'checks logic level on Portb.7
PortB.0 = 1 'if it's high, set B.0 high
else
PortB.0 = 0 'otherwise set it low
endif
temp = temp + 1 : portB.1 = temp.7 'increase the temp variable, and set b.1 to match the temp variable's bit 7
goto loop
END
PortD.0 on the TX, connected to PortB.7 on the RX.
LED connected to PortB.0 <- follows PortB.7, which should follow PortB.7
LED connected to PortB.1 <- should flash quickly showing that the loop is running...if you think it's flashing too fast to see it, change temp var byte to temp var word and change temp = temp + 1 : portb.1 = temp.7 to temp = temp + 1 : portb.1 = temp.15
If that doesn't work, you've got hardware and/or config problems somewhere and it's time to write a blinky for both individually and get the pins themselves working.
Bookmarks