BasicMicro - Forums

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

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: SERIN issue. HELP!!
PostPosted: Mon Mar 19, 2007 10:00 pm 
Hi,

I have a weird problem. I can use the serin command to read in a number like "123" or "435." But if I do a number with a zero in it like "012" or "102" it doesn't show up right (instead it shows up something like 122). However, if the zero is the last digit, it works :( I am using the Basic Atom 28 with the lynxmotion miniAtom bot board. Here is the serin comman I am using:

serin [dec1 code1, dec1 code2, dec1 code3]

I then send out the variables to some seven segment displays. Any ideas?? Thanks!

Josh


Top
  
 
 Post subject: Re: SERIN issue. HELP!!
PostPosted: Tue Mar 20, 2007 10:00 pm 
Offline
Citizen

Joined: Sat Mar 08, 2003 11:00 am
Posts: 40
Well, your SERIN command is missing the pin and the baud-mode identifier.

I'm guessing the 'zero' character is causing you to lose 'sync' in your RS-232 data stream. And that could happen if either your baud mode number was wrong, or if your clock frequency was off.


Top
 Profile  
 
 Post subject: Re: SERIN issue. HELP!!
PostPosted: Tue Mar 20, 2007 10:00 pm 
Josh didn't include the whole serin command we're using for brevity, I guess. This is what we're actually using:

serin 3, N2400, [dec1 code1, dec1 code2, dec1 code3]

The transmitter is set to 2400 8N1 transmission (8 data bits, no parity, 1 stop bit). Flow control is turned off.


Top
  
 
 Post subject: Re: SERIN issue. HELP!!
PostPosted: Tue Mar 20, 2007 10:00 pm 
One other thing I should mention is that we're using a USB-to-serial cable to send the transmission, and we're connecting the transmitter hardware directly to pins 5 (ground) and 3 (transmit) on the DB-9 connector. Transmission is via IR light pulses. We're basically sending out a string of ASCII letters and numbers, and we want to discard non-numeric bytes. The dec1 modifier accomplished this for 80% of the possible 3-digit numbers, but fails for the other 20% (which have a zero in the first or middle position). I'd probably not be as confused if it failed for a zero in the third position, but it gets that case without any problem.


Top
  
 
 Post subject: Re: SERIN issue. HELP!!
PostPosted: Tue Mar 20, 2007 10:00 pm 
Issue solved.


Top
  
 
 Post subject: Re: SERIN issue. HELP!!
PostPosted: Wed Mar 21, 2007 10:00 pm 
Offline
Citizen

Joined: Sat Mar 08, 2003 11:00 am
Posts: 40
Neat. What was the problem?


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 2 guests


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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO