|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Accelerometer Timer Question
I am looking over the accelerometer code tonight, this way when i go in to program tomorrow, I'll be able to get started right away. I was looking over Kevin Watson's accelerometer code and I think I am understanding it, but I had a few questions.
The void Timer_2_Int_Handler is what contains all of the code to actually calculate the current acceleration of the robot, and update that acceleration. (I hope I am right here, otherwise i think im gonna be in trouble ) The void information says that it is called from user_routines_fast.c/InterruptHandlerLow(). This is where I am confused. Since we initialize the accelerometer with Initialize_Timer_2 which says it starts the timer, do I have to call this void (Timer_2_Int_Handler) in my user_routines.c or will it be automatically called. The reason why I am curious is b/c in the _fast.c code it shows the Timer_2_Int_Handler, but the _routines.c code is able to use the Get_Acceleration function and that stops the timer and returns the current acceleration, but how can Get_Acceleration work if i don't call Timer_2_Int_Handler in _routines.c.I hope i was clear in my confusion, sorry if i wasn't. So in short, do i need to call Timer_2_int_Hanlder in my user_routines.c code, or does the timer do it, and therefore all i need to do is call the get_acceleration? Thanks for help with that question, and sorry if i made it more confusing then it was. My other question deals with what analog port the code specifies for the accelerometer. I think it is the first analog port? Also how would I change the accelerometer.c code to change the port? Thanks (in advance) for helping us out. |
|
#2
|
||||
|
||||
|
Re: Accelerometer Timer Question
Quote:
|
|
#3
|
|||
|
|||
|
Re: Accelerometer Timer Question
Ok, thanks, that is what I thought, i just wasn't sure, b/c it was called in _fast.c and that didn't make any sense to me, especially since it is a timer.
|
|
#4
|
||||||
|
||||||
|
Re: Accelerometer Timer Question
Just to clarify, Timer_2_Int_Handler is called from InterruptHandlerLow which is called from InterruptVectorLow which is automatic.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Example accelerometer code released. | Kevin Watson | Programming | 0 | 20-01-2005 03:45 |
| Question of the Week!!! (7/19/04) | Andy Grady | General Forum | 23 | 23-07-2004 13:21 |
| Question of the Week!!! (6/14/04) | Andy Grady | General Forum | 23 | 01-07-2004 15:54 |
| Timer interrupt hic-cupping - HELP | roknjohn | Programming | 9 | 15-03-2004 17:56 |
| Interrupt timer, executing code asap? | SeanCassidy | Programming | 10 | 07-03-2004 01:47 |