jmbanales21485
- 24th July 2007, 05:51
I am trying to incorporate wireless technology into my pic projects and got the TWS 434 and RWS 434 transmitter and reciever modules.
From what i understand in the datasheet and a couple of examples I found, is that you can use serial communication to communicate between these 2 modules.
my problem is that i don't get any communication. I tried my program directly from pic to pic and it works fine, the problem is when i add these 2 modules then it doesn't work. I am using the 12F683 with a 4 MHZ internal osc. here is my code and hopefully someone can shed some light on how to get these things working
===========Reciever===============
Define OSC 4 'OSC at 4 MHZ
TRISIO = %000001 'Set PORTA.0 as input rest output
ANSEL = 0 '0 analog inputs
CMCON0 = 7 'Disable analog comparator
option_reg.7 = 0 'enable pullups
LCD VAR PORTA.1 'lcd output
rx var PORTA.0 'Serial Input
baud con 396 '2400 baud
synch CON "a"
dat VAR BYTE
dummy VAR BYTE
dummy = 0
dat = 0
begin:
serin2 rx, baud, [WAIT(synch), dat] 'receive "a" then get dat
dummy = dat
pause 5:serout2 LCD, baud, ["start", 1, DEC (dummy), 0] 'send out to LCD
goto begin
'===========transmitter============
Define OSC 4 'osc at 4 MHZ
TRISIO = %000000 'all output
ANSEL = 0 '0 analog inputs
CMCON0 = 7 'comparators off
option_reg.7 = 0
tx var PORTA.0
baud con 396 '2400 baud
junk VAR BYTE
synch CON "a"
dat VAR BYTE
dat = 0
junk = "j"
loopa:
pause 1000
serout2 tx, baud, [junk, junk, junk, junk, junk, junk, junk, junk, junk, junk] 'wait to synch oscillator
for dat = 1 to 255
serout2 tx, baud, [synch, dat] 'send data
pause 500
next dat
goto loopa
From what i understand in the datasheet and a couple of examples I found, is that you can use serial communication to communicate between these 2 modules.
my problem is that i don't get any communication. I tried my program directly from pic to pic and it works fine, the problem is when i add these 2 modules then it doesn't work. I am using the 12F683 with a 4 MHZ internal osc. here is my code and hopefully someone can shed some light on how to get these things working
===========Reciever===============
Define OSC 4 'OSC at 4 MHZ
TRISIO = %000001 'Set PORTA.0 as input rest output
ANSEL = 0 '0 analog inputs
CMCON0 = 7 'Disable analog comparator
option_reg.7 = 0 'enable pullups
LCD VAR PORTA.1 'lcd output
rx var PORTA.0 'Serial Input
baud con 396 '2400 baud
synch CON "a"
dat VAR BYTE
dummy VAR BYTE
dummy = 0
dat = 0
begin:
serin2 rx, baud, [WAIT(synch), dat] 'receive "a" then get dat
dummy = dat
pause 5:serout2 LCD, baud, ["start", 1, DEC (dummy), 0] 'send out to LCD
goto begin
'===========transmitter============
Define OSC 4 'osc at 4 MHZ
TRISIO = %000000 'all output
ANSEL = 0 '0 analog inputs
CMCON0 = 7 'comparators off
option_reg.7 = 0
tx var PORTA.0
baud con 396 '2400 baud
junk VAR BYTE
synch CON "a"
dat VAR BYTE
dat = 0
junk = "j"
loopa:
pause 1000
serout2 tx, baud, [junk, junk, junk, junk, junk, junk, junk, junk, junk, junk] 'wait to synch oscillator
for dat = 1 to 255
serout2 tx, baud, [synch, dat] 'send data
pause 500
next dat
goto loopa