Basic Stamp BS2p and Agilent Waveform Generator
zacharypch ~!at!~ gmail ~!dot!~ com
Posts: 13
Hi,
I am trying to get my basic stamp to communicate with an Agilent 33250A Arbitrary Waveform Generator via RS-232...I am not trying to do anything specific with the generator, I just want to figure out how to do serial communication. The command set the generator offers seems to be very similar to other devices, however I have not been able to figure out how to do serial communication on anything yet. Here is a subroutine I am trying to make work now:
Currently, the device reports input buffer overrun and packet framing errors, or otherwise fails to effect any outcome whatsoever. The function generator is connected to the BS2P24/40 via RS-232 crossover.
Thanks for the help.
I am trying to get my basic stamp to communicate with an Agilent 33250A Arbitrary Waveform Generator via RS-232...I am not trying to do anything specific with the generator, I just want to figure out how to do serial communication. The command set the generator offers seems to be very similar to other devices, however I have not been able to figure out how to do serial communication on anything yet. Here is a subroutine I am trying to make work now:
ResetValueInt CON 2 ResetValueDec CON 5 COMOutput CON 16 COMInput CON 16 COMBaud CON 110 FUNC_GEN_XON CON $11 FUNC_GEN_XOFF CON $13 ResetVoltage: SEROUT COMOutput, COMBaud, [noparse][[/noparse]HEX FUNC_GEN_XON] PAUSE 50 SEROUT COMOutput, COMBaud, [noparse][[/noparse]"output:state off", CR] PAUSE 50 SEROUT COMOutput, COMBaud, [noparse][[/noparse]"output:sync off", CR] PAUSE 50 SEROUT COMOutput, COMBaud, [noparse][[/noparse]"func square", CR] PAUSE 50 SEROUT COMOutput, COMBaud, [noparse][[/noparse]"frequency 1", CR] PAUSE 50 SEROUT COMOutput, COMBaud, [noparse][[/noparse]"volt:high 1", CR] PAUSE 50 SEROUT COMOutput, COMBaud, [noparse][[/noparse]"volt:offset 0", CR] ' SEROUT COMOutput, COMBaud, [noparse][[/noparse]"func:square:", CR] PAUSE 50 SEROUT COMOutput, COMBaud, [noparse][[/noparse]"burst:ncycles 1", CR] PAUSE 50 SEROUT COMOutput, COMBaud, [noparse][[/noparse]"output:state on", CR] PAUSE 50 SEROUT COMOutput, COMBaud, [noparse][[/noparse]"output:sync on", CR] PAUSE 50 SEROUT COMOutput, COMBaud, [noparse][[/noparse]HEX FUNC_GEN_XOFF] RETURN
Currently, the device reports input buffer overrun and packet framing errors, or otherwise fails to effect any outcome whatsoever. The function generator is connected to the BS2P24/40 via RS-232 crossover.
Thanks for the help.
Comments
That can cause framing errors too.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
COMING SOON "SD DATA LOGGER" www.sddatalogger.com
"I reject your reality, and substitute my own." Mythbusters
·
It would appear from the Agilent documentation that the default baud rate is 57.6 KBPS, unless you have changed it. Presuming you have, I suspct you now need to implement flow control for this to work properly. Your program is presently specifying a baud rate of 19.2 KBPS.
Just as a matter of reference, the default parameters for this generator are:
57.6 KBPS, 8, N, 1 start, 1 stop, DTR/DSR enabled
Since the units are not synched without the flow control, I suspect that's where these framing errors and/or data over-runs are coming from.
Just as a matter of information, with flow control enabled, the BS-2p is speed-limited to 19.2 KBPS. The PBASIC Manual or the PBASIC Help File will show you what you need to do to enable flow control.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
I dont think I a m familiar with your notation. The user manual for this device shows that it can do even or odd parity, as:
Start | 7 bits | Parity bit | stop bit
Or with no parity as:
Start | 8 bits | stop bit
I do not know what to do with the start and stop bits at this time, but if I am trying to send ascii, then that is 8 bits per char, does this mean that I have to do something smart with the bits before and after? Or is there some way I can tell the stamp to do it right?
Bean:
I don't think I know what those are...
As I mentioned a few moments ago, the PBASIC Manual or the PBASIC Help File will show you what you need to do to enable flow control. There is a standard RS-232 connector on the back of the generator, so everything should fall into place once you read the instructions, as the wiring set-up for flow control is also indicated in those instructions.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->