PDA

View Full Version : 16F690 TIMER0 and TIMER1



nickdaprick
- 18th April 2007, 07:09
I'm really new with this stuff so bare with me please. I need to read the RPM of a spining shaft using two timers. Timer0 will generate an interrupt on the overflow that will read timer 1 which will be clocked every rotation of the shaft. If I know how many times the shaft spun in the time it tkes for timer 0 to overflow then I can manipulate the data into RPM. I undestand the concept of the timers however I've never used them before and I'm not clear on the sintax of the code. Can anyone give me some suggestions as how to set up the timers to do this in the proper sintax. Never mind the data manipulation.

example code:

#byte TMR0 = 0x01
#byte OPTION_REG = 0x81

OPTION_REG = 0xC7;

I thought this would be the right sintax but I;m getting an error on the last line when I compile. What am I doing wrong. Any help would be appreciated.

BobK
- 18th April 2007, 13:25
Hi Nick,

What program are you using to generate your program? It appears you are using assembly. This is not the correct forum for assembly language programming. You should go to www.electro-tech-online.com for help.

If you are using PIC Basic or PIC Basic Pro then there is alot of information on our forums here that should answer your questions. Use the SEARCH feature or try Google.

BobK.

mister_e
- 18th April 2007, 15:49
i'll bet on C Language...