| |
IC Induction |
|
Develop & Tool |
|
Application Project |
|
Customer Service |
|
|
|
5 Compare
1. Set Timer0 as 8-bit timer compare operation on PB2. Output frequency is 10Khz and generate Timer0 compare Interrupt
|
¡¡lda¡¡¡¡¡¡#156¡¡¡¡¡¡¡¡¡¡¡¡
¡¡ sta¡¡¡¡¡¡P_TMR0_Preload¡¡¡¡¡¡;set Timer0 counter initial value
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR0_1_Ctrl1
¡¡ and #$F0
¡¡ ora¡¡¡¡¡¡#C_T0FCS_Div_8¡¡¡¡¡¡
¡¡ sta¡¡¡¡¡¡P_TMR0_1_Ctrl1¡¡¡¡¡¡;Set Timer0 clock source is Fsys/8
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR0_1_Ctrl0
¡¡ and #$F0
¡¡ ora¡¡¡¡¡¡#C_T08B_COMP¡¡¡¡¡¡
¡¡ sta¡¡¡¡¡¡P_TMR0_1_Ctrl0¡¡¡¡¡¡;Set Timer0 is 8-bit compare output
¡¡
¡¡ set¡¡¡¡¡¡P_INT_Flag1,CB_INT_T0OIF
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ;clear compare INT flag
¡¡ set¡¡¡¡¡¡P_INT_Ctrl1,CB_INT_T0OIE
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ;compare INT enable
¡¡ cli
|
2. Set Timer0 as 8-bit timer compare operation on PB2. Output frequency is 10Khz without compare Interrupt.
|
¡¡lda¡¡¡¡¡¡#156¡¡¡¡¡¡¡¡¡¡¡¡
¡¡ sta¡¡¡¡¡¡P_TMR0_Preload¡¡¡¡¡¡;set Timer0 counter initial value
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR0_1_Ctrl1
¡¡ and #$F0
¡¡ ora¡¡¡¡¡¡#C_T0FCS_Div_8¡¡¡¡¡¡
¡¡ sta¡¡¡¡¡¡P_TMR0_1_Ctrl1¡¡¡¡¡¡;Set Timer0 clock source is Fsys/8
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR0_1_Ctrl0
¡¡ and #$F0
¡¡ ora¡¡¡¡¡¡#C_T08B_COMP¡¡¡¡¡¡
sta¡¡¡¡¡¡P_TMR0_1_Ctrl0¡¡¡¡¡¡;Set Timer0 is 8-bit compare output
|
3. Set Timer1 as 8-bit timer compare operation on PB3. Output frequency is 10Khz and generate Timer1 compare Interrupt.
|
¡¡lda¡¡¡¡¡¡#156¡¡¡¡¡¡¡¡¡¡¡¡ ;
¡¡ sta¡¡¡¡¡¡P_TMR1_Preload¡¡¡¡¡¡; Set Timer1 low byte counter initial value
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR0_1_Ctrl1
¡¡ and¡¡¡¡¡¡#$0F
¡¡ ora¡¡¡¡¡¡#C_T1FCS_Div_8
¡¡ sta¡¡¡¡¡¡P_TMR0_1_Ctrl1¡¡¡¡¡¡; Set Timer1 clock source is Fsys/8
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR0_1_Ctrl0
¡¡ and¡¡¡¡¡¡#$0F
¡¡ ora¡¡¡¡¡¡#C_T18B_COMP
¡¡ sta¡¡¡¡¡¡P_TMR0_1_Ctrl0¡¡¡¡¡¡; Set Timer1 is 8-bit compare output
¡¡
¡¡ set¡¡¡¡¡¡P_INT_Flag1,CB_INT_T1OIF
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ;clear compare INT flag
¡¡ set¡¡¡¡¡¡P_INT_Ctrl1,CB_INT_T1OIE
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ;compare INT enable
¡¡ cli
|
4. Set Timer1 as 8-bit timer compare operation on PB3. Output frequency is 10Khz without compare Interrupt.
|
¡¡lda¡¡¡¡¡¡#156¡¡¡¡¡¡¡¡¡¡¡¡ ;
¡¡ sta¡¡¡¡¡¡P_TMR1_Preload¡¡¡¡¡¡; Set Timer1 low byte counter initial value
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR0_1_Ctrl1
¡¡ and¡¡¡¡¡¡#$0F
¡¡ ora¡¡¡¡¡¡#C_T1FCS_Div_8
¡¡ sta¡¡¡¡¡¡P_TMR0_1_Ctrl1¡¡¡¡¡¡; Set Timer1 clock source is Fsys/128
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR0_1_Ctrl0
¡¡ and¡¡¡¡¡¡#$0F
¡¡ ora¡¡¡¡¡¡#C_T18B_COMP
¡¡ sta¡¡¡¡¡¡P_TMR0_1_Ctrl0¡¡¡¡¡¡; Set Timer1 is 8-bit compare output
|
5. Set Timer1 as 16-bit timer compare operation on PB3. Output frequency is 100hz and generate Timer1 compare Interrupt.
|
¡¡lda¡¡¡¡¡¡#$D8¡¡¡¡¡¡¡¡¡¡¡¡ ;
¡¡ sta¡¡¡¡¡¡P_TMR1_PreloadHi¡¡¡¡¡¡; Set Timer1 high byte counter initial value
¡¡ lda¡¡¡¡¡¡#$F0¡¡¡¡¡¡¡¡¡¡¡¡ ;
¡¡ sta¡¡¡¡¡¡P_TMR1_Preload¡¡¡¡¡¡; Set Timer1 low byte counter initial value
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR0_1_Ctrl1
¡¡ and¡¡¡¡¡¡#$0F
¡¡ ora¡¡¡¡¡¡#C_T1FCS_Div_8
¡¡ sta¡¡¡¡¡¡P_TMR0_1_Ctrl1¡¡¡¡¡¡; Set Timer1 clock source is Fsys/8
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR0_1_Ctrl0
¡¡ and¡¡¡¡¡¡#$0F
¡¡ ora¡¡¡¡¡¡#C_T116B_COMP
¡¡ sta¡¡¡¡¡¡P_TMR0_1_Ctrl0¡¡¡¡¡¡; Set Timer1 is 16-bit compare output
¡¡
¡¡ set¡¡¡¡¡¡P_INT_Flag1,CB_INT_T1OIF
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ;clear compare INT flag
¡¡ set¡¡¡¡¡¡P_INT_Ctrl1,CB_INT_T1OIE
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ;compare INT enable
¡¡ cli
|
6. Set Timer1 as 16-bit timer compare operation on PB3. Output frequency is 10Khz without compare Interrupt.
|
¡¡lda¡¡¡¡¡¡#$D8¡¡¡¡¡¡¡¡¡¡¡¡ ;
¡¡ sta¡¡¡¡¡¡P_TMR1_PreloadHi¡¡¡¡¡¡; Set Timer1 high byte counter initial value
¡¡ lda¡¡¡¡¡¡#$F0¡¡¡¡¡¡¡¡¡¡¡¡ ;
¡¡ sta¡¡¡¡¡¡P_TMR1_Preload¡¡¡¡¡¡; Set Timer1 low byte counter initial value
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR0_1_Ctrl1
¡¡ and¡¡¡¡¡¡#$0F
¡¡ ora¡¡¡¡¡¡#C_T1FCS_Div_8
¡¡ sta¡¡¡¡¡¡P_TMR0_1_Ctrl1¡¡¡¡¡¡; Set Timer1 clock source is Fsys/8
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR0_1_Ctrl0
¡¡ and¡¡¡¡¡¡#$0F
¡¡ ora¡¡¡¡¡¡#C_T116B_COMP
¡¡ sta¡¡¡¡¡¡P_TMR0_1_Ctrl0¡¡¡¡¡¡; Set Timer1 is 16-bit compare output
¡¡
¡¡ set¡¡¡¡¡¡P_INT_Flag1,CB_INT_T1OIF
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ;clear compare INT flag
|
7. Set Timer2 as 8-bit timer compare operation on PD3. Output frequency is 10Khz and generate Timer2 compare Interrupt.
|
¡¡lda¡¡¡¡¡¡#156¡¡¡¡¡¡¡¡¡¡¡¡
¡¡ sta¡¡¡¡¡¡P_TMR2_Preload¡¡¡¡¡¡;set Timer2 counter initial value
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR2_3_Ctrl1
¡¡ and #$F0
¡¡ ora¡¡¡¡¡¡#C_T2FCS_Div_8¡¡¡¡¡¡
¡¡ sta¡¡¡¡¡¡P_TMR2_3_Ctrl1¡¡¡¡¡¡;Set Timer2 clock source is Fsys/8
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR2_3_Ctrl0
¡¡ and #$F0
¡¡ ora¡¡¡¡¡¡#C_T28B_COMP¡¡¡¡¡¡
¡¡ sta¡¡¡¡¡¡P_TMR2_3_Ctrl0¡¡¡¡¡¡;Set Timer2 is 8-bit compare output
¡¡
¡¡ set¡¡¡¡¡¡P_INT_Flag1,CB_INT_T2OIF
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ;clear compare INT flag
¡¡ set¡¡¡¡¡¡P_INT_Ctrl1,CB_INT_T2OIE
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ;compare INT enable
¡¡ cli
|
8. Set Timer2 as 8-bit timer compare operation on PD2. Output frequency is 10Khz without compare Interrupt.
|
¡¡lda¡¡¡¡¡¡#156¡¡¡¡¡¡¡¡¡¡¡¡
¡¡ sta¡¡¡¡¡¡P_TMR2_Preload¡¡¡¡¡¡;set Timer2 counter initial value
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR2_3_Ctrl1
¡¡ and #$F0
¡¡ ora¡¡¡¡¡¡#C_T2FCS_Div_8¡¡¡¡¡¡
¡¡ sta¡¡¡¡¡¡P_TMR2_3_Ctrl1¡¡¡¡¡¡;Set Timer2 clock source is Fsys/8
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR2_3_Ctrl0
¡¡ and #$F0
¡¡ ora¡¡¡¡¡¡#C_T28B_COMP¡¡¡¡¡¡
¡¡ sta¡¡¡¡¡¡P_TMR2_3_Ctrl0¡¡¡¡¡¡;Set Timer2 is 8-bit compare output
¡¡
¡¡ set¡¡¡¡¡¡P_INT_Flag1,CB_INT_T2OIF
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ;clear compare INT flag
|
9. Set Timer3 as 8-bit timer compare operation on PD2. Output frequency is 10Khz and generate Timer3 compare Interrupt.
|
¡¡lda¡¡¡¡¡¡#156¡¡¡¡¡¡¡¡¡¡¡¡ ;
¡¡ sta¡¡¡¡¡¡P_TMR3_Preload¡¡¡¡¡¡; Set Timer3 low byte counter initial value
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR2_3_Ctrl1
¡¡ and¡¡¡¡¡¡#$0F
¡¡ ora¡¡¡¡¡¡#C_T3FCS_Div_8
¡¡ sta¡¡¡¡¡¡P_TMR2_3_Ctrl1¡¡¡¡¡¡; Set Timer3 clock source is Fsys/8
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR2_3_Ctrl0
¡¡ and¡¡¡¡¡¡#$0F
¡¡ ora¡¡¡¡¡¡#C_T38B_COMP
¡¡ sta¡¡¡¡¡¡P_TMR2_3_Ctrl0¡¡¡¡¡¡; Set Timer3 is 8-bit compare output
¡¡
¡¡ set¡¡¡¡¡¡P_INT_Flag1,CB_INT_T3OIF
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ;clear compare INT flag
¡¡ set¡¡¡¡¡¡P_INT_Ctrl1,CB_INT_T3OIE
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ;compare INT enable
¡¡ cli
|
10. Set Timer3 as 8-bit timer compare operation on PD2. Output frequency is 10Khz without compare Interrupt.
|
¡¡lda¡¡¡¡¡¡#156¡¡¡¡¡¡¡¡¡¡¡¡ ;
¡¡ sta¡¡¡¡¡¡P_TMR3_Preload¡¡¡¡¡¡; Set Timer3 low byte counter initial value
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR2_3_Ctrl1
¡¡ and¡¡¡¡¡¡#$0F
¡¡ ora¡¡¡¡¡¡#C_T3FCS_Div_8
¡¡ sta¡¡¡¡¡¡P_TMR2_3_Ctrl1¡¡¡¡¡¡; Set Timer3 clock source is Fsys/8
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR2_3_Ctrl0
¡¡ and¡¡¡¡¡¡#$0F
¡¡ ora¡¡¡¡¡¡#C_T38B_COMP
¡¡ sta¡¡¡¡¡¡P_TMR2_3_Ctrl0¡¡¡¡¡¡; Set Timer3 is 8-bit compare output
¡¡
¡¡ set¡¡¡¡¡¡P_INT_Flag1,CB_INT_T3OIF
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ;clear compare INT flag
|
11. et Timer3 as 16-bit timer compare operation on PD2. Output frequency is 100hz and generate Timer3 compare Interrupt.
|
¡¡lda¡¡¡¡¡¡#$D8¡¡¡¡¡¡¡¡¡¡¡¡ ;
¡¡ sta¡¡¡¡¡¡P_TMR3_PreloadHi¡¡¡¡¡¡; Set Timer3 high byte counter initial value
¡¡ lda¡¡¡¡¡¡#$F0¡¡¡¡¡¡¡¡¡¡¡¡ ;
¡¡ sta¡¡¡¡¡¡P_TMR3_Preload¡¡¡¡¡¡; Set Timer3 low byte counter initial value
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR2_3_Ctrl1
¡¡ and¡¡¡¡¡¡#$0F
¡¡ ora¡¡¡¡¡¡#C_T3FCS_Div_8
¡¡ sta¡¡¡¡¡¡P_TMR2_3_Ctrl1¡¡¡¡¡¡; Set Timer3 clock source is Fsys/8
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR2_3_Ctrl0
¡¡ and¡¡¡¡¡¡#$0F
¡¡ ora¡¡¡¡¡¡#C_T316B_COMP
¡¡ sta¡¡¡¡¡¡P_TMR2_3_Ctrl0¡¡¡¡¡¡; Set Timer3 is 16-bit compare output
¡¡
¡¡ set¡¡¡¡¡¡P_INT_Flag1,CB_INT_T3OIF
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ;clear compare INT flag
¡¡ set¡¡¡¡¡¡P_INT_Ctrl1,CB_INT_T3OIE
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ;compare INT enable
¡¡ cli
|
12. Set Timer3 as 16-bit timer compare operation on PD2. Output frequency is 100hz without compare Interrupt.
|
¡¡lda¡¡¡¡¡¡#$D8¡¡¡¡¡¡¡¡¡¡¡¡ ;
¡¡ sta¡¡¡¡¡¡P_TMR3_PreloadHi¡¡¡¡¡¡; Set Timer3 high byte counter initial value
¡¡ lda¡¡¡¡¡¡#$F0¡¡¡¡¡¡¡¡¡¡¡¡ ;
¡¡ sta¡¡¡¡¡¡P_TMR3_Preload¡¡¡¡¡¡; Set Timer3 low byte counter initial value
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR2_3_Ctrl1
¡¡ and¡¡¡¡¡¡#$0F
¡¡ ora¡¡¡¡¡¡#C_T3FCS_Div_8
¡¡ sta¡¡¡¡¡¡P_TMR2_3_Ctrl1¡¡¡¡¡¡; Set Timer3 clock source is Fsys/8
¡¡
¡¡ lda¡¡¡¡¡¡P_TMR2_3_Ctrl0
¡¡ and¡¡¡¡¡¡#$0F
¡¡ ora¡¡¡¡¡¡#C_T316B_COMP
¡¡ sta¡¡¡¡¡¡P_TMR2_3_Ctrl0¡¡¡¡¡¡; Set Timer3 is 16-bit compare output
¡¡
¡¡ set¡¡¡¡¡¡P_INT_Flag1,CB_INT_T3OIF
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ;clear compare INT flag
|
|
|