Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp BS2p and Agilent Waveform Generator — Parallax Forums

Basic Stamp BS2p and Agilent Waveform Generator

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:

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

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-06-02 18:44
    Framing error usually results from parity error, possibly bps or Stop Bit.· Is this Agilent unit 8-N-1?··The STAMPs can only do 8-N-1 or 7-E-1 (no 8-N-2, 7-N-1, 8-E-1,·&c.)
  • BeanBean Posts: 8,129
    edited 2006-06-02 18:50
    Have you tried both inverted and true serial modes ?
    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
    ·
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-06-02 19:01
    Zachary -

    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 -->
  • edited 2006-06-02 19:03
    PJ:
    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...
  • edited 2006-06-02 19:12
    Ok, well I see that I can specify a pin to use to monitor flow control, but what should it be wired to?
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-06-02 19:36
    Zachary -

    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 -->
  • edited 2006-06-02 19:40
    Ok, well I think my problem is that I don't know how to access the ATN pin from the basic stamp on my bs2p24/40 demo board. Ill find it though, thanks for your help.
  • RGuyserRGuyser Posts: 90
    edited 2006-06-03 05:30
    would a max232 chip help him?
Sign In or Register to comment.