Moving from Tethered Boe-Bot using SERIN to a transmitter module repeating SERI
Russ Ferguson
Posts: 206
I am experimenting with a Velleman transmitter/receiver pair.
·
I have a simple program in a Boe-Bot that uses SERIN to respond to the DEBUG window running on the PC. The Boe-Bot reacts to the numbers 1 thru 9 to move in the respective directions indicated on the numeric keypad.
·
I then pull the programming cable from the Boe-Bot and connect it to a BS2 Homework board with the transmitter installed on it. This BS2 is to "repeat" the DEBUG screen commands on the transmitter. The Boe-Bot program is changed to receive the SERIN from the receiver.
·
This works but not very well.·The·transmitter/receiver·pair·appears to go in and out of sync over time, in other words the Boe-Bot responds to the commands for a period of time, stops for a while, then responds again. It is very cyclical.
·
Am I overlooking something in the code that would make this program work better?
·
I·have·attached the·3 relatively simple programs that I am using.
"SERIN_Study1.bs2" - Control the Boe-Bot from the DEBUG screen with the programming cable attached to the Boe-Bot.
"SERIN_Study2.bs2" - Boe-Bot program to receive the DEBUG screen commands from the receiver.
"SERIN_Study3.bs2" - "Repeater" program for the Homework board.
·
I have a simple program in a Boe-Bot that uses SERIN to respond to the DEBUG window running on the PC. The Boe-Bot reacts to the numbers 1 thru 9 to move in the respective directions indicated on the numeric keypad.
·
I then pull the programming cable from the Boe-Bot and connect it to a BS2 Homework board with the transmitter installed on it. This BS2 is to "repeat" the DEBUG screen commands on the transmitter. The Boe-Bot program is changed to receive the SERIN from the receiver.
·
This works but not very well.·The·transmitter/receiver·pair·appears to go in and out of sync over time, in other words the Boe-Bot responds to the commands for a period of time, stops for a while, then responds again. It is very cyclical.
·
Am I overlooking something in the code that would make this program work better?
·
I·have·attached the·3 relatively simple programs that I am using.
"SERIN_Study1.bs2" - Control the Boe-Bot from the DEBUG screen with the programming cable attached to the Boe-Bot.
"SERIN_Study2.bs2" - Boe-Bot program to receive the DEBUG screen commands from the receiver.
"SERIN_Study3.bs2" - "Repeater" program for the Homework board.
Comments
EDIT: Heck, I'd even just forget about declaring sync at all, just get rid of·it, and do:
SERIN RcvrSerialPin, BaudIn, [noparse][[/noparse] WAIT("A") , DEC1 ContrlCmd]
Post Edited (cabojoe) : 9/8/2004 5:37:42 AM GMT
PBasic Code vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
DO
·· LoopBegin:
·· SERIN StampSerialPin, BaudInStamp, 50, LoopBegin,[noparse][[/noparse]DEC1 ContrlCmd]··· 'Same as DEBUGIN DEC1 ContrlCmd
·· 'ContrlCmd = 8
·· 'PAUSE 3
·· FOR sendCmd = 0 TO 15
···· SEROUT TxSerialPin, BaudOut, [noparse][[/noparse]sync, DEC1 ContrlCmd]
···· PAUSE 1
·· NEXT
LOOP
PBasic Code ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Test #2 - I changed all the·size of 'ContrlCmd' to WORD in this code and the code on the BOE-Bot and did not see any difference.
Test #3 - I used another variable to pass the contents of 'ContrlCmd' to a few other variables before·sending the contents·of·the final variable to SEROUT. Ended up with the same appearant results an·the PAUSE.
Test #4 - I changed the SERIN baud to 1200 and then used the special DEBUG window set to my com port and 1200 baud. This seemed to make a subtle difference, but it was not the solution.
Test #5 - Wired up 4 push switches on the ProtoBoard and used them to assign the variable 'ContrlCmd'. This works just find. In fact, we can use a 5th button, 2nd receiver, another robot, use a second sync pulse and control two robots by assigning each one a unique sync pulse.
Could it be that·the BS2 having trouble reading SERIN·and writing SEROUT in this configuration?·Do I need to wire up a second serial connection on another pin (ie. stop using pin 16)?
Russ
Here is a really interesting point. When I totally eliminate the 'snyc' variable from the TX SEROUT and RX SERIN they do not communicate at all.
I may put a scope on it to see if I can learn anything about the signal levels.
Looks like I am going to end up working with it the way it is. I see that there are several posts about serial communication over on the 'Basic Stamp' forum. Maybe I'll see something over there that help me find the problem.
Thanks for your posts.
I had a doubt regarding your implementation.
Is it possible to send 2 string commands to the boebot using SERIN?
For example: SERIN 0, 84, 50, LoopBegin,[noparse][[/noparse]DEC1 ContrlCmd. DEC1 X]
where X is the number of loops corresponding to time the robot moves.
in your code, if I were to write a For loop in the FORWARD Case which would be --- FOR cntr = 1 TO X ---- pulsout commands to move forward.
Then Can I send a string which is {8, 200} to make the robot move forward for 200 counts in loop? (ContrlCmd = 8 and X = 200)
I am doing this in order to control robot movement dynamically for a given period of time.
Is there any other way to do so using your code?
Thanks a lot.
-Labhesh.