In: Computer Science
In PIC32-Embedded system. Give the value to be loaded in T1CON if the timer is used as counter with prescaler 1:64, synchronous, external clock source.
In order to use the Timer of PIC-32 Embedded system as Counter with prescaler 1:64 and synchronous external clock source.
You need to set the following bits of T1CON Register as Follows:
bit 15 as "0" - In order to disable the timer and enable the counter
bit(5-4) as "10" inorder to set the counter with software prescaler 1:64
bit2 as "1" in order to enable the external clock synchronization.
The remaining bits of the T1CON register as set as per your requirements and the bitwise explanations are given below.
The Bit wise explanation of T1CON Register is as follows:
bit 15 ON: Timer On bit
1 = Timer is enabled
0 = Timer is disabled
bit 14 FRZ: Freeze in Debug Exception Mode bit
1 = Freeze operation when CPU is in Debug Exception mode
0 = Continue operation when CPU is in Debug Exception mode
bit 13 SIDL: Stop in Idle Mode bit
1 = Discontinue operation when device enters Idle mode
0 = Continue operation in Idle mode
bit 12 TMWDIS: Asynchronous Timer Write Disable bit
In Asynchronous Timer mode:
1 = Writes to asynchronous TMR1 are ignored until pending write operation completes
0 = Back-to-back writes are enabled (legacy asynchronous timer functionality)
In Synchronous Timer mode:
This bit has no effect.
bit 11 TMWIP: Asynchronous Timer Write in Progress bit
In Asynchronous Timer mode:
1 = Asynchronous write to TMR1 register in progress
0 = Asynchronous write to TMR1 register complete
In Synchronous Timer mode:
This bit is read as ‘0’.
bit 10-8 Unimplemented: Read as ‘0’
bit 7 TGATE: Gated Time Accumulation Enable bit
When TCS = 1:
This bit is ignored and read ‘0’.
When TCS = 0:
1 = Gated time accumulation is enabled
0 = Gated time accumulation is disabled
bit 6 Unimplemented: Read as ‘0’
bit 5-4 TCKPS[1:0]: Timer Input Clock prescaler Select bits
11 = 1:256 prescale value
10 = 1:64 prescale value
01 = 1:8 prescale value
00 = 1:1 prescale value
bit 3 Unimplemented: Read as ‘0’
bit 2 TSYNC: Timer External Clock Input Synchronization Selection bit
When TCS = 1:
1 = External clock input is synchronized
0 = External clock input is not synchronized
When TCS = 0:
This bit is ignored and read ‘0’.
bit 1 TCS: Timer Clock Source Select bit
1 = External clock from T1CKI pin
0 = Internal peripheral clock
bit 0 Unimplemented: Read as ‘0’