Shop OBEX P1 Docs P2 Docs Learn Events
Communication between the Transceiver #27988 — Parallax Forums

Communication between the Transceiver #27988

JerryOSCJerryOSC Posts: 5
edited 2010-03-06 21:48 in General Discussion
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 =(

Comments

  • bill190bill190 Posts: 769
    edited 2010-03-06 01:18
    Is this two separate programs running on two separate BS2 boards (each with a transceiver)?
  • JerryOSCJerryOSC Posts: 5
    edited 2010-03-06 03:03
    ops my mistake.. below are the correction for my code...
    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
  • FranklinFranklin Posts: 4,747
    edited 2010-03-06 17:34
    You don't say what it does and does not do so how are we to help you? Also if you click the "post reply" button you can ATTACH your actual files to the post so we can load and run them on our computers.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • bill190bill190 Posts: 769
    edited 2010-03-06 19:54
    Might want to try a direct wire connection between boards and see if the basic serial connections and code is working. (Leave the wireless transmitters out of it for testing the code.)
    ·
  • JerryOSCJerryOSC Posts: 5
    edited 2010-03-06 21:48
    I think there might have some damaged from the transceiver itself... the transceiver can transmit data by sending ASPII code but the other transceiver happened to receive data but not all the time and now the transceiver is malfunction.. i think i might have to get another transceiver so that i can determine the source of the problem..
    Thanks all for helping and sorry for not able to provide enough information for u guys...

    -Jerry-
Sign In or Register to comment.