I am trying to test the tx/Rx using PulsIn command. I am sending a pulse by switching high/low a Tx pin and trying to receive the same using PulsIn command.
But at the receiver, I always see a "0" in ID variable, is there something wrong. But when I place a voltmeter at that particular pin, I do observe a high and low pulse but the same in not shown by ID variable.
Any hint, suggestion is appreciated.
Thanks,
Mankan
/*********Transmitter Code****************/
INCLUDE "modedefs.bas"
SHIFT_VAR VAR BYTE
TEMP VAR BYTE
I VAR BYTE
Loop:
HIGH PORTB.2
PAUSE 2000
HIGH PORTB.4
PAUSE 250
LOW PORTB.4
PAUSE 250
LOW PORTB.2
PAUSE 500
GOTO LOOP
/**********End of Tx code****************/
/*********Receiver Code****************/
INCLUDE "modedefs.bas"
'* Variable declarations
ID var WORD
ST var BYTE
RxData var st
DEFINE OSC 4
CMCON = 7
INPUT PORTB.1
Pause 500
Loop:
PulsIn PORTB.1,1,ID
if ID > 0 then
HIGH PORTB.5
PAUSE 50
LOW PORTB.5
PAUSE 50
else
HIGH PORTB.7
PAUSE 50
LOW PORTB.7
PAUSE 50
endif
GOTO LOOP
/********************END******************/
Bookmarks