Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Chip: RS232 (and/or wireless communication) and Visual Basic or Delphi — Parallax Forums

Propeller Chip: RS232 (and/or wireless communication) and Visual Basic or Delphi

eWizardIIeWizardII Posts: 20
edited 2008-07-03 22:44 in Propeller 1
I am trying to work on a project that would incorporate sending and receiving information from the propeller chip, via RS232 and/or wirelessly, this flow of information would then be managed via a visual basic program. Since I am relatively new to .spin and the propeller I was wondering if anyone had any ideas, advice, or had worked on a similar project. (If it cannot be done in VB or Delphi, I am willing to learn another language to work on this project)

Thanks,

I did check out these post:
http://forums.parallax.com/forums/default.aspx?f=21&m=180521
http://forums.parallax.com/forums/default.aspx?f=25&m=270958&g=271829#m271829

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-02 17:07
    From a Propeller programming standpoint, there's nothing special involved. There's an I/O driver that comes with the Propeller Tool called FullDuplexSerial which implements a buffered full duplex serial connection at pretty much any speed (up to 230KBaud) and on any pair of I/O pins including the ones used for downloading programs. If you use the download pins, you've already got a hardware connection to the PC. If, for some reason, you have to use other pins, you will need some kind of 3.3V logic to RS232 or USB to serial adapter or, if you're using a wireless adapter, you may be able to connect it directly if it uses 3.3V logic. The only thing to watch for is that, when the serial download port is opened or closed, the Propeller will reset unless you disconnect the Propeller's reset circuitry when you're using the serial port for your own uses. The Propeller Tool uses this functionality to reset the Propeller to initiate a download.

    From the standpoint of Visual Basic, the Propeller just looks like another serial port. You'll have to decide how you want to send the information back and forth and write both the VB program and the Propeller Spin program appropriately.
  • eWizardIIeWizardII Posts: 20
    edited 2008-07-02 17:13
    Okay, thanks. So then the implementation will probably be similar to how users have interfaced VB and Basic Stamps?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-02 17:19
    Yeah. The one issue that's different is that FullDuplexSerial is buffered so you don't have to worry about missing characters the way you do with the Stamps. The normal buffer is only 16 characters, so you do have to watch your message lengths if your program is going to be busy for periods of time or you have to increase the buffer size (pretty easy to do).
  • hippyhippy Posts: 1,981
    edited 2008-07-02 17:20
    You shouldn't have any problem with that - it's just like BS and VB interfacing.

    You can pass data through MAX232 and similar interfaces or have a direct link using just a couple of resistors. It's not RS232 compliant but I've had no problems with that up to 115200 baud. Just a question of getting the polarity and timing right.
  • eWizardIIeWizardII Posts: 20
    edited 2008-07-02 17:38
    Thanks, I was able to find the FullDuplexSerial code. Is there any example or sample code that shows how to use it with respect to VB?

    Hippy,
    So where you able to get the timing right without an oscilloscope?
  • hippyhippy Posts: 1,981
    edited 2008-07-02 23:10
    Close enough for it to work a PC. There's around +/-6% overall tolerance for most serial comms so that's a fair bit to play with even if both ends are slightly out. Simple math should give a close match. If you cannot be bothered with any of that, running through various bit times and printing those out gives an upper and lower bound for what works so the middle of that is a good bet.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-02 23:34
    You might be able to find some previous projects where people have used VB and a Propeller together, but most of the work is on the VB side in that you have to be able to open a serial port and to read from and write to it. There are plenty of examples of the use of FullDuplexSerial. It's really very simple. All you have to do is initialize it ... Give it the pin numbers to use and the Baud. There is a mode parameter, but it's usually zero and, like pretty much all Propeller objects, it's documented in the source code. From that point, you send characters out the port or you fetch received characters (or wait for them to show up). There are routines to convert numbers to decimal digits, hexadecimal or binary forms, or to output literal strings or single characters. There's an "object" in the Propeller Object Exchange called Extended FullDuplexSerial which adds a layer that does input conversions (have a look at it for details).
  • jazzedjazzed Posts: 11,803
    edited 2008-07-03 00:31
    The VB6 MSCOMM/VbTerm.prj (yaya a 'lil behind) was very easy to make work with Propeller.
    C:\Program Files\Microsoft Visual Studio\MSDN98\98VSa\1033\SAMPLES\VB98\Mscomm

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • eWizardIIeWizardII Posts: 20
    edited 2008-07-03 22:44
    Okay, thanks, I'm going to go try it out, and see how it goes.
Sign In or Register to comment.