Can you display your code so that I will have an idea on what's going on.
Can you display your code so that I will have an idea on what's going on.
Hi, Wassup
As Timer 0 is a 8 bits timer ... and we suppose clock is 4Mhz ( ... )
I will be necessary to have a counting loop in the interrupt stub , because interrupts will occur every 256 µs as a maximum
The other solution is to use Timer 1 that has a 16 bits counting range ... and won't need any calculations.
Have a SEARCH for "PicMultiCalc" from Mr E. it's a nice tool to help for Timer designs ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Last edited by sayzer; - 8th February 2008 at 19:11.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Wow, thankyou for all of your replies.
I forgot to mention that my crystal is 20MHz and both CCP1 and CCP2 are being used for HPWM.
I found PicMultiCalc and it is saying that I can use the 8-bit timer (Timer0) for an error of 0.371%. It says that if I use the 16-bit timer I will get an error of 0%. Now I have decided that I will use the 16-bit timer only if it won't interupt my HPWM. The HPWM is driving two motors. I am not at all familure with these timers and I don't know how to set them up or know when to start my 10ms loop so that the gyro can be read at the start of every loop at 100Hz (10ms intervals). Integration calculations and other processes are carried out after the gyro has been read. If all calculations and procesess have been done before the next loop should start, the processor should wait until the timer flag or whatever signals the loop to start over.
FYI I am making a balancing robot.
Said it before, I'll say it again...
Start simple...
Get the LED blinking at a known rate under an interrupt drive (or just get an LED blinking), get the HPWM working on all channels in all situations, get the interfaces working, THEN tie them all together.
Otherwise you'll be shooting yourself in the foot wondering why...no more...just wondering WHY!!!!
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks