BasicMicro - Forums

www.basicmicro.com
It is currently Sun May 20, 2012 11:51 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Visual basic to atom and baud rate
PostPosted: Sat Jan 17, 2009 5:04 pm 
Offline
Master

Joined: Sun Oct 05, 2008 9:40 am
Posts: 111
I recently interfaced the Atom to a vb program that would send a pin number and the state of the LED. I got everything to work but can only get a reliable connection using 2400bps.

I hooked up a BS2 and was able to get it to work @4800bps.

Is there anything that can be done to get a faster baud rate with the Atom?


Top
 Profile  
 
 Post subject: Re: Visual basic to atom and baud rate
PostPosted: Sun Jan 18, 2009 6:48 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Hi, Mike! :D
I have successfully achieved 115200 Baud using the hardware USART, 57600 doing bitbang, on both Atoms and Atom Pros, using 20MHz clocks. What kind of clock rate do you have on these boards? Slow clocks = slow baud rates. Are they commercial products for both (modules) or is there some roll-your-own involved?

Later!
kenjj

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Visual basic to atom and baud rate
PostPosted: Mon Jan 19, 2009 8:18 pm 
Offline
Master

Joined: Sun Oct 05, 2008 9:40 am
Posts: 111
What is the differance between using S_in and HSERIN?

The manual states:

Quote:
Each Atom module also has two special serial I/O pins used for
programming and serial data communications. They can be referred
to in your program as:
S_IN and S_OUT


This is what I was using. After reading the manual I think I should be using the HSERIN or HSERSTAT.


Top
 Profile  
 
 Post subject: Re: Visual basic to atom and baud rate
PostPosted: Mon Jan 19, 2009 9:21 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Hi.
S_IN/S_OUT is bitbang, i.e., software communications. Just about any I/O port pin can be used. The latest Atom rev, RevB, does both to do programming with a single pin. This method uses a diode to seperate the input/output levels of the MAX232 RS232 IC. This is called Half Duplex, as only one device, the Atom or PC, can be talking, the other must listen.
So, after Reset, the Atom listens for the PC to start talking to it. If nothing happens within a short time out period, the Atom checks to see if a program is already loaded. If yes, it runs it. If not, it just sits there and spins its wheels until a Reset starts the process all over.
If the PC does start a program session, the Atom responds with a short message announcing its pin count, 28 or 40. The PC uses this info to determine if the program it has will fit. If yes, it streams the code over to the Atom. At program end, there is another short exchange, the PC puts the Atom through a Reset cycle and wanders away. The Atom then starts the timeout over again, the PC is quiet, the Atom finds the program, and starts it running.

HSERxxx is comms using the PIC's internal USART. This works much more reliably, and can go much faster. This is commonly employed in must-work, lotsa-data transmissions. Use the data sheet to find which pins are TxD and RxD. These are usually RC6 and RC7.

For me, I have achieved 57,600 baud reliably using S_IN, S_OUT bitbang; I have done up to 115,200 using HSERxxx stuff. All this was done with 20MHz clocks.

Do you have answers to my questions above?
kenjj

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Visual basic to atom and baud rate
PostPosted: Tue Jan 20, 2009 4:12 pm 
Offline
Master

Joined: Sun Oct 05, 2008 9:40 am
Posts: 111
Yes they are commericial units, both have a 20MHz clock.


Top
 Profile  
 
 Post subject: Re: Visual basic to atom and baud rate
PostPosted: Tue Jan 20, 2009 8:48 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Two possibilities come to mind:
1. Your PC port may have problems. Use a loopback tester and find what the highest speed is it will support. Making a tester is easy: connect pins two to three of a female DB9 connector together and plug it in. Start a HyperTerminal session with local echo and starting typing. Your results should show two of each key you typed in. Try 0 to 9, a to z, etc, a known pattern.

2. You're using a USB to serial adapter and need to optimize the settings. If this is so, and you don't know how to do this, search the forums here, this has been explained recently.

Later!
kenjj

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Visual basic to atom and baud rate
PostPosted: Wed Jan 21, 2009 8:17 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
Third possibility, more likely on an Atom Pro. If you are using interrupt processing in your program, such as handling timer overflows, or WKP0 or ... The processing of the interrupts can cause the timings of the bit bang functions to be off enough to cause problems. I found in these programs I had to either disable the interrupts when I was doing serouts or the like or usually they worked reliably enough at 2400baud.

Kurt


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO