RS232 input
edd
Posts: 6
Good day everyone
Im currently working on a project to control a Pan and Tilt system remotely, using two servos. I was successful using wireless transmitters but the hard part is using RS232 communication over Ethernet. Im using Digital video recorder (DVR) that streams over the net. The dvr has a PTZ control option that communicates using Visca and Pelco-D protocols. After reading on Viscal, The interface to the controller is RS-232C, 9600 bps, 8 bits data, 1 start bit, 1 stop bit and non parity.
I have programmed the BS2 to receive RS232 input but im unable to display that input via debug terminal or serout.
fB VAR Byte
again:
SERIN 1, 16468, [ fB]
SEROUT 16, 16468, 100, [ fB]
PAUSE 1000
GOTO again
If any one could help me receive R232 input to control the pan and tilt ( using two servos) , or any suggestion on how to improve the current code I would really appreciated
Im currently working on a project to control a Pan and Tilt system remotely, using two servos. I was successful using wireless transmitters but the hard part is using RS232 communication over Ethernet. Im using Digital video recorder (DVR) that streams over the net. The dvr has a PTZ control option that communicates using Visca and Pelco-D protocols. After reading on Viscal, The interface to the controller is RS-232C, 9600 bps, 8 bits data, 1 start bit, 1 stop bit and non parity.
I have programmed the BS2 to receive RS232 input but im unable to display that input via debug terminal or serout.
fB VAR Byte
again:
SERIN 1, 16468, [ fB]
SEROUT 16, 16468, 100, [ fB]
PAUSE 1000
GOTO again
If any one could help me receive R232 input to control the pan and tilt ( using two servos) , or any suggestion on how to improve the current code I would really appreciated
Comments
Without a description of the protocol used to send to the BS2, it's hard to say whether this is possible or how to do it. Basically, the BS2 would have to control how quickly and how much information is sent to it. This is hard to do at 9600 Baud. You're much more likely to get this to work at 2400 Baud. You'll have to provide much more information about the interface to the BS2 and the protocols used. Does the RS232 interface support flow control (RTS / CTS)?
You will have to fill (SERIN into) an array and then SEROUT that accumulated data.
Are you using the 22K series resistor on the SERIN pin?
Or are you using a MAX232 (or sim.) ?
The Pelco data is numeric data not ASCII, you should probably SEROUT the data as HEX or DEC, if it's going to a terminal or you're trying to read it.
SEROUT 16,16468,100,[HEX fB]
Since you are using "16", then use DEBUG:
DEBUG DEC fB
or
DEBUG HEX fB
The DVR doesnt say much about the RS232 output other than it supports Visca and Pelco PTZ cameras. So I started reading on Visca RS-232 control protocol.
thanks for the post is you guys can give me some aid in hooking the RSB509 to the BS2 and basic program that awesome
There is accessible an "Application Notes" section --
http://www.proteanlogic.com/applications/an012/rsb509.htm
http://www.proteanlogic.com/applications/an045/AN045_RSB509C_RCservo.htm
Ill post more once i get the items in
thanks you guys
Edd B
I have finaly receive the parts I needed to interface the basic Stamp 2 with RS232 input. I received the RSB509c and MAX232N. I followed the proteamlogic direction for inputting and displaying RS232 with no luck. I used the MAX232N by its self and I was able to get weir symbols. When I try to convert the input into DEC or HEX nothing displays on the debug terminal.
inval VAR Byte
HIGH 1
PAUSE 2
INPUT 1
SEROUT 1, 49236, [%00000100]
PAUSE 1
around:
HIGH 1
SERIN 1, 16468, 1, around, [inval]
DEBUG inval
GOTO around
END
If you guys have any suggestion, programming, and schematics I would really appreciated it.
I have tried every baud that the Basic stamp supports as per syntax manual, with no luck