Stamp to Robot communication
Imad Mansour
Posts: 3
I'm new to the forum and new to PBasic. So please bear with me. We've built a small control box using a BS2p to act as an intermediary between two laboratory robotic devices (neither of which are manufactured by my company). The intent is for the control box to recieve input from machine 'A' (using digital I/O), and then issue a command string to machine 'B' via DB9/RS232 - (9600,8,N,1),. I've had intermittant success in getting it to work. The main problem has been on the machine 'B' side. I've reduced my program down to:
' {$STAMP BS2p}
' {$PBASIC 2.5}
Main:
'DEBUG " "
SEROUT 16, 240,["AM21",CR]
PAUSE 12000
GOTO Main
The twelve second pause is ample time for the device to complete its action. Upon turning on the controller, the command string is issued and machine B does its thing - sometimes. Sometimes, it will repeat when the loop comes around, but usually not. I've hooked up the control box to hyperterminal and watched as it successfully issued the command string every 12 seconds - so I know that it is getting out. I've hooked up machine B to hyperterminal and successfully sent the same command string to it many, many times. So I'm fairly certain that it is working properly. I played around with the PACE setting and at one point thought I had solved the problem when the above program successfully looped 10 times before I turned it off. However, upon turning it back on, it went back to it's original erratic behaviour. Very confusing. I don't know much about electronics, but is it possible that this may be due to an incorrect voltage swing on the serial port? If that doesn't make sense given the above information, are there any suggestions as to what might be going on, or where I should look?
Thank you in advance.
Imad
' {$STAMP BS2p}
' {$PBASIC 2.5}
Main:
'DEBUG " "
SEROUT 16, 240,["AM21",CR]
PAUSE 12000
GOTO Main
The twelve second pause is ample time for the device to complete its action. Upon turning on the controller, the command string is issued and machine B does its thing - sometimes. Sometimes, it will repeat when the loop comes around, but usually not. I've hooked up the control box to hyperterminal and watched as it successfully issued the command string every 12 seconds - so I know that it is getting out. I've hooked up machine B to hyperterminal and successfully sent the same command string to it many, many times. So I'm fairly certain that it is working properly. I played around with the PACE setting and at one point thought I had solved the problem when the above program successfully looped 10 times before I turned it off. However, upon turning it back on, it went back to it's original erratic behaviour. Very confusing. I don't know much about electronics, but is it possible that this may be due to an incorrect voltage swing on the serial port? If that doesn't make sense given the above information, are there any suggestions as to what might be going on, or where I should look?
Thank you in advance.
Imad
Comments
One way to fix this is to use a MAX232 attached to a regular I/O pin (0 to 15) to generate a "proper" RS232 signal. Another way would be to use a 6V battery to supply the negative voltage. A 4 AA cell battery pack would do with the positive lead connected to the DB9 ground pin and the negative lead connected to the DB9 receive pin. The current drain is small (about 250uA) and the batteries should last for thousands of hours.
Thank you.