Shop OBEX P1 Docs P2 Docs Learn Events
Communicating with a radio reciever — Parallax Forums

Communicating with a radio reciever

cknizeskicknizeski Posts: 3
edited 2011-11-15 18:37 in BASIC Stamp
Hi
I am trying to remotely control a Radio Scanner using RS 232. The reciever instruction manual says:

BPS Rates 4800/9600/19200/38400/57600/115200
Start/Stop bit: 1 bit, 1 bit
Data length 8
Parity Check: none
Code: ASC11
Flow Control: none
Return Code: Carriage Return only
It also states "Commands are required to wait for a response from the scanner, then, next command accecepted.

Whenever I send out a command it usually will return an error, but every now and than work, or will do something other than the command request. I am still learning using serial communication. It seams to work fine whenever I first turn the scanner on and sent the first command.

display VAR Byte(10)
counter VAR Nib
vol VAR Byte(10)
vol(10) = 0
INPUT 5
SEROUT 14, 84, [21]
PAUSE 5
SEROUT 14, 84, [22, 12]
PAUSE 5
DO
INPUT 5
IF IN5 = 1 THEN
SEROUT 16, 84, ["VOL", CR]
SERIN 16, 84, [STR vol\6\CR]
ENDIF
SEROUT 14, 84, [12, STR vol]
LOOP

Anyone know what I am doing wrong?
Thnaks
Chris

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-11-12 15:39
    The debugging port (pin 16) has some non-standard properties. For one, everything received by the Stamp is echoed back to the PC (or receiver) including the error or other response. Another issue is that the interface isn't really RS232. There are some tricks used that make it closer to RS232 signal levels like tapping the receive line to provide negative voltage for transmitting back to the PC, but this doesn't always work. You may need to use some other I/O pin along with something like MAX232 to do the level conversions.

    How does the receiver handle the different Bauds? Is there a setting in the receiver? Does it do auto-Baud detection ... that doesn't always work.
  • cknizeskicknizeski Posts: 3
    edited 2011-11-13 09:14
    Thanks for the response. The reciever baud rate is selectable. I tried diferent baud rates with the same results.

    I will give ti try with the MAX232.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-11-13 11:24
    Remember that the MAX232 inverts the signal, so you'll need to use the equivalent Baud constant, 16468 (for 8 bits, no parity, inverted mode, 9600 Baud).

    Correction: the MAX232 inverts the signal, but RS232 requires an inverted signal, so you'd use the same Baud constant (84) as you used before. ... What PJ says ...
  • cknizeskicknizeski Posts: 3
    edited 2011-11-15 18:37
    Just got in the MAX232, It works great, but I did not ave to invert the signal, it works with 84 Baud constant. Thanks for the help, I can continue on with my IR remote project now.

    Chris
Sign In or Register to comment.