![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Blob
Joined: 02 Jan 2006 Posts: 75 Location: Neeroeteren, Limburg, Belgium
|
bring rs232 out of the main loop |
Posted: Wed Feb 09, 2011 3:09 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19372
|
|
Posted: Wed Feb 09, 2011 3:12 am |
|
|
Yes.
For sending, look at STISR.C
Takes only a few uSec to put the data into a buffer.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
Blob
Joined: 02 Jan 2006 Posts: 75 Location: Neeroeteren, Limburg, Belgium
|
|
Posted: Wed Feb 09, 2011 5:21 am |
|
|
Great, this solved the matter
Quote: | "More matter with less art" |
Blob |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|