TekBots

This bulletin board will help connect the developers and supporters of TekBots with users from OSU and other schools.
It is currently Wed Jul 23, 2014 7:37 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Dealing with SendStringUART()
PostPosted: Fri Apr 13, 2012 12:56 pm 
Offline

Joined: Fri Jun 24, 2011 7:45 pm
Posts: 6
Email I got today

<email>
After talking to you in your office hours today and removing the blocking from the SendByte/String function and moving it to the main function, I noticed that I only get the first character in my string to display and then I get hex output. It seems that in the loop function for sending the string, there needs to be a delay before executing the next iteration.

It seems that there are 2 possible ways to do this, each being placeable in either the string or byte function.


2 ways:

{*} block in the send byte function that makes sure transmission is complete,
[*] add a delay to the function.


It seems that the blocking for transmission completion would be cleaner and wouldn't cause unecessary delay based on selecting a wring time delay.

What would you recommend?

blocking: while (!(UCSR1A & (1 << UDRIE1)));
delay: _delay_ms(1);


<reply>
The desired function of these functions is the the SendByteUART is very fast with no blocking. This means it either returns a 1 or copies a value into UDR1 and returns a 0. To use this in the SendStringUART() you would start by sending the first byte. If this returns a success (0) then you could jump into a loop that sends each remaining character in the string is succession. HOWEVER, you need to watch the return value on these subsequent SendByteUART() calls. If it returns a 1, keeping trying to send that character until it works then move to the next character.

-Don


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

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

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