Using Assembly Language You need to configure the control register for the Timer
ID: 2085834 • Letter: U
Question
Using Assembly Language
You need to configure the control register for the Timer 1 module. Using the figure below make the following settings: Bit 7-6 TMR1CS = 01 (2 bit value for timer 1 clock source = Fosc) Bit 5-4 T1CKPS = 10 (2 bit value that picks the clock pre-scalar for timer 1 = (1: 4) Bit 3 T1OSCEN = 0 (1 bit value that enables/disables the external oscillator circuit = 0) Bit 2 T1SYNC = 0 (Syncs the external oscillator = 0) Bit 1 Not used leave as 0 Bit 0 TMR1ON = 1 (1 bit value that turns on and off timer 1) Write the code to load the T1CON register with the value as indicated above. First figure out the value to write to the register and then you can use an "MOVLW" instruction and write the load value as a HEX value or you can use shifts and ORs to create the right bit values or you can use a clear instruction and then several bit set instructions. Don't forget BANKSELExplanation / Answer
Answer:- The assembly code to configure timer1 register T1CON is wriyyen below-
We can see we are going to write 0110_0001 i.e 0x61 in T1CON register.
-----------------------------------------------------------------
MOVLW 0x61 ; Load literal value 0x61 into W regoster
BANKSEL T1CON ; Select the memory bank in which T1CON register is present
MOVWF T1CON ; Copy value in W register to T1CON register
----------------------------------------------------------------
Note:- This is the easiest way to configure. We can use other way too like using BSF or BCF instruction for each bit.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.