1 M Section 14. Compare/Capture/PWM (CCP) HIGHLIGHTS This section of the manual contains the following major topics: 14.1 Introduction Control Register Capture Mode Compare Mode PWM Mode Initialization Design Tips Related Application Notes Revision History CCP 1997 Microchip Technology Inc. DS31014A page 14-1
2 PICmicro MID-RANGE MCU FAMILY 14.1 Introduction Each CCP (Capture/Compare/PWM) module contains a 16-bit register which can operate as a 16-bit capture register, as a 16-bit compare register or as a 10-bit PWM master/slave Duty Cycle register. The CCP modules are identical in operation, with the exception of the operation of the special event trigger. Each CCP module has 3 registers. Multiple CCP modules may exist on a single device. Throughout this section we use generic names for the CCP registers. These generic names are shown in Table Table 14-1: Specific to Generic CCP Nomenclature Generic Name CCP1 CCP2 Comment CCPxCON CCP1CON CCP2CON CCP control register CCPRxH CCPR1H CCPR2H CCP High byte CCPRxL CCPR1L CCPR2L CCP Low byte CCPx CCP1 CCP2 CCP pin Table 14-2 shows the resources of the CCP modules, in each of its modes. While Table 14-3 shows the interactions between the CCP modules, where CCPx is one CCP module and CCPy is another CCP module. Table 14-2: CCP Mode - Timer Resource CCP Mode Capture Compare PWM Timer Resource Timer1 Timer1 Timer2 Table 14-3: Interaction of Two CCP Modules CCPx Mode CCPy Mode Interaction Capture Capture Same TMR1 time-base. Capture Compare The compare should be configured for the special event trigger, which clears TMR1. Compare Compare The compare(s) should be configured for the special event trigger, which clears TMR1. PWM PWM The PWMs will have the same frequency, and update rate (TMR2 interrupt). PWM Capture None PWM Compare None DS31014A-page Microchip Technology Inc.
3 Section 14. CCP 14.2 Control Register Register 14-1: CCPxCON Register U-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 DCxB1 DCxB0 CCPxM3 CCPxM2 CCPxM1 CCPxM0 bit 7 bit 0 bit 7:6 bit 5:4 bit 3:0 Unimplemented: Read as '0' DCxB1:DCxB0: PWM Duty Cycle bit1 and bit0 Capture Mode: Unused Compare Mode: Unused PWM Mode: These bits are the two LSbs (bit1 and bit0) of the 10-bit PWM duty cycle. The upper eight bits (DCx9:DCx2) of the duty cycle are found in CCPRxL. CCPxM3:CCPxM0: CCPx Mode Select bits 0000 = Capture/Compare/PWM off (resets CCPx module) 0100 = Capture mode, every falling edge 0101 = Capture mode, every rising edge 0110 = Capture mode, every 4th rising edge 0111 = Capture mode, every 16th rising edge 1000 = Compare mode, Initialize CCP pin Low, on compare match force CCP pin High (CCPIF bit is set) 1001 = Compare mode, Initialize CCP pin High, on compare match force CCP pin Low (CCPIF bit is set) 1010 = Compare mode, Generate software interrupt on compare match (CCPIF bit is set, CCP pin is unaffected) 1011 = Compare mode, Trigger special event (CCPIF bit is set) 11xx = PWM mode Legend R = Readable bit W = Writable bit U = Unimplemented bit, read as 0 - n = Value at POR reset 14 CCP 1997 Microchip Technology Inc. DS31014A-page 14-3
4 PICmicro MID-RANGE MCU FAMILY 14.3 Capture Mode In Capture mode, CCPRxH:CCPRxL captures the 16-bit value of the TMR1 register when an event occurs on pin CCPx. An event is defined as: Every falling edge Every rising edge Every 4th rising edge Every 16th rising edge An event is selected by control bits CCPxM3:CCPxM0 (CCPxCON<3:0>). When a capture is made, the interrupt request flag bit, CCPxIF, is set. The CCPxIF bit must be cleared in software. If another capture occurs before the value in register CCPRx is read, the previous captured value will be lost. Note: CCP Pin Configuration Timer1 must be running in timer mode or synchronized counter mode for the CCP module to use the capture feature. In asynchronous counter mode, the capture operation may not work. As can be seen in Figure 14-1, a capture does not reset the 16-bit TMR1 register. This is so Timer1 can also be used as the timebase for other operations. The time between two captures can easily be computed as the difference between the value of the second capture that of the first capture. When Timer1 overflows, the TMR1IF bit will be set and if enabled an interrupt will occur, allowing the time base to be extended to greater than 16-bits. In Capture mode, the CCPx pin should be configured as an input by setting its corresponding TRIS bit. Note: If the CCPx pin is configured as an output, a write to the port can cause a capture condition. Figure 14-1: Capture Mode Operation Block Diagram CCPx Pin Prescaler 1, 4, 16 Set flag bit CCPxIF CCPRxH CCPRxL and edge detect Capture Enable Q s CCPxCON<3:0> TMR1H TMR1L The prescaler can be used to get a very fine average resolution on a constant input frequency. For example, if we have a stable input frequency and we set the prescaler to 1:16, then the total error for those 16 periods is 1 TCY. This gives an effective resolution of TCY/16, which at 20 MHz is 12.5 ns. This technique is only valid where the input frequency is stable over the 16 samples. Without using the prescaler (1:1), each sample would have a resolution of TCY. DS31014A-page Microchip Technology Inc.
5 CCP Section 14. CCP Changing Between Capture Modes When the Capture mode is changed, a capture interrupt may be generated. The user should keep the CCPxIE bit clear to disable these interrupts and should clear the CCPxIF flag bit following any such change in operating mode CCP Prescaler There are four prescaler settings, specified by bits CCPxM3:CCPxM0. Whenever the CCP module is turned off, or the CCP module is not in capture mode, the prescaler counter is cleared. This means that any reset will clear the prescaler counter. Switching from one capture prescale setting to another may generate an interrupt. Also, the prescaler counter will not be cleared, therefore the first capture may be from a nonzero prescaler. Example 14-1 shows the recommended method for switching between capture prescale settings. This example also clears the prescaler counter and will not generate the interrupt. Example 14-1: Changing Between Capture Prescalers CLRF CCP1CON Turn CCP module off MOVLW NEW_CAPT_PS Load the W reg with the new prescaler mode value and CCP ON MOVWF CCP1CON Load CCP1CON with this value Sleep Operation Effects of a Reset To clear the Capture prescaler count, the CCP module must be configured into any non-capture CCP mode (Compare, PWM, or CCP off modes). When the device is placed in sleep, Timer1 will not increment (since it is in synchronous mode), but the prescaler will continue to count events (not synchronized). When a specified capture event occurs, the CCPxIF bit will be set, but the capture register will not be updated. If the CCP interrupt is enabled, the device will wake-up from sleep. The value in the 16-bit TMR1 register is not transferred to the 16-bit capture register, but since the timer was not incrementing, this value should not have any meaning. Effectively, this allows the CCP pin to be used as another external interrupt. The CCP module is off, and the value in the capture prescaler is forced to Microchip Technology Inc. DS31014A-page 14-5
6 PICmicro MID-RANGE MCU FAMILY 14.4 Compare Mode In Compare mode, the 16-bit CCPRx register value is constantly compared against the TMR1 register pair value. When a match occurs, the CCPx pin is: Driven High Driven Low Remains Unchanged The action on the pin is based on the value of control bits CCPxM3:CCPxM0 (CCPxCON<3:0>). At the same time, a compare interrupt is also generated. Note: Timer1 must be running in Timer mode or Synchronized Counter mode if the CCP module is using the compare feature. In Asynchronous Counter mode, the compare operation may not work. Figure 14-2: Compare Mode Operation Block Diagram Special Event Trigger Set flag bit CCPxIF CCPRxH CCPRxL Q CCPx Pin TRIS Output Enable S R Output Logic CCPxCON<3:0> Mode Select match Comparator TMR1H TMR1L DS31014A-page Microchip Technology Inc.
7 CCP Section 14. CCP CCP Pin Operation in Compare Mode The user must configure the CCPx pin as an output by clearing the appropriate TRIS bit. Note: Software Interrupt Mode Special Event Trigger Selecting the compare output mode, forces the state of the CCP pin to the state that is opposite of the match state. So if the Compare mode is selected to force the output pin low on match, then the output will be forced high until the match occurs (or the mode is changed). When generate Software Interrupt mode is chosen, the CCPx pin is not affected. Only a CCP interrupt is generated (if enabled). In this mode, an internal hardware trigger is generated which may be used to initiate an action. The special event trigger output of CCPx resets the TMR1 register pair. This allows the CCPRx register to effectively be a 16-bit programmable period register for Timer1. For some devices, the special trigger output of the CCP module resets the TMR1 register pair, and starts an A/D conversion (if the A/D module is enabled). Note: Sleep Operation Effects of a Reset Clearing the CCPxCON register will force the CCPx compare output latch to the default low level. This is not the Port I/O data latch. The special event trigger will not set the Timer1 interrupt flag bit, TMR1IF. When the device is placed in sleep, Timer1 will not increment (since in synchronous mode), and the state of the module will not change. If the CCP pin is driving a value, it will continue to drive that value. When the device wakes-up, it will continue form this state. The CCP module is off Microchip Technology Inc. DS31014A-page 14-7
8 PICmicro MID-RANGE MCU FAMILY 14.5 PWM Mode In Pulse Width Modulation (PWM) mode, the CCPx pin produces up to a 10-bit resolution PWM output. Since the CCPx pin is multiplexed with the PORT data latch, the corresponding TRIS bit must be cleared to make the CCPx pin an output. Note: Clearing the CCPxCON register will force the CCPx PWM output latch to the default low level. This is not the port I/O data latch. Figure 14-3 shows a simplified block diagram of the CCP module in PWM mode. For a step by step procedure on how to set up the CCP module for PWM operation, see Subsection Set-up for PWM Operation. Figure 14-3: Simplified PWM Block Diagram Duty cycle registers CCPRxL (DCxB9:DCxB2) 10 CCPxCON<5:4> (DCxB1:DCxB0) CCPRxH (Slave) TRIS<y> 10 Comparator R Q CCP Module 10 S CCPx TMR2 (Note 1) 8 Comparator 8 Clear Timer, CCPx pin and latch the Duty Cycle PR2 Timer2 Module Note 1: 8-bit timer is concatenated with 2-bit internal Q clock or 2 bits of the prescaler to create 10-bit time-base. A PWM output (Figure 14-4) has a time-base (period) and a time that the output stays high (duty cycle). The frequency of the PWM is the inverse of the period (1/period). Figure 14-4: PWM Output Duty Cycle = DCxB9:DCxB0 Period = PR2 + 1 TMR2 = PR2 + 1, TMR2 forced to 0h TMR2 = PR2 + 1, TMR2 forced to 0h TMR2 = Duty Cycle DS31014A-page Microchip Technology Inc.
9 Section 14. CCP PWM Period The PWM period is specified by writing to the PR2 register. The PWM period can be calculated using the following formula: PWM period = [(PR2) + 1] 4 TOSC (TMR2 prescale value), specified in units of time PWM frequency (FPWM) is defined as 1 / [PWM period]. When TMR2 is equal to PR2, the following three events occur on the next increment cycle: TMR2 is cleared The CCPx pin is set (exception: if PWM duty cycle = 0%, the CCPx pin will not be set) The PWM duty cycle is latched from CCPRxL into CCPRxH Note: The Timer2 postscaler is not used in the determination of the PWM frequency. The postscaler could be used to have a servo update rate at a different frequency than the PWM output PWM Duty Cycle The PWM duty cycle is specified by writing to the CCPRxL register and to the DCxB1:DCxB0 (CCPxCON<5:4>) bits. Up to 10-bit resolution is available: the CCPRxL contains the eight MSbs and CCPxCON<5:4> contains the two LSbs. This 10-bit value is represented by DCxB9:DCxB0. The following equation is used to calculate the PWM duty cycle: PWM duty cycle = (DCxB9:DCxB0 bits value) Tosc (TMR2 prescale value), in units of time The DCxB9:DCxB0 bits can be written to at any time, but the duty cycle value is not latched into CCPRxH until after a match between PR2 and TMR2 occurs (which is the end of the current period). In PWM mode, CCPRxH is a read-only register. The CCPRxH register and a 2-bit internal latch are used to double buffer the PWM duty cycle. This double buffering is essential for glitchless PWM operation. When CCPRxH and 2-bit latch match the value of TMR2 concatenated with the internal 2-bit Q clock (or two bits of the TMR2 prescaler), the CCPx pin is cleared. This is the end of the duty cycle. Maximum PWM resolution (bits) for a given PWM frequency: FOSC log( FPWM ) = bits log(2) Note: If the PWM duty cycle value is longer than the PWM period, the CCPx pin will not be cleared. This allows a duty cycle of 100%. 14 CCP 1997 Microchip Technology Inc. DS31014A-page 14-9
10 PICmicro MID-RANGE MCU FAMILY Minimum Resolution The minimum resolution (in time) of each bit of the PWM duty cycle depends on the prescaler of Timer2. Table 14-4: Minimum Duty Cycle Bit Time Prescaler Value T2CKPS1:T2CKPS0 Minimum Resolution (Time) TOSC TCY 16 1 x 4 TCY Example 14-2: PWM Period and Duty Cycle Calculation Desired PWM frequency is khz, Fosc = 20 MHz TMR2 prescale = 1 1/ khz= [(PR2) + 1] 4 1/20 MHz µs = [(PR2) + 1] 4 50 ns 1 PR2 = 63 Find the maximum resolution of the duty cycle that can be used with a khz frequency and 20 MHz oscillator: 1/ khz= 2 PWM RESOLUTION 1/20 MHz µs = 2 PWM RESOLUTION 50 ns 1 PWM RESOLUTION 256 = 2 log(256) = (PWM Resolution) log(2) 8.0 = PWM Resolution At most, an 8-bit resolution duty cycle can be obtained from a khz frequency and a 20 MHz oscillator, i.e., 0 DCxB9:DCxB Any value greater than 255 will result in a 100% duty cycle. In order to achieve higher resolution, the PWM frequency must be decreased. In order to achieve higher PWM frequency, the resolution must be decreased. Table 14-5 lists example PWM frequencies and resolutions for Fosc = 20 MHz. The TMR2 prescaler and PR2 values are also shown. Table 14-5: Example PWM Frequencies and Bit Resolutions at 20 MHz PWM Frequency 1.22 khz 4.88 khz khz khz khz khz Timer Prescaler (1, 4, 16) PR2 Value 0xFF 0xFF 0xFF 0x3F 0x1F 0x17 Maximum Resolution (bits) DS31014A-page Microchip Technology Inc.
11 CCP Section 14. CCP Set-up for PWM Operation The following steps configure the CCP module for PWM operation: 1. Establish the PWM period by writing to the PR2 register. 2. Establish the PWM duty cycle by writing to the DCxB9:DCxB0 bits. 3. Make the CCPx pin an output by clearing the appropriate TRIS bit. 4. Establish the TMR2 prescale value and enable Timer2 by writing to T2CON. 5. Configure the CCP module for PWM operation Sleep Operation Effects of a Reset When the device is placed in sleep, Timer2 will not increment, and the state of the module will not change. If the CCP pin is driving a value, it will continue to drive that value. When the device wakes-up, it will continue from this state. The CCP module is off Microchip Technology Inc. DS31014A-page 14-11
12 PICmicro MID-RANGE MCU FAMILY 14.6 Initialization The CCP module has three modes of operation. Example 14-3 shows the initialization of capture mode, Example 14-4 shows the initialization of compare mode, and Example 14-5 shows the initialization of PWM mode. Example 14-3: Capture Initialization CLRF CCP1CON CCP Module is off CLRF TMR1H Clear Timer1 High byte CLRF TMR1L Clear Timer1 Low byte CLRF INTCON Disable interrupts and clear T0IF BSF STATUS, RP0 Bank1 BSF TRISC, CCP1 Make CCP pin input CLRF PIE1 Disable peripheral interrupts BCF STATUS, RP0 Bank0 CLRF PIR1 Clear peripheral interrupts Flags MOVLW 0x06 Capture mode, every 4th rising edge MOVWF CCP1CON BSF T1CON, TMR1ON Timer1 starts to increment The CCP1 interrupt is disabled, do polling on the CCP Interrupt flag bit Capture_Event BTFSS PIR1, CCP1IF GOTO Capture_Event Capture has occurred BCF PIR1, CCP1IF This needs to be done before next compare DS31014A-page Microchip Technology Inc.
13 CCP Section 14. CCP Example 14-4: Compare Initialization CLRF CCP1CON CCP Module is off CLRF TMR1H Clear Timer1 High byte CLRF TMR1L Clear Timer1 Low byte CLRF INTCON Disable interrupts and clear T0IF BSF STATUS, RP0 Bank1 BCF TRISC, CCP1 Make CCP pin output if controlling state of pin CLRF PIE1 Disable peripheral interrupts BCF STATUS, RP0 Bank0 CLRF PIR1 Clear peripheral interrupts Flags MOVLW 0x08 Compare mode, set CCP1 pin on match MOVWF CCP1CON BSF T1CON, TMR1ON Timer1 starts to increment The CCP1 interrupt is disabled, do polling on the CCP Interrupt flag bit Compare_Event BTFSS PIR1, CCP1IF GOTO Compare_Event Compare has occurred BCF PIR1, CCP1IF This needs to be done before next compare Microchip Technology Inc. DS31014A-page 14-13
14 PICmicro MID-RANGE MCU FAMILY Example 14-5: PWM Initialization CLRF CCP1CON CCP Module is off CLRF TMR2 Clear Timer2 MOVLW 0x7F MOVWF PR2 MOVLW 0x1F MOVWF CCPR1L Duty Cycle is 25% of PWM Period CLRF INTCON Disable interrupts and clear T0IF BSF STATUS, RP0 Bank1 BCF TRISC, PWM1 Make pin output CLRF PIE1 Disable peripheral interrupts BCF STATUS, RP0 Bank0 CLRF PIR1 Clear peripheral interrupts Flags MOVLW 0x2C PWM mode, 2 LSbs of Duty cycle = 10 MOVWF CCP1CON BSF T2CON, TMR2ON Timer2 starts to increment The CCP1 interrupt is disabled, do polling on the TMR2 Interrupt flag bit PWM_Period_Match BTFSS PIR1, TMR2IF GOTO PWM_Period_Match Update this PWM period and the following PWM Duty cycle BCF PIR1, TMR2IF DS31014A-page Microchip Technology Inc.
15 Section 14. CCP 14.7 Design Tips Question 1: What timers can I use for the capture and compare modes? Answer 1: The capture and compare modes are designed around Timer1, so no other timer can be used for these functions. This also means that if multiple CCP modules (in parts with more than one) are being used for a capture or compare function, they will share the same timer. Question 2: What timers can I use with the PWM mode? Answer 2: The PWM mode is designed around Timer2, so no other timer can be used for this function. (It is the only timer with a period register associated with it.) If multiple CCP modules (in parts with more than one) are doing PWM they will share the same timer, meaning they will have the same PWM period and frequency. Question 3: Can I use one CCP module to do capture (or compare) AND PWM at the same time, since they use different timers as their reference? Answer 3: The timers may be different, but other logic functions are shared. However you can switch from one mode to the other. For a device with two CCP modules, you can also have CCP1 set up for PWM and CCP2 set up for capture or compare (or vice versa) since they are two independent modules. Question 4: How does a reset affect the CCP module? Answer 4: Any reset will turn the CCP module off. See the section on resets to see reset values. Question 5: I am setting up the CCP1CON module for Compare Mode, trigger special event (1011) which resets TMR1. When a compare match occurs, will I have both the TMR1 and the CCP1 interrupts pending (TMR1IF is set, CCP1IF is set)? Answer 5: The CCP1IF flag will be set on the match condition. TMR1IF is set when Timer1 overflows, and the special trigger reset of Timer1 is not considered an overflow. However, if both the CCPR1L and CCPR1H registers are set at FFh, then an overflow occurs at the same time as the match, which will then set both CCP1IF and TMR1IF. 14 Question 6: How do I use Timer2 as a general purpose timer, with an interrupt flag on rollover? Answer 6: Timer2 always resets to zero when it equals PR2 and flag bit TMR2IF always gets set at this time. By putting FFh into PR2, you will get an interrupt on overflow at FFh, as you would with Timer0, for instance. Quite often it is desirable to have an event occur at a periodic rate, perhaps an interrupt driven event. Normally an initial value would be placed into the timer so that the overflow will occur at the desired time. This value would have to be placed back into the timer every time it overflowed to make the interrupts occur at the same desired rate. The benefit of Timer2 is that a value can be written to PR2 that will cause it to reset at your desired time interval. This means you do not have the housekeeping chore of reloading the timer every time it overflows, since PR2 maintains its value. CCP 1997 Microchip Technology Inc. DS31014A-page 14-15
16 PICmicro MID-RANGE MCU FAMILY Question 7: I am using a CCP module in PWM mode. The duty cycle being output is almost always 100%, even when my program writes a value like 7Fh to the duty cycle register, which should be 50%. What am I doing wrong? Answer 7: 1. The value in CCPRxL is higher than PR2. This happens quite often when a user desires a fast PWM output frequency and will write a small value in the PR2. In this case, if a value of 7Eh were written to PR2, then a value 7Fh in CCPRxL will result in 100% duty cycle. 2. If the TRIS bit corresponding to the CCP output pin you are using is configured as an input, the PWM output cannot drive the pin. In this case the pin would float and duty cycle may appear to be 0%, 100% or some other floating value. Question 8: I want to determine a signal frequency using the CCP module in capture mode to find the period. I am currently resetting Timer1 on the first edge, then using the value in the capture register on the second edge as the time period. The problem is that my code to clear the timer does not occur until almost twelve instructions after the first capture edge (interrupt latency plus saving of registers in interrupt) so I cannot measure very fast frequencies. Is there a better way to do this? Answer 8: You do not need to zero the counter to find the difference between two pulse edges. Just take the first captured value and put it into another set of registers. Then when the second capture event occurs, just subtract the first event from the second. Assuming that your pulse edges are not so far apart that the counter can wrap around past the last capture value, the answer will always be correct. This is illustrated by the following example: 1. First captured value is FFFEh. Store this value in two registers. 2. The second capture value is 0001h (the counter has incremented three times) h - FFFEh = 0003, which is the same as if you had cleared Timer1 to zero and let it count to 3. (Theoretically, except that there was a delay getting to the code that clears Timer1, so actual values would differ). The interrupt overhead is now less important because the values are captured automatically. For even faster inputs do not enable interrupts and just test the flag bit in a loop. If you must also capture very long time periods, such that the timer can wrap around past the previous capture value, then consider using an auto-scaling technique that starts with a large prescale and shorten the prescale as you converge on the exact frequency. DS31014A-page Microchip Technology Inc.
17 CCP Section 14. CCP 14.8 Related Application Notes This section lists application notes that are related to this section of the manual. These application notes may not be written specifically for the Mid-Range MCU family (that is they may be written for the Base-Line, or High-End families), but the concepts are pertinent, and could be used (with modification and possible limitations). The current application notes related to the CCP modules are: Title Application Note # Using the CCP Modules AN594 Implementing Ultrasonic Ranging AN597 Air Flow Control Using Fuzzy Logic AN600 Adaptive Differential Pulse Code Modulation AN Microchip Technology Inc. DS31014A-page 14-17
18 PICmicro MID-RANGE MCU FAMILY 14.9 Revision History Revision A This is the initial released revision of the CCP module description. DS31014A-page Microchip Technology Inc.
REAL-TIME CLOCK Real-Time Clock The device is not a clock! It does not tell time! It has nothing to do with actual or real-time! The Real-Time Clock is no more than an interval timer connected to the computer
M Section 21. Converter HIGHLIGHTS 21 Convertor This section of the manual contains the following major topics: 21.1 Introduction...21-2 21.2 Control Registers...21-3 21.3 Operation...21-5 21.4 A/D Acquisition
PIC18 Timer Programming g Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan firstname.lastname@example.org Functions of PIC18 timer Functions of the timer Generate a time delay As
Microprocessors and Microcontrollers Timers & Counters EE3954 by Maarten Uijt de Haag, Tim Bambeck Timers.1 Timers and Counters PIC Microcontroller has three Timers/ Counters: Timer 0: 8-bit register TMR0
EE2801 -- Lecture 23 Using The PIC Timers EE2801-L23P01 The PIC 16F874 Timers There are a total of four timers that are available in the PIC. These are: The Watchdog timer (WDT) The Watchdog timer is a
USART M Section 18. USART HIGHLIGHTS This section of the manual contains the following major topics: 18.1 Introduction...18-2 18.2 Control Registers...18-3 18.3 USART Baud Rate Generator (BRG)...18-5 18.4
M Section 23. A/D Converter HIGHLIGHTS This section of the manual contains the following major topics: 23.1 Introduction...23-2 23.2 Control Register...23-3 23.3 Operation...23-5 23.4 A/D Acquisition Requirements...23-6
ETEC 421 - Digital Controls PIC Lab 10 Pulse Width Modulation Program Definition: Write a program to control the speed of a dc motor using pulse width modulation. Discussion: The speed of a dc motor is
Interrupts M Section 8. Interrupts HIGHLIGHTS This section of the manual contains the following major topics: 8.1 Introduction...8-2 8.2 Control Registers...8-5 8.3 Interrupt Latency...8-10 8.4 INT and
M Section 19. Voltage Reference HIGHLIGHTS This section of the manual contains the following major topics: 19.1 Introduction...19-2 19.2 Control Register...19-3 19.3 Configuring the Voltage Reference...19-4
Section 14. Timers HIGHLIGHTS This section of the manual contains the following major topics: 14.1 Introduction... 14-2 14.2 Timer Variants... 14-3 14.3 Control Registers... 14-6 14.4 Modes of Operation...
SPI Overview and Use of the PICmicro Serial Peripheral Interface In this presentation, we will look at what the Serial Peripheral Interface, otherwise known as the SPI, is, and how it is used to communicate
M Section 29. Instruction Set HIGHLIGHTS This section of the manual contains the following major topics: 29. Introduction...29-2 29.2 Instruction Formats...29-4 29.3 Special Function Registers as Source/Destination...29-6
I/O Ports M Section 9. I/O Ports HIGHLIGHTS This section of the manual contains the following major topics: 9.1 Introduction...9-2 9.2 PORTA and the TRISA Register...9-4 9.3 PORTB and the TRISB Register...9-6
Section 8. Interrupts HIGHLIGHTS This section of the manual contains the following topics: 8.1 Introduction... 8-2 8.2 Non-Maskable Traps... 8-5 8.3 Interrupt Processing Timing... 8-9 8.4 Interrupt Control
EE2801 -- Lecture 22 Using The PIC I/O Ports EE2801-L22P01 The Variety Of Available IO Ports The PIC 16F874 microcontroller has five different IO ports, accounting for thirty three of the processors forty
Counter/Timer 0 and 2 (TCNT0, TCNT2) are nearly identical. Differences: -TCNT0 can run off an external 32Khz clock (Tosc) or the internal clock after it has passed through the prescaler. -TCNT2 can run
Section 15. Motor Control HIGHLIGHTS This section of the manual contains the following topics: 15.1 Introduction... 15-2 15.2 Control Registers... 15-4 15.3 Time Base... 15-16 15.4 Duty Cycle Comparison
Humidity Sensor & DC Fan Control 06 September 2006 Application Note (DKAN0007A) Features DC fan control Measure capacitive sensor 555 Timer usage Microchip 12F683 Introduction This application note covers
Section 15. Quadrature Encoder Interface (QEI) HIGHLIGHTS This section of the manual contains the following major topics: 15.1 Introduction... 15-2 15.2 Control and Status Registers... 15-4 15.3 Programmable
Timer A (0 and 1) and PWM EE3376 General Peripheral Programming Model Each peripheral has a range of addresses in the memory map peripheral has base address (i.e. 0x00A0) each register used in the peripheral
I 2 C Master Mode Overview and Use of the PICmicro MSSP I 2 C Interface with a 24xx01x EEPROM v 0.40 Welcome to the Microchip Technology Presentation on using the MSSP module in Master I 2 C mode. In this
Control Seven-Segment Displays Author: APPLICATION OPERATION This application shows a technique for connecting two 7-segment displays directly to the PIC12C50X. For example, a 99-second timer is implemented.
Section 29. Real-Time Clock and Calendar (RTCC) HIGHLIGHTS This section of the manual contains the following topics: 29.1 Introduction... 29-2 29.2 Status and Control Registers... 29-3 29.3 Modes of Operation...
Data Sheet 28/40-Pin, 8-Bit CMOS ROM Microcontrollers 2006 Microchip Technology Inc. DS21993A Note the following details of the code protection feature on Microchip devices: Microchip products meet the
A First Amateur Radio PIC Project Andy Palm N1KSN In case you haven't noticed, transceivers now use microprocessors extensively to control panel functions, generate RF signals, do digital signal processing,
M Section 2. Oscillator HIGHLIGHTS This section of the manual contains the following major topics: 2.1 Introduction...2-2 2.2 Oscillator Configurations...2-2 2.3 Crystal Oscillators / Ceramic Resonators...2-4
Chapter 5 Serial Port Operation (I. Scott MacKenzie) 1 Introduction 8051 includes an on-chip serial port that can operate in four modes over a wide range of frequencies. Essential function of serial port
Programmable Interval Timer 85/5 9. ecessity and Introduction The 85/5 solves one of most common problem in any microcomputer system, the generation of accurate time delays under software control. Instead
FLASH-Based 8-Bit CMOS Microcontrollers Devices included in this data sheet: PIC16F627 PIC16F628 Referred to collectively as PIC16F62X. High Performance RISC CPU: Only 35 instructions to learn All single-cycle
28/40-pin 8-Bit CMOS FLASH Microcontrollers Devices Included in this Data Sheet: PIC16F873 PIC16F874 PIC16F876 PIC16F877 Microcontroller Core Features: High-performance RISC CPU Only 35 single word instructions
Atmel AVR 8-bit Microcontroller AVR151: Setup and Use of the SPI APPLICATION NOTE Introduction This application note describes how to set up and use the on-chip Serial Peripheral Interface (SPI) of the
Section 15. Quadrature Encoder Interface (QEI) HIGHLIGHTS This section of the manual contains the following major topics: 15.1 Introduction... 15-2 15.2 Control and Status Registers... 15-4 15.3 Programmable
512-Kbit, serial flash memory, 50 MHz SPI bus interface Features 512 Kbits of flash memory Page program (up to 256 bytes) in 1.4 ms (typical) Sector erase (256 Kbits) in 0.65 s (typical) Bulk erase (512
MICHIGAN STATE UNIVERSITY COLLEGE OF ENGINEERING Embedded C on a PIC Programming a Pulse Width Modulation on a PIC18F4520 Merav Nahoom 11/13/2009 Pulse Width Modulation (PWM) is the most effective mean
M Section 28. In-Circuit Serial Programming (ICSP ) HIGHLIGHTS This section of the manual contains the following major topics: 28. Introduction...28-2 28.2 Entering In-Circuit Serial Programming Mode...28-3
SAMPLE OF THE STUD MATERIAL PART OF CHAPTER 5 5. Introduction Digital circuits can be classified into two types: Combinational digital circuits and Sequential digital circuits. 5.2 Combinational Digital
AVR 8-bit Microcontrollers AVR131: Using the AVR s High-speed PWM APPLICATION NOTE Introduction This application note is an introduction to the use of the high-speed Pulse Width Modulator (PWM) available
PIC MICROCONTROLLERS FOR DIGITAL FILTER IMPLEMENTATION There are many devices using which we can implement the digital filter hardware. Gone are the days where we still use discrete components to implement
Experiment # 9 Clock generator circuits & Counters Eng. Waleed Y. Mousa 1. Objectives: 1. Understanding the principles and construction of Clock generator. 2. To be familiar with clock pulse generation
Data Sheet Flash-Based 8-Bit CMOS Microcontrollers with nanowatt Technology 2004 Microchip Technology Inc. Preliminary DS40044B Note the following details of the code protection feature on Microchip devices:
University of Portsmouth Faculty of Technology Department of Electronic and Computer Engineering Module: Digital Electronics and Microprocessors Module Code: B122 Module Topic: Microcontroller Applications
8-Bit CMOS Microcontrollers with A/D Converter Devices included in this data sheet: PIC16C72 PIC16C73 PIC16C73A PIC16C74 PIC16C74A PIC16C76 PIC16C77 PIC16C7X Microcontroller Core Features: High-performance
Assembly Programming for Mid Range PIC 1 Producing Executable Code Assembly Develop code on PC Edit / assemble / link / debug Assembly Convert assembly language code to machine language Absolute (executable)
Data Sheet Flash-Based, 8-Bit CMOS Microcontrollers with nanowatt Technology 2005 Microchip Technology Inc. DS40044D Note the following details of the code protection feature on Microchip devices: Microchip
Hello, and welcome to this presentation of the STM32 Universal Synchronous/Asynchronous Receiver/Transmitter Interface. It covers the main features of this USART interface, which is widely used for serial
USB I/O Data Sheet 802x00 802600 USB Chip 16 Bit IO SOIC24 802300 USB Chip 12 Bit IO DIP20 802200 USB Chip 12 Bit IO SOIC20 802270 USB Chip 10 Bit IO SOIC18 802370 USB Chip 10 Bit IO DIP18 802670 USB Chip
C What Happens INTRODUCTION PIC MICROCONTROLLER PRODUCT OVERVIEW SELECTING A DEVICE FOR EXPERIMENTS PIC16F818 Pins and functions Package Clock oscillator Reset Ports Special Features PIC microcontroller
Section 45. Data Memory with Extended Data Space (EDS) HIGHLIGHTS This section of the manual contains the following topics: 45.1 Introduction... 45-2 45.2 Data Memory Organization... 45-3 45.3 Extended
NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter Description: The NTE2053 is a CMOS 8 bit successive approximation Analog to Digital converter in a 20 Lead DIP type package which uses a differential
HIGHLIGHTS Section 7. This section of the manual contains the following topics: 7 7.1 Introduction... 7-2 7.2 CPU Clocking...7-4 7.3 Configuration Registers... 7-5 7.4 Special Function Registers... 7-8
Serial Communications 1 Serial Communication Introduction Serial communication buses Asynchronous and synchronous communication UART block diagram UART clock requirements Programming the UARTs Operation
CoE3DJ4 Digital Systems Design Chapter 4: Timer operation Timer There are two 16-bit timers each with four modes of operation Timers are used for (a) interval timing, (b) event counting or (c) baud rate
Hello, welcome to this presentation of the low power timer, or LPTMR, module for Kinetis MCUs. In this session you ll learn about the LPTMR, it s main features and the application benefits of leveraging
Getting Started with On-chip Memory 2001 Microchip Technology Incorporated. All Rights Reserved. S0001A RAM/ROM(x14) 1 In this Getting Started tutorial you will learn about the various memory types found
PIC Microcontrollers PIC stands for Peripheral Interface Controller coined by Microchip Technology to identify its singlechip microcontrollers These devices have been phenomenally successful in 8-bit microcontroller
Application note Using the hardware real-time clock (RTC) in STM32 F0, F2, F3, F4 and L1 series of MCUs Introduction Note: A real-time clock (RTC) is a computer clock that keeps track of the current time.
Technical Note TN-29-06: NAND Flash Controller on Spartan-3 Overview Micron NAND Flash Controller via Xilinx Spartan -3 FPGA Overview As mobile product capabilities continue to expand, so does the demand
Data Sheet 28/40-Pin 8-Bit CMOS FLASH Microcontrollers 2001 Microchip Technology Inc. DS30292C All rights reserved. Copyright 2001, Microchip Technology Incorporated, USA. Information contained in this
Hello, and welcome to this presentation of the STM32 Infrared Timer. Features of this interface allowing the generation of various IR remote control protocols will be presented. 1 The Infrared Timer peripheral
APPLICATION NOTE Atmel AVR134: Real Time Clock (RTC) Using the Asynchronous Timer Introduction Atmel AVR 8-bit Microcontroller This application note describes how to implement a real time counter (RTC)
M PIC6F84A 8-pin Enhanced Flash/EEPROM 8-Bit Microcontroller Devices Included in this Data Sheet: PIC6F84A Extended voltage range device available (PIC6LF84A) High Performance RISC CPU Features: Only 35
PIC Programming in Assembly (http://www.mstracey.btinternet.co.uk/index.htm) Tutorial 1 Good Programming Techniques. Before we get to the nitty gritty of programming the PIC, I think now is a good time
Sequential Logic Design Principles.Latches and Flip-Flops Doru Todinca Department of Computers Politehnica University of Timisoara Outline Introduction Bistable Elements Latches and Flip-Flops S-R Latch
Section 10. Power-Saving Features HIGHLIGHTS This section of the manual contains the following major topics: 10.1 Introduction... 10-2 10.2 Microcontroller Clock Manipulation... 10-2 10.3 Instruction-Based
www.maxim-ic.com FEATURES Temperature measurements require no external components Measures temperatures from -55 C to +125 C in 0.5 C increments. Fahrenheit equivalent is -67 F to 257 F in 0.9 F increments
DP8570A DP8570A Timer Clock Peripheral (TCP) Literature Number: SNAS557 DP8570A Timer Clock Peripheral (TCP) General Description The DP8570A is intended for use in microprocessor based systems where information
Section 17. 10-Bit A/D Converter HIGHLIGHTS This section of the manual contains the following major topics: 17 17.1 Introduction... 17-2 17.2 A/D Terminology and Conversion Sequence... 17-4 17.3 Registers...
Data Sheet 8-Pin, Flash-Based 8-Bit CMOS Microcontrollers *8-bit, 8-pin Devices Protected by Microchip s Low Pin Count Patent: U.S. Patent No. 5,847,450. Additional U.S. and foreign patents and applications
Section 28. Analog-to-Digital er (ADC) without DMA HIGHLIGHTS This section of the manual contains the following major topics: 28.1 Introduction... 28-2 28.2 Control Registers... 28-4 28.3 Conversion Sequence...
Design of Digital Systems II Sequential Logic Design Principles (1) Moslem Amiri, Václav Přenosil Masaryk University Resource: Digital Design: Principles & Practices by John F. Wakerly Introduction Logic
Section 49. 10-Bit ADC with 4 Simultaneous Conversions HIGHLIGHTS This section of the manual contains the following major topics: 49.1 Introduction...1-2 49.2 Control Registers...1-4 49.3 Overview of and
Experiment 3 Generating Timing Sequences Objective The aim of this lab experiment is to generate timing sequences using software delays and programming 8253 Programmable Interval Timer (PIT) chip. Equipment
M Section 27. Device Configuration Bits HIGHLIGHTS This section of the manual contains the following major topics: 27.1 Introduction...27-2 27.2 Configuration Word Bits...27-4 27.3 Program Verification/Code
Converters In most of the cases, the PIO 8255 is used for interfacing the analog to digital converters with microprocessor. We have already studied 8255 interfacing with 8086 as an I/O port, in previous
M PIC16F87X 28/40-pin 8-Bit CMOS FLASH Microcontrollers Microcontroller Core Features: High-performance RISC CPU Only 35 single word instructions to learn All single cycle instructions except for program
3.1 Bistable Element Let us look at the inverter. If you provide the inverter input with a 1, the inverter will output a 0. If you do not provide the inverter with an input (that is neither a 0 nor a 1),
Hello, and welcome to this presentation of the STM32L4 reset and clock controller. 1 The STM32L4 reset and clock controller manages system and peripheral clocks. STM32L4 devices embed three internal oscillators,
Module 12 In Module 9, 10, 11, you have been introduced to examples of combinational logic circuits whereby the outputs are entirely dependent on the current inputs. The following topics will be on sequential
Hello and welcome to this Renesas Interactive course, that provides an overview of the Clock Generator found on RL78 MCUs. 1 This course provides an introduction to the RL78 Clock Generator. Our objectives