Hi:
After a long while being away, I finally have the time to continue learning about programming pics, I have started this project and again find myself stuck
I am trying to make a distance meter using tmr1 of a PIC16f877A using an incremental encoder which it has a circumference wheel of 200mm and 200 pulses/rev. as external clock source, the purpose of this is to measure pieces of tape of the same length, using a word size settable variable to load the tmr1 and on overflow create an interrupt.
So this is what I find out so far: tmr1 is composed of two 8 bit registers TMR1H and TMR1L and to load a value let´s say 10,000 (ten meters), I´ll have to do 65535-10000= 55535, which is the value I have to load tmr1 with, to cause an interrupt on overflow, but what is really confusing me, is that as I understand, I have to write to TMR1H and TMR1L separately breaking the value in two, and I dont know how to approach this on the program.
May be I am getting it wrong, so I´ll greatly appreciate any guidance on this matter
After a long while being away, I finally have the time to continue learning about programming pics, I have started this project and again find myself stuck
I am trying to make a distance meter using tmr1 of a PIC16f877A using an incremental encoder which it has a circumference wheel of 200mm and 200 pulses/rev. as external clock source, the purpose of this is to measure pieces of tape of the same length, using a word size settable variable to load the tmr1 and on overflow create an interrupt.
So this is what I find out so far: tmr1 is composed of two 8 bit registers TMR1H and TMR1L and to load a value let´s say 10,000 (ten meters), I´ll have to do 65535-10000= 55535, which is the value I have to load tmr1 with, to cause an interrupt on overflow, but what is really confusing me, is that as I understand, I have to write to TMR1H and TMR1L separately breaking the value in two, and I dont know how to approach this on the program.
May be I am getting it wrong, so I´ll greatly appreciate any guidance on this matter