Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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 BANKSEL

Explanation / 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.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote