Communication between the Transceiver #27988
JerryOSC
Posts: 5
Hi guys...
I have been working for the communication between 2 parallax transceiver #27988 in bs2 language.
But i cant make these 2 devices communicate. Please help me...
Now i was trying to do testing for one way communication.
Transmitting
' {$STAMP BS2}
' {$PBASIC 2.5}
'---Set up Variables---
Value VAR Byte 'Holds data value being transmitted
'---Set up Constants---
Tx CON 11 'Transmit I/O pin number
'TxFlow CON 12 'Transmit flow control I/O pin number
N9600 CON $4054 'Baud mode value for 9600 baud, 8,N,1
pulse PIN 11
Initialize:
LOW Tx 'Initialize transmitter interface
'
Main Routine
'Transmit data
SenderMain:
'FOR Value = 0 TO 3 'Transmit numbers from 0 to 255
DEBUG CR
DEBUG "Input your command:", CR
SERIN Tx,N9600, [noparse][[/noparse]WAIT(Value)]
DEBUG CR
DEBUG "Your command is:", Value
IF Value = "F" THEN Transmit
IF Value = "B" THEN Transmit
IF Value = "L" THEN Transmit
IF Value = "R" THEN Transmit
Transmit:
PULSOUT pulse,100 'pulse // haven do
DEBUG "Transmitting: ",DEC2 Value,CR
SEROUT 16,16468,[noparse][[/noparse]Value]
PAUSE 100
'NEXT
'PAUSE 1000 'Pause for 1 second
GOTO SenderMain 'Then start over again
Receiving
' {$STAMP BS2}
' {$PBASIC 2.5}
'---Set up Variables---
Value VAR Byte 'Holds data value being transmitted
pulsecount VAR Byte
'---Set up Constants---
Rx CON 9 'Receive I/O pin number
'N9600 CON $4054 'Baud mode value for 9600 baud, 8,N,1
N9600 CON $4054
pulse PIN 9
'
Main Routine
'Receive data
ReceiverMain:
'PULSIN pulse, 100 ,
SERIN 16,16468,[noparse][[/noparse]Value] 'Receive one byte
DEBUG "Receiving: ",DEC2 Value,CR
IF Value = "F" THEN Forward
IF Value = "B" THEN Backward
IF Value = "L" THEN Left
IF Value = "R" THEN Right
GOTO ReceiverMain
Forward:
PULSOUT 13,850
PULSOUT 12,650
PAUSE 1
RETURN
Backward:
FOR pulsecount = 0 TO 40
PULSOUT 13,650
PULSOUT 12,850
'HIGH 12
'HIGH 13
PAUSE 20
'LOW 12
'LOW 13
NEXT
RETURN
Left:
FOR pulsecount = 0 TO 20
PULSOUT 13,650
PULSOUT 12,650
HIGH 13
PAUSE 20
LOW 13
NEXT
RETURN
Right:
FOR pulsecount = 0 TO 20
PULSOUT 13,850
PULSOUT 12,850
HIGH 12
PAUSE 20
LOW 12
NEXT
RETURN
Please help me =(
I have been working for the communication between 2 parallax transceiver #27988 in bs2 language.
But i cant make these 2 devices communicate. Please help me...
Now i was trying to do testing for one way communication.
Transmitting
' {$STAMP BS2}
' {$PBASIC 2.5}
'---Set up Variables---
Value VAR Byte 'Holds data value being transmitted
'---Set up Constants---
Tx CON 11 'Transmit I/O pin number
'TxFlow CON 12 'Transmit flow control I/O pin number
N9600 CON $4054 'Baud mode value for 9600 baud, 8,N,1
pulse PIN 11
Initialize:
LOW Tx 'Initialize transmitter interface
'
Main Routine
'Transmit data
SenderMain:
'FOR Value = 0 TO 3 'Transmit numbers from 0 to 255
DEBUG CR
DEBUG "Input your command:", CR
SERIN Tx,N9600, [noparse][[/noparse]WAIT(Value)]
DEBUG CR
DEBUG "Your command is:", Value
IF Value = "F" THEN Transmit
IF Value = "B" THEN Transmit
IF Value = "L" THEN Transmit
IF Value = "R" THEN Transmit
Transmit:
PULSOUT pulse,100 'pulse // haven do
DEBUG "Transmitting: ",DEC2 Value,CR
SEROUT 16,16468,[noparse][[/noparse]Value]
PAUSE 100
'NEXT
'PAUSE 1000 'Pause for 1 second
GOTO SenderMain 'Then start over again
Receiving
' {$STAMP BS2}
' {$PBASIC 2.5}
'---Set up Variables---
Value VAR Byte 'Holds data value being transmitted
pulsecount VAR Byte
'---Set up Constants---
Rx CON 9 'Receive I/O pin number
'N9600 CON $4054 'Baud mode value for 9600 baud, 8,N,1
N9600 CON $4054
pulse PIN 9
'
Main Routine
'Receive data
ReceiverMain:
'PULSIN pulse, 100 ,
SERIN 16,16468,[noparse][[/noparse]Value] 'Receive one byte
DEBUG "Receiving: ",DEC2 Value,CR
IF Value = "F" THEN Forward
IF Value = "B" THEN Backward
IF Value = "L" THEN Left
IF Value = "R" THEN Right
GOTO ReceiverMain
Forward:
PULSOUT 13,850
PULSOUT 12,650
PAUSE 1
RETURN
Backward:
FOR pulsecount = 0 TO 40
PULSOUT 13,650
PULSOUT 12,850
'HIGH 12
'HIGH 13
PAUSE 20
'LOW 12
'LOW 13
NEXT
RETURN
Left:
FOR pulsecount = 0 TO 20
PULSOUT 13,650
PULSOUT 12,650
HIGH 13
PAUSE 20
LOW 13
NEXT
RETURN
Right:
FOR pulsecount = 0 TO 20
PULSOUT 13,850
PULSOUT 12,850
HIGH 12
PAUSE 20
LOW 12
NEXT
RETURN
Please help me =(
Comments
these two are in one program but running in the same separate BS2 boards(each with a transceiver)..
is actually i tried to send command to one transceiver attached to one BS2 board so that it can communicate with my BoeBot(attached with another tranceiver)
After testing is done, i found that my BS2 board can send command to my boebot but my boebot happened to not received the command..
i would be very grateful if you can help me...
thanks..
Transmitting...
' {$STAMP BS2}
' {$PBASIC 2.5}
'---Set up Variables---
Value VAR Byte 'Holds data value being transmitted
'---Set up Constants---
Tx CON 11 'Transmit I/O pin number
'TxFlow CON 12 'Transmit flow control I/O pin number
N9600 CON $4054 'Baud mode value for 9600 baud, 8,N,1
Initialize:
LOW Tx 'Initialize transmitter interface
'
Main Routine
'Transmit data
SenderMain:
'FOR Value = 0 TO 3 'Transmit numbers from 0 to 255
DEBUG CR
DEBUG "Input your command:", CR
SERIN 16,16468, [noparse][[/noparse]Value]
DEBUG CR
DEBUG "Your command is:", Value
IF Value = "F" THEN Transmit
IF Value = "B" THEN Transmit
IF Value = "L" THEN Transmit
IF Value = "R" THEN Transmit
Transmit:
PULSOUT Tx,1200
DEBUG "Transmitting: ",DEC2 Value,CR
SEROUT Tx,N9600,[noparse][[/noparse]Value]
PAUSE 100
'NEXT
'PAUSE 1000 'Pause for 1 second
GOTO SenderMain 'Then start over again
Receiving...
' {$STAMP BS2}
' {$PBASIC 2.5}
'---Set up Variables---
Value VAR Byte 'Holds data value being transmitted
pulsecount VAR Byte
'---Set up Constants---
Rx CON 9 'Receive I/O pin number
'N9600 CON $4054 'Baud mode value for 9600 baud, 8,N,1
N9600 CON $4054
'
Main Routine
'Receive data
ReceiverMain:
'PULSIN pulse, 100 ,
SERIN Rx,N9600,[noparse][[/noparse]Value] 'Receive one byte
DEBUG "Receiving: ",DEC2 Value,CR
IF Value = "F" THEN Forward
IF Value = "B" THEN Backward
IF Value = "L" THEN Left
IF Value = "R" THEN Right
GOTO ReceiverMain
Forward:
PULSOUT 13,850
PULSOUT 12,650
PAUSE 1
RETURN
Backward:
FOR pulsecount = 0 TO 40
PULSOUT 13,650
PULSOUT 12,850
'HIGH 12
'HIGH 13
PAUSE 20
'LOW 12
'LOW 13
NEXT
RETURN
Left:
FOR pulsecount = 0 TO 20
PULSOUT 13,650
PULSOUT 12,650
HIGH 13
PAUSE 20
LOW 13
NEXT
RETURN
Right:
FOR pulsecount = 0 TO 20
PULSOUT 13,850
PULSOUT 12,850
HIGH 12
PAUSE 20
LOW 12
NEXT
RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
·
Thanks all for helping and sorry for not able to provide enough information for u guys...
-Jerry-