Shop OBEX P1 Docs P2 Docs Learn Events
Serial Comm — Parallax Forums

Serial Comm

ArchiverArchiver Posts: 46,084
edited 2004-02-04 04:59 in General Discussion
I want to communicate with my serial port on com5. I was thinking
about using the bios.h file in C++ to do this. But ive heard that
this has problems with the windows enviroment. This has lead me to
believe that i should do it visual basic. If any has any suggestions
on how to send characters through my serial cable or if you have and
examples of code i can use written in C++ or visual basic that would
ideal.

Thank you

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-03-26 23:09
    > I want to communicate with my serial port on com5. I was thinking
    > about using the bios.h file in C++ to do this. But ive heard that
    > this has problems with the windows enviroment. This has lead me to
    > believe that i should do it visual basic. If any has any suggestions
    > on how to send characters through my serial cable or if you have and
    > examples of code i can use written in C++ or visual basic that would
    > ideal.

    We have a series of VB tutorials by Jared Hoylman on using the serial port
    with the Stamp here: http://www.rentron.com/VisualBasic.htm

    With several more in our BASIC Stamp projects section below.
    http://www.rentron.com/BasicStamp.htm

    Regards,

    -Bruce
    webmaster@r...
    http://www.rentron.com
  • ArchiverArchiver Posts: 46,084
    edited 2002-03-26 23:48
    Have a look at http://www.al-williams.com/stampcom.zip - VB and C++
    example there.

    Al Williams
    AWC
    * Floating point math for the Stamp, PIC, SX, or any microcontroller
    http://www.al-williams.com/awce/pak1.htm



    >
    Original Message
    > From: compsci2522003 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=N_GbBWEYt1VPq12rHCvE4OycNrSf6T9aJPtiuQ-rNbbTUB4ZWNwu-flEZQ0CGmvtbkyYf8Rx5ZSpSwBYfxDx-AH8eyTQ]waseemthedream@h...[/url
    > Sent: Tuesday, March 26, 2002 12:21 PM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Serial Comm
    >
    >
    > I want to communicate with my serial port on com5. I was thinking
    > about using the bios.h file in C++ to do this. But ive heard that
    > this has problems with the windows enviroment. This has lead me to
    > believe that i should do it visual basic. If any has any suggestions
    > on how to send characters through my serial cable or if you have and
    > examples of code i can use written in C++ or visual basic that would
    > ideal.
    >
    > Thank you
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    > Subject and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
  • ArchiverArchiver Posts: 46,084
    edited 2002-03-27 01:46
    thanks a lot guys, your input has helped me greatly. if any one wants
    to add anything feel free.

    Waseem
  • ArchiverArchiver Posts: 46,084
    edited 2002-03-27 15:19
    check out www.beyondlogic.org

    Craig Peacock has a great deal of info on any port as
    well as RS232 C examples, both polled and using
    intrerrupts

    radu

    __________________________________________________
    Do You Yahoo!?
    Yahoo! Movies - coverage of the 74th Academy Awards®
    http://movies.yahoo.com/
  • ArchiverArchiver Posts: 46,084
    edited 2003-04-24 02:03
    I tried the serial protocol that comes with the tokenizer and I have
    some questions.
    I started with one mscomm control and an api call for timer with a 1
    ms resolution. I set dtr and the comm break for the right number of
    ms as per the parallax serial protocol document. The on comm event
    was used to trap responses and a case statement made the choice of
    what to send next. Each time i received the right return from the
    stamp except when the firmware version was checked. When I sent
    a "0" in the identify sequence, I get back a "0" but no
    firmware version or anything. Thats as for as i got.
    I tried everything. Iam using VB 5.0. The reset
    works i am pretty sure because the simple program in
    the bsII which i have an led blinking ten times
    resets. I also wrote the same program on a win ce
    pocket pc using nsbasic ce and i have the same
    problem. My goal is to load an object(hex) file
    generated by the BSII ide and load to the stamp using
    my pocket pc. I don't think the present tokenizer dll
    will work on ce. Parallax states they will come out
    with a ce dll in the future. I have developed a number
    of experiment for the BSII including a paper
    chromatography reader using the toas sensor. I would
    like to create a module based educational tool using
    the BSII oem and different modules to teach science
    with. I will be glad to publish all my projects when
    complete for everyone to use free. Thanks for your
    help.
    Curtis Desselles
  • ArchiverArchiver Posts: 46,084
    edited 2003-04-24 09:27
    Hi Curtis

    You will recevie the firmware version of your stamp only after
    sending the right sequence of characters. The sequence is
    specific to the type of stamp. See the code extract (from my
    stampbc basic compiler for linux) below:

    {"BS2", "", STAMPID_BS2, 0},
    {"e", "e", STAMPID_BS2E, 8},
    {"X", "XYZ", STAMPID_BS2SX, 8},
    {"P", "pqrsPQRS", STAMPID_BS2P , 8},
    {"I", "ijkIJK", STAMPID_BS2PE, 8},
    {0, 0, 0, 0}
    // | | | |
    // | | | how many memory slots the stamp
    has
    // | | type string returned by sType
    // | valid response chars from stamp
    // request ID-char to be sent to the stamp

    The BS2 differs somewhat as it needs several characters to be sent
    before it replies with a firmware version string.
    The higher BS2xx only need a single ID character and reply with
    a single character which has to be reinterpreted as a version number
    (see next code extract below):

    const char* SBLoader::m_versionID[noparse]/noparse[noparse][[/noparse]2] = {
    {"e", "v1.0"},

    {"X", "v1.0"},
    {"Y", "v1.1"},
    {"Z", "v1.2"},

    {"p", "24 v1.0"},
    {"q", "24 v1.1"},
    {"r", "24 v1.2"},
    {"s", "24 v1.3"},
    {"P", "40 v1.0"},
    {"Q", "40 v1.1"},
    {"R", "40 v1.2"},
    {"S", "40 v1.3"},

    {"i", "24 v1.0"},
    {"j", "24 v1.1"},
    {"k", "24 v1.2"},
    {"I", "40 v1.0"},
    {"J", "40 v1.1"},
    {"K", "40 v1.2"},

    {0, 0}
    // | |
    // | decoded version infromation
    // coded version returned by the stamp
    };

    Also note that the stamp (via Rx/Tx) echoes every character
    you send to it. So if you have a BS2e, you would send a 'e'
    to get the firmware version. The stamp would return that 'e'
    and then reply with a second one which means firmware V1.0.

    Hope this helps.

    You said you want to develop a module based educational tool.
    May be that is quite close to what I developed/am developing -
    see my breif artice "MACS_article.txt" in the files section.
    I am using a TCS230 color sensor controlled by '595 serial
    to parallel converter module to do colorimetric analysis.
    If you are interested in some details regarding hard or software,
    please don't hesitate to contact me.

    Regards
    Adrian
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-04 04:59
    Hello,
    I am using Nsbasic for ce. I have created a hyperterminal if any
    wants it for win ce (ppc) It works great. My Goal is to program the
    BSII with a Pocket Pc. I have done it in VB ,I mean loading a hex
    file to the BSII. The only stumbling block is not being able to set
    a comm break for the pocket pc.

    I have been trying for weeks to set a comm break with no luck. I
    have a viewsonic ppc. I called viewsonic and they faxed me the pin
    configuration for my ppc. The 9 pin serial cable for the ppc has the
    standard configuration. I used my multimeter and found the following:

    I ran a ground wire from pin 5 to neg of the multimeter and the pos
    of the multimeter to pin 4(dtr). when dtr was on, I got a -11.39 v.
    and when off, a 00.0 v.

    I tried all pins in the same way with a common ground and found that
    when dtr on is on pins 2(rx) and 3(tx) go to - 5.0 v when dtr is on
    to -5.0 v when dtr is off.

    Setting a break makes no difference.


    Does anyone have any suggestions?

    Thanks,
    Curtis
Sign In or Register to comment.