|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
Hi, we're building an autonomous LADAR guided vehicle for my Senior Design team, and we're using a H.O.B. laser radar unit for our guidance. It talks to the BS2p via the RS-232 port...the H.O.B. is programmed so that it will output data when 2 "R"'s is inputted from the keyboard (this was when we were testing it using HyperTerminal)... the data will be a single byte, and is the range value, in the form 1-9,A-Z... meaning 1=1foot, 9=9feet, A=10feet, Z=36feet... etc... the H.O.B. unit transmission rate is 9600kbps and is using standard RS-232... The input voltage of the HOB itself from 5V to 9V However, the BS2p is not reading anything from the HOB when we attached it to the board's RS-232 port... We are testing this by connecting the HOB to board1 and have board1 read the data from the HOB, and send it to another BS2p board (board2) using port1. Board2 is then connected to the PC using the RS-232 port, allowing us to debug the incoming data. here is the code that we used: ------------------------------------------------------------------------- '{$STAMP BS2p} 'BOARD1 OutData VAR BYTE Bmode CON 16604 'Baudemode for 9600kbps Rpin CON 16 'RS-232 pin# Tpin CON 1 'port1 Pace CON 500 'wait time BigR CON 82 'DEC value of "R" in ascii Loop SEROUT Rpin, Bmode, [BigR] 'Sends "R" to HOB SEROUT Rpin, Bmode, [BigR] 'Sends "R" to HOB 'I think the problem is here... when the board sends out the 'second R, is the "serin" in the next line able to recieve the 'incoming data from the HOB in time? Take note, it's using the 'same port, port 16 (RS-232) for this... SERIN Rpin, Bmode, [OutData] 'Gets RANGE value from HOB, store in "OutData" SEROUT Tpin, Bmode, [OutData] 'Send "OutData" out from Port1 to board2 WAIT Pace GOTO Loop -------------------------------------------------------------------------- Here is the code for Board2: -------------------------------------------------------------------------- '{$STAMP BS2p} 'BOARD2 InData VAR BYTE Bmode CON 16604 'Baudemode for 9600kbps Tpin CON 1 'port1 Pace CON 500 'wait time SERIN Tpin, Bmode, [InData] 'Gets value from board1, store in "InData" DEBUG InData, CR WAIT Pace ------------------------------------------------------------------------- I also ran another test, without having to use the 2 boards... this time, I also connected board1 to the RC car we're using as a base... board2 was not used. here is the code: -------------------------------------------------------------------------- '{$STAMP BS2p} SerData VAR BYTE Bmode CON 16604 Rpin CON 16 Tpin CON 1 Pace CON 500 BigR CON 82 LittleR CON 114 Loop SEROUT Rpin, Bmode, [BigR] 'Sends "R" to HOB SEROUT Rpin, Bmode, [BigR] 'Sends "R" to HOB SERIN Rpin, Bmode, [SerData] 'Stores HOB data to "SerData" IF SerData>0 THEN Steer GOTO Loop Steer: PULSOUT 0, 1100 PAUSE 1000 PULSOUT 0, 1900 PAUSE 1000 GOTO Loop ------------------------------------------------------------------------- The PWM values under the "Steer" label have been tested to move the servo motor... but once again, nothing is happening... and we made sure that the HOB was pointing to an object that was atleast 4feet away.... Please help... when we run the DEBUG menu from board2, we're not getting any value at all. We have discussed this with parallax tech support, and they suggested that we might need to get a line driver, because the problem might be the voltage difference between the HOB and the board... but the HOB is using standard RS-232...Thanks for taking the time to read this looong post... Any suggestion would be most appreciated!!! ![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|