Shop OBEX P1 Docs P2 Docs Learn Events
Visual Basic and BS2sx — Parallax Forums

Visual Basic and BS2sx

chazbrazilchazbrazil Posts: 27
edited 2006-04-13 15:38 in BASIC Stamp
I am attempting to communicate via the Comm port to the BS2sx through Visual Basic so I can log data. What is the serial setting? (Baud rate, parity, etc.?)
·

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2006-04-13 14:38
    You can set the baud rate the BS2sx uses through the 'baudmode' parameter. I find 9600 baud most useful, but you'll have to look up in the manual what baud-mode constant for the BS2sx corresponds to 9600 baud.

    The BS2 only does 8-bit, no parity or 7-bit, even parity. Again, selected with a flag on the baudmode constant.

    And if you use the 'programming' port, (SEROUT 16, ...) then I believe you should use 'Inverted' mode -- again, yet another flag on the Baudmode constant.
  • chazbrazilchazbrazil Posts: 27
    edited 2006-04-13 14:42
    allanlane5 said...
    You can set the baud rate the BS2sx uses through the 'baudmode' parameter. I find 9600 baud most useful, but you'll have to look up in the manual what baud-mode constant for the BS2sx corresponds to 9600 baud.

    The BS2 only does 8-bit, no parity or 7-bit, even parity. Again, selected with a flag on the baudmode constant.

    And if you use the 'programming' port, (SEROUT 16, ...) then I believe you should use 'Inverted' mode -- again, yet another flag on the Baudmode constant.
    Do you by any chance have any sample code that shows a visual basic and bs2 communicating?
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-04-13 14:44
    Funny you should ask...

    Please see the attached.· Note it is for a BS2, so you'll need to change the
    baud-mode constant for a BS2sx.· I keep saying this, because it can be
    really un-obvious to the first-time BS2 user, who typically puts a value
    like "9600" in there, expecting that to work.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-04-13 14:49
    csfan worked out a set of programs, recently -- http://forums.parallax.com/showthread.php?p=580535

    (it's one-way comm, the STAMP/boebot is receive-only)
  • chazbrazilchazbrazil Posts: 27
    edited 2006-04-13 15:20
    How do you reference the Sout Pin? You use S_out in your program and it wont recognize
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-04-13 15:35
    Well you can define "S_out" as:

    S_out CON 16

    and that should work. Or, you could have used the 'A' example, and it should work unmodified.
    But good catch, that.
  • chazbrazilchazbrazil Posts: 27
    edited 2006-04-13 15:38
    allanlane5 said...
    Well you can define "S_out" as:

    S_out CON 16

    and that should work. Or, you could have used the 'A' example, and it should work unmodified.
    But good catch, that.
    Oh sorry... I'm still trying to get a hang of all this.
Sign In or Register to comment.