Summary of PIC micro Timer Code
This article explains configuring PIC Timer 1 (16-bit) in PICBasic. It details control bits for T1CON to start/stop the timer and describes reading/writing the high (TMR1H) and low (TMR1L) bytes. Crucially, it emphasizes the specific order required for data access: read Low then High, but write High then Low to ensure accurate operation.
Parts used in the PIC Timer 1 Project:
- PIC microcontroller
- PICBasic programming language
- T1CON register
- TMR1H register
- TMR1L register
- MyTime variable
Here’s the minimal code to make timer 1 (a 16 bit timer) work using PICBasic. General descriptions of PIC timer variables used to control the timer: (you should be able to use these no matter what programming language you use): T1CON.0 is the first bit of the timer configuration byte, this bit is used to start and stop the timer. 
- How do I start Timer 1?
Set T1CON.0 to 1. - How do I stop Timer 1?
Set T1CON.0 to 0. - What is the correct order to read the timer values?
You must read the LOW byte first, then the HIGH byte. - What is the correct order to write the timer values?
You must write the HIGH byte first, then the LOW byte. - How do you reset the timer value's high byte?
Assign 0 to TMR1H. - How do you reset the timer value's low byte?
Assign 0 to TMR1L. - What type should the MyTime variable be declared as?
It must be declared as a word because it holds a 16-bit value. - Why is the order of reading and writing important?
The order is critical due to complications in how the timer works internally.