CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

bring rs232 out of the main loop

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Blob



Joined: 02 Jan 2006
Posts: 75
Location: Neeroeteren, Limburg, Belgium

View user's profile Send private message

bring rs232 out of the main loop
PostPosted: Wed Feb 09, 2011 3:09 am     Reply with quote

Hello,

I have a rotating disk with some teeth (18) on it.
Depending on the position of the wheel I will have to do some actions.

I am polling on the EXTint flag bit to "see" the teeth on the disk.
The loop will increase from 0 till 17 correspoding to each tooth.

In one position I will have to send some data via RS232.
A number between 0-310 and two numbers between 0 - 256.

At low rpm this works perfectly.
But at high rpm the time between 2 interrupts is to short to send the data.

I am now using the printf function to send the information.

Is there a way to bring the actual sending out of the loop?
At the moment I lose an interrupt while waiting for the function to end.
Is there a kind of hardware register that I can fill and that will do the sending outside my main loop?

If it is outside the main loop, it has plenty of time to send, since I have to send only once each rotation.

I use a 18f2620.
Code:

#use rs232 (baud=115200, xmit=PIN_C6, rcv=PIN_C7)

printf("%Lx-%x-%x",speed,int_something,int_something_else );


Thanks in advance

Blob
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Wed Feb 09, 2011 3:12 am     Reply with quote

Yes.
For sending, look at STISR.C
Takes only a few uSec to put the data into a buffer.

Best Wishes
Blob



Joined: 02 Jan 2006
Posts: 75
Location: Neeroeteren, Limburg, Belgium

View user's profile Send private message

PostPosted: Wed Feb 09, 2011 5:21 am     Reply with quote

Great, this solved the matter

Quote:
"More matter with less art"
Wink

Blob
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group