psquared
11-02-2005, 22:58
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 :ahh: ) 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.
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 :ahh: ) 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.