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 support@ccsinfo.com

converting RPM to address

 
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

converting RPM to address
PostPosted: Thu May 22, 2008 6:02 am     Reply with quote

hello everyone,

my project is growing bigger and bigger, thanks for all the help so far.


As you may know, I am building a project that reacts on a rotating disc.
I have to measure the RPM of this disc. According to this measurement, I have pass some values to the output.

The user can define some values according to RPM in my own made pc software. then when the pic module is connected to the rotating disc. it measures the RPM and gives out the values that the user defined at the desired rpm. (steps of 50 rpm)

The values are stored in my pic memory.

addresses are linear:

1000
1001
1002
1003
1004
...

I use
Code:
timer_1 div_by_8
on pic 18f2520

the rotating disc has a tooth so i use this to capture an interrupt and i use
Code:
get_timer1()
to calculate the address (rpm)

I have a calculation ready

Code:

tNow = get_timer1();
tNow = tNow / 16;
adr = (int16)(46875 / tNow)


this makes my address going up and down by 1 if rpm goes up or down by 50.


Now i want to make this calculation as short as possible, as i need to do a lot of other things each rotation.
Since i have 2 divisions in my code (in fact only 1, /16 is just shifting the bits) but a division takes a lot of time on a pic and i wish to avoid this.

How many clock cycles will the get_timer3 take? i use this timer too...

thanks in advance,

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