Serial I/O w/ FC not working properly
progjh
Posts: 4
Gentlemen -
I've used the BS2 off and on for literally dozens of projects over the past several years, always able to figure things out for myself without harassing others in these forums (in fact, I've never even used these forums, but happen to be exceptionally thankful for them on this particular day). I've encountered a bit of a problem that has me puzzled.
I've a BS2 circuit attached at one end to my PC using SOUT, SIN, ATN and VSS lines. VIN and VSS on the right side of the chip are connected. The chip powers and works fine.
On Pins p8, p9, p10 and p11, a Male DB9 is connected as outlined in the diagram. The Signal Ground from the DB9 ties back to the VSS of the power source on the right just below VIN.
I am attempting to empower the·BS2 to communicate with an automation controller which uses DTR handshaking. I've written a simple VB6 application which communicates with the controller flawlessly, proving that my cable works fine. The cable itself carries only pins 1 through 5; pins 6 and 7 perform a loopback at each end of the cable.
To further test the cable (as well as my BS2 code), I am able to communicate through the BS2 to a secondary PC using a similar VB6 application. In the VB6 app, DTR handshaking is enabled. The data seems to flow smoothly from the stamp to the PC both with and without use of the flow control function on P11.
So we've established that (A) the cable is fine, since it works both from PC to automation controller AND from Stamp to PC using DTR handshaking, (B) the stamp code at least SHOULD be working fine since it talks from the stamp to PC both with and without DTR handshaking in the code, and (C) the wiring of the circuit appears to be fine, given that the stamp circuit communicates at all.
When connected to the automation controller, however, the automation controller does not respond when the data stream is transmitted (as it does when the same stream is transmitted from the VB6 app on the PC). I know it's got to be a flow control issue, but I'm pulling my hair out and thus far have been unable to resolve it. I do not have the ability to disable DTR handshaking on the automation controller itself.
I've tried OUTing P8 high (the CD line) just on the off-chance the automation controller requires a signal on the CD pin. The automation controller seems indifferent.
Bright ideas would be VERY welcome right about now. Thanks in advance for any assistance you might be able to offer.
progjh@yahoo.com
I've used the BS2 off and on for literally dozens of projects over the past several years, always able to figure things out for myself without harassing others in these forums (in fact, I've never even used these forums, but happen to be exceptionally thankful for them on this particular day). I've encountered a bit of a problem that has me puzzled.
I've a BS2 circuit attached at one end to my PC using SOUT, SIN, ATN and VSS lines. VIN and VSS on the right side of the chip are connected. The chip powers and works fine.
On Pins p8, p9, p10 and p11, a Male DB9 is connected as outlined in the diagram. The Signal Ground from the DB9 ties back to the VSS of the power source on the right just below VIN.
I am attempting to empower the·BS2 to communicate with an automation controller which uses DTR handshaking. I've written a simple VB6 application which communicates with the controller flawlessly, proving that my cable works fine. The cable itself carries only pins 1 through 5; pins 6 and 7 perform a loopback at each end of the cable.
To further test the cable (as well as my BS2 code), I am able to communicate through the BS2 to a secondary PC using a similar VB6 application. In the VB6 app, DTR handshaking is enabled. The data seems to flow smoothly from the stamp to the PC both with and without use of the flow control function on P11.
So we've established that (A) the cable is fine, since it works both from PC to automation controller AND from Stamp to PC using DTR handshaking, (B) the stamp code at least SHOULD be working fine since it talks from the stamp to PC both with and without DTR handshaking in the code, and (C) the wiring of the circuit appears to be fine, given that the stamp circuit communicates at all.
When connected to the automation controller, however, the automation controller does not respond when the data stream is transmitted (as it does when the same stream is transmitted from the VB6 app on the PC). I know it's got to be a flow control issue, but I'm pulling my hair out and thus far have been unable to resolve it. I do not have the ability to disable DTR handshaking on the automation controller itself.
I've tried OUTing P8 high (the CD line) just on the off-chance the automation controller requires a signal on the CD pin. The automation controller seems indifferent.
Bright ideas would be VERY welcome right about now. Thanks in advance for any assistance you might be able to offer.
progjh@yahoo.com
Comments
Post Edited (Mike Green) : 1/15/2007 8:56:19 PM GMT
Bear in mind the serial port is *not* a secondary PC connection. This is the serial port interface to an automation controller which will be driven by the BS2 (although it's basically the same thing as a PC, for all practical intents and purposes).
It's possible, I suppose, that the signal level to voltage conversion is not throwing the proper value for Flow Control to operate properly... although why it talks to a PC (with a simple communications emulator simulating the automation controller) and not to the automation controller itself is still beyond me.
Mike
Will let you know if this turns out to be the source of the problem...
If you’re talking to an RS-232 device there’s one more thing to consider besides the fact that the signals are different voltages than TTL. They are also inverted. So when you’re sending serial data out to the device are you using inverted or non-inverted baud mode?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Signal is definitively inverted - see the code below.
For any interested parties, this project will mate a wireless modem through the BS2 (or possible SX - still examining options) to the automation controller, enabling us to interface to the automation controller in the field from a web site accessible through a web browser.
The circuit will take inbound keystrokes over a wireless modem and send them through the stamp to the automation controller. Similarly, the BS2 will take terminal output from the automation controller, strip unnecessary air and provide simple compression, and transmit it through my wireless interface to my downlink server here for subsequent delivery through my web interface.
Code follows :
' {$STAMP BS2}
' {$PBASIC 2.5}
SI PIN 9 ' Serial input
SO PIN 10 'Serial output
FC PIN 11 ' Flow control pin
Inverted CON $4000
Open CON $8000
Baud CON 84 + Inverted
letter VAR Byte
inkbd VAR Byte
Main:
DEBUGIN STR inkbd\1 ' temporarily gather input from keybd
' later input will come from wireless modem
IF (inkbd = "*") THEN SEROUT SO, Baud, [noparse][[/noparse]1,114,0,16,160,15]
IF (inkbd = "1") THEN SEROUT SO, Baud,[noparse][[/noparse]1,114,0,1,96,3]
IF (inkbd = "2") THEN SEROUT SO, Baud,[noparse][[/noparse]1,114,0,2,32,2]
IF (inkbd = "3") THEN SEROUT SO, Baud,[noparse][[/noparse]1,114,0,3,225,194]
IF (inkbd = "4") THEN SEROUT SO, Baud,[noparse][[/noparse]1,114,0,4,160,0]
IF (inkbd = "5") THEN SEROUT SO, Baud,[noparse][[/noparse]1,114,0,5,97,192]
IF (inkbd = "6") THEN SEROUT SO, Baud,[noparse][[/noparse]1,114,0,6,33,193]
IF (inkbd = "7") THEN SEROUT SO, Baud,[noparse][[/noparse]1,114,0,7,224,1]
IF (inkbd = "8") THEN SEROUT SO, Baud,[noparse][[/noparse]1,114,0,8,160,5]
IF (inkbd = "9") THEN SEROUT SO, Baud,[noparse][[/noparse]1,114,0,9,97,197]
IF (inkbd = "0") THEN SEROUT SO, Baud,[noparse][[/noparse]1,114,0,0,161,195]
gather:
'SERIN SI,Baud,100,Main,[noparse][[/noparse]letter]
'Now send accumulated inbound data from secondary serial
'out via tertiary serial port to wireless modem...
GOTO gather
END
With the controller turned on and idle, check pins 2 and 3 to ground. One of them should be about -8 to -12 volts. If not, you'll have put a MAX232 or MAX233 between the controller and the stamp to create the required negative voltages.
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support