Beruflich Dokumente
Kultur Dokumente
AN594
counter mode.
Note: Capture and Compare modes may not
operate if Timer1 is operated in the CCPRxH (Slave)
asynchronous counter mode.
Comparator R Q
TABLE 1: CCP MODE - TIMER RESOURCE
RCy/CCPx
CCP MODE Timer Resource TMR2 (Note 1)
S
Capture Timer1
TRISC<y>
Compare Timer1 Comparator
Clear Timer,
PWM Timer2 CCPx pin and
latch D.C.
PR2
Duty Cycle
PWM frequency = 1/period
TMR2 = PR2 TMR2 = PR2
TMR2 = CCPR1H
CCPx Pin
1 1 0 0 1 0 1 0 IDLE TIME
CCP1
PIC16CXXX
APPENDIX A: PWM_1.ASM
MPASM 01.40 Released PWM_1.ASM 1-16-1997 17:35:52 PAGE 1
Errors : 0
Warnings : 0 reported, 0 suppressed
Messages : 0 reported, 17 suppressed
APPENDIX B: PWM.H
nolist
;******************************************************************************
;
; This is the custom Header File for the real time clock application note
; PROGRAM:CLOCK.H
; Revision:7-13-94
;
;******************************************************************************
; This is used for the ASSEMBLER to recalculate certain frequency
; dependant variables. The value of Dev_Freq must be changed to
; reflect the frequency that the device actually operates at.
;
Dev_Freq EQU D’10000000’; Device Frequency is 4 MHz
PULSE_TIME EQU (( Dev_Freq / D’4000’ ) * D’188’ / D’10000’ )
;
APPENDIX C: COMP_1.LST
MPASM 01.40 Released COMP_1.ASM 1-16-1997 17:35:21 PAGE 1
APPENDIX D:
nolist
;******************************************************************************
;
; This is the custom Header File for the real time clock application note
; PROGRAM:CLOCK.H
; Revision:7-13-94
;
;******************************************************************************
; This is used for the ASSEMBLER to recalculate certain frequency
; dependant variables. The value of Dev_Freq must be changed to
; reflect the frequency that the device actually operates at.
;
Dev_Freq EQU D’10000000’; Device Frequency is 10 MHz
PULSE_TIME EQU (( Dev_Freq / D’4000’ ) * D’188’ / D’10000’ )
T_ZERO_BIT EQU (( Dev_Freq / D’4000’ ) * D’188’ / D’10000’ )
T_ONE_BIT EQU (( Dev_Freq / D’4000’ ) * D’376’ / D’10000’ )
;
ZERO_1S EQU ((( Dev_Freq / D’4000’ ) * (D’6000’ - (D’16’ * D’188’))) / D’10000’ )
ONE_1S EQU ( ( Dev_Freq / D’4000’ ) * (D’6000’ - (3 * D’188’ + D’14’ * D’188’)) / D’10000’)
TWO_1S EQU ( ( Dev_Freq / D’4000’ ) * (D’6000’ - (6 * D’188’ + D’12’ * D’188’)) / D’10000’)
THREE_1S EQU ( ( Dev_Freq / D’4000’ ) * (D’6000’ - (D’9’ * D’188’ + D’10’ * D’188’)) / D’10000’)
FOUR_1S EQU ( ( Dev_Freq / D’4000’ ) * (D’6000’ - (D’12’ * D’188’ + 8 * D’188’)) / D’10000’)
FIVE_1S EQU ( ( Dev_Freq / D’4000’ ) * (D’6000’ - (D’15’ * D’188’ + 6 * D’188’)) / D’10000’)
SIX_1S EQU ( ( Dev_Freq / D’4000’ ) * (D’6000’ - (D’18’ * D’188’ + 4 * D’188’)) / D’10000’)
SEVEN_1S EQU ( ( Dev_Freq / D’4000’ ) * (D’6000’ - (D’21’ * D’188’ + 2 * D’188’)) / D’10000’)
EIGHT_1S EQU ( ( Dev_Freq / D’4000’ ) * (D’6000’ - (D’24’ * D’188’) ) / D’10000’ )
;
list
APPENDIX E:
MPASM 01.40 Released CAPT_2.ASM 1-16-1997 17:34:47 PAGE 1
APPENDIX F:
nolist
;******************************************************************************
;
; This is the custom Header File for the real time clock application note
; PROGRAM:CLOCK.H
; Revision:7-19-94
;
;******************************************************************************
; This is used for the ASSEMBLER to recalculate certain frequency
; dependant variables. The value of Dev_Freq must be changed to
; reflect the frequency that the device actually operates at.
;
Dev_Freq EQU D’4000000’; Device Frequency is 4 MHz
DB_HI_BYTE EQU (HIGH ((( Dev_Freq / 4 ) * 1 / D’1000’ ) / 3 ) ) + 1
LCD_INIT_DELAY EQU (HIGH ((( Dev_Freq / 4 ) * D’46’ / D’10000’ ) / 3 ) ) + 1
INNER_CNTR EQU 40 ; RAM Location
OUTER_CNTR EQU 41 ; RAM Location
;
T1OSO EQU 0 ; The RC0 / T1OSO / T1CKI
;
RESET_V EQU 0x0000 ; Address of RESET Vector
ISR_V EQU 0x0004 ; Address of Interrupt Vector
PMEM_END EQU 0x07FF ; Last address in Program Memory
TABLE_ADDR EQU 0x0400 ; Address where to start Tables
;
COUNTER EQU 0x021 ;
CCP2_INT_CNT EQU 0x33
;
;
; DUMMY_PD:DUMMY_PB contain the value to be loaded into the CCP2 compare registers
; (CCPR2H:CCPR2L)
;
DUMMY_PA EQU 0x50
DUMMY_PB EQU 0x51
DUMMY_PC EQU 0x52
DUMMY_PD EQU 0x53
DUMMY_PE EQU 0x54
;
;
; CAPT_NEW_H:CAPT_NEW_L stores the NEW captured value and the result of the
; subtraction between this capture and the previous.
; CAPT_NEW_H:CAPT_NEW_L = CAPT_NEW_H:CAPT_NEW_L - CAPT_OLD_H:CAPT_OLD_L
;
; After all computations the new capture value is moved to the CAPT_OLD_H:CAPT_OLD_L
; in preperation for the next capture value.
;
CAPT_NEW_H EQU 0x040 ;
CAPT_NEW_L EQU 0x041 ;
CAPT_OLD_H EQU 0x042 ;
CAPT_OLD_L EQU 0x043 ;
;
list
• The PICmicro family meets the specifications contained in the Microchip Data Sheet.
• Microchip believes that its family of PICmicro microcontrollers is one of the most secure products of its kind on the market today,
when used in the intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowl-
edge, require using the PICmicro microcontroller in a manner outside the operating specifications contained in the data sheet.
The person doing so may be engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable”.
• Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of
our product.
If you have any further questions about this matter, please contact the local sales office nearest to you.
01/18/02