SPARK Project #3, Post #3

Make+Spark_Project3.jpg

SerialTermVB.jpg

In my previous post, I described how I was able to program an iCop eBox to transmit date using an XBee wireless link. The program was written in Visual C++ and executed serial port commands to send data to a host computer. I had previously set up the XBees to communicate at 115,200 baud, but the Visual C++ serial port configuration defaults to 9600 for the baud rate. I was able to find sample code for It and it was relatively straightforward to add code to my program whichchanged the baud rate to the desired value.

Then things got a little strange. I noticed that every time I ran my program, it would hang after the serial transmission. I also found that the program would crash if I tried to send more than 16 characters. There's a long list of possible causes for such crashes, and I started to debug them one by one. The important part of this story is the outcome. Honestly, debugging can be unpleasant. I like a good challenge and have always enjoyed solving puzzles, but that's not how I wanted to be spending my time with these SPARK projects. So back to the outcome of the story. After taking many small steps backwards in the debugging process, I finally managed to make a huge leap forward, out of programming darkness. I now have a Visual Basic program running on my iCop eBox, and it's sending and receiving data from another computer using XBee transceivers.

Why is this so great? That's a fair question. Read on at the SPARK site for the answer!


Recent Entries

Comments

Oldest comments listed first.

Posted by: EEGeek on December 1, 2009 at 8:18 PM

so, why VB?

I think your hardships started with Visual Basic, it's a terd, especially when trying to work with peripherals. Still, a cool project so far. I like embedded windows for several of the same reasons you have endeavored down this path. Keep up the articles!


Posted by: Maha on December 2, 2009 at 6:32 AM

Xbee and flow-control

My guess is the program was hanging because the serial buffer was overflowing. You probably need flowcontrol turned on in both the host and xbee. Xbees have a data-out buffer of 100 bytes i think.. so it might be a baud rate mis-match too.

VB is great for mashing together a small gui app. But i'd urge you (and anyone!) to avoid it like the plague to prevent you from becoming too invested and locked in. When you try to develop your app into something larger, you'll quickly run into limitations. Moving from VB to C# would probably be the easiest migration path for you. Plus that opens up linux for you with Mono.. though System.IO.Ports in mono is... horrid atm.


Posted by: Kipp Bradford on December 2, 2009 at 10:46 AM

I had been thinking it was a buffer problem as well. That would have been easier to troubleshoot. It was actually changes I made to the board support package and registry settings that caused the problem. In the process of trying to disable serial debugging on COM1 and also enable COM2, I must have done something bad to the BSP. When I swapped interrupts for COM1 and COM2, I was able to get COM1 sort of working. When I also did a clean install of the BSP, I got a fully functioning COM1.

I agree with your thoughts on VB. I wanted to start with tested code and get it up and running fast. I was working from Samuel Phung's CE book at http://www.embeddedpc.net/, and the sample code was in VB.


Posted by: extreme on December 2, 2009 at 11:26 AM

api mode

If you want to get even more extreme, take a look at API mode. It's a little more complicated but also more powerful.


Leave a comment


Subscribe to MAKE!Subscribe to MAKE Magazine!

Subscribe today, save 42% and get web access to MAKE free. MAKE Digital Edition is available only to subscribers.

$34.95 / 1 year
(4 Quarterly Issues)

Subscribe now


Void your warranty, violate a user agreement, fry a circuit, blow a fuse, poke an eye out. Make: The risk-takers, the doers, the makers of things... Welcome to Make: Online!


CRAFT Maker Shed Maker Faire MAKE television




Check out more videos from MAKE.

MZ_Jameco-RobotBuild_RR.gif
MZ_DIYMovieMaking-RR.gif
Maker SHED

Connect with MAKE

Be a MAKE fan on Facebook MAKE on Facebook
Visit our Facebook page and become a fan of MAKE!
MAKE on Twitter MAKE on Twitter
Follow our MAKE tweets!
MAKE Flickr Pool MAKE on Flickr
Join our MAKE Flickr Pool!
    make_tips on Twitter



    MAKE Archives

    Make: Money

    Make: Science Room
    Subscribe to MAKE Magazine!

    Make: Online editors and authors!

    Gareth BranwynGareth Branwyn
    Editor-in-Chief


    Phillip TorronePhillip Torrone
    Senior Editor
    | Web | Twitter


    Becky SternBecky Stern
    Associate Editor
    | AIM | Twitter


    Marc de VinckMarc de Vinck
    Contributing Writer
    | AIM | Twitter


    John ParkJohn Park
    Contributing Writer
    | Twitter


    Sean RaganSean Ragan
    Contributing Writer
    | Twitter


    Matt MetsMatt Mets
    Contributing Writer
    | AIM | Twitter


    Dale DoughertyDale Dougherty
    Editor & Publisher
    | Twitter


    Shawn ConnallyShawn Connally
    Managing Editor
    | Twitter


    Goli MohammadiGoli Mohammadi
    Associate Managing Editor

    Kip KayKip Kay
    Weekend Projects
    | AIM | Twitter


    Collin CunninghamCollin Cunningham
    Contributing Writer
    | AIM | Twitter

    Adam FlahertyAdam Flaherty
    Contributing Writer
    | AIM | Twitter


    John BaichtalJohn Baichtal
    Contributing Writer
    | AIM | Twitter



    More contributors: Mark Frauenfelder (Editor-in-Chief, MAKE magazine), Kipp Bradford (Technical Consultant/Writer), Chris Connors (Education), Diana Eng (Guest Author), Peter Horvath (Intern), Brian Jepson (O'Reilly Media), Robert Bruce Thompson (Science Room)

    Suggest a Site!

    Advertise here with FM.

    Why advertise on MAKE?
    Read what folks are saying about us!

    Click here to advertise on MAKE!



    Current Podcast

    itunesdl.gif Weekend Project: Pinhole Panoramic Camera A sturdy, panoramic design pinhole camera that uses 120 film. Thanks go to Ross Orr for the original article in MAKE Volume 09. To download The Pinhole Panoramic Camera video video click here and subscribe in iTunes. Check out... More...

    Get the Make: Online sent via email
    Enter your email to receive Make: Online each day:



    Sign up for the Make: Newsletter

    Our Make: Newsletter covers news from maker Media, has original columns, Shed deals, and more! You can also read the archives of past issues.


     



    MAKE Fascination video series brought to you by Dow

    Make: Education
    MAKE: en EspaƱol MAKE: Japan
    Important please read


    Subscribe to MAKE Magazine!

    Recent Posts from the Craft: Blog