Shop OBEX P1 Docs P2 Docs Learn Events
Auto Detect Port — Parallax Forums

Auto Detect Port

mynet43mynet43 Posts: 644
edited 2009-11-19 20:18 in Propeller 1
I'm using a USB port to communicate with the Propeller from a PC.

This works fine. My only problem is, that USB picks a different COM port depending on which computer I'm using.

I'm planning to distribute the software. So I'd like it to auto-detect the COM port during start-up.

Can someone help me with the protocol used by the Propeller Tool to detect the COM port. It seems to work fine [noparse]:)[/noparse]

I assume it sends out something to each port and then checks for a return it recognizes.

Thanks for the help!

Jim

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-11-19 16:31
    I just use Propellent for that, let it do all the work, and avoid reinventing the wheel. Works great!

    -Phil
  • mynet43mynet43 Posts: 644
    edited 2009-11-19 18:34
    Phil,

    Thanks for suggesting the Propellent.

    Unfortunately, I don't think this will do what I need.

    I think I misstated what I'm doing.

    I have an application running on the PC.

    It inputs commands, sends and receives text messages to/from the Propeller, displays results and stores Propeller data to a file on the PC.

    I need my application to auto-detect the USB port connected to the Propeller. That's why I'm looking for the protocol.

    I'm sure it's not complicated.

    Thanks for the help.

    Jim
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-11-19 19:20
    That's exactly how I use Propellent: to scan the available ports to find a Propeller. It will reset any Propellers it finds, however, since doing so is part of the ID protocol. But if you have a program running on the Prop, why not just have it continuously send a certain character string that your program can identify? Then it's just a matter of querying Windows for a list of available serial ports and opening them one at a time to read until you find it.

    -Phil
  • mynet43mynet43 Posts: 644
    edited 2009-11-19 20:18
    Thanks Phil!

    I think I'll do something similar to what you suggest.

    I already reset the Prop, so that's not a problem.

    I'll let you know what I figure out.

    I was hoping to find Parallax' secret, to make it a little easier [noparse]:)[/noparse]

    Jim
Sign In or Register to comment.