








Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Prepare-se para as provas
Estude fácil! Tem muito documento disponível na Docsity
Prepare-se para as provas com trabalhos de outros alunos como você, aqui na Docsity
Encontra documentos específicos para os exames da tua universidade
Prepare-se com as videoaulas e exercícios resolvidos criados a partir da grade da sua Universidade
Responda perguntas de provas passadas e avalie sua preparação.
Ganhe pontos para baixar
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Atividade Prática01 Oscilador, IO, Interrupções Microcontrolador PIC18f2550.
Tipologia: Notas de estudo
1 / 14
Esta página não é visível na pré-visualização
Não perca as partes importantes!









© 2008 Microchip Technology Inc. DS80220J-page 1
The PIC18F2455/2550/4455/4550 parts you have received conform functionally to the Device Data Sheet (DS39632 D ), except for the anomalies described below. Any Data Sheet Clarification issues related to the PIC18F2455/2550/4455/4550 will be reported in a separate Data Sheet errata. Please check the Microchip web site for any existing issues.
The following silicon errata apply only to PIC18F2455/2550/4455/4550 devices with these Device/Revision IDs :
When performing back-to-back transmission in 9-bit mode (TX9D bit in the TXSTA register is set), an ongoing transmission’s timing can be corrupted if the TX9D bit (for the next transmis- sion) is not written immediately following the setting of TXIF. This is because any write to the TXSTA register results in a reset of the Baud Rate Generator which will effect any ongoing transmission.
Work around Load TX9D just after TXIF is set, either by polling TXIF or by writing TX9D at the beginning of the Interrupt Service Routine, or only write to TX9D when a transmission is not in progress (TRMT = 1 ).
Date Codes that pertain to this issue: All engineering and production devices.
When Timer1/Timer3 is operating in 16-bit mode and the prescale setting is not 1:1, a write to the TMR1H/TMR3H Buffer registers may lengthen the duration of the period between the increments of the timer for the period in which TMR1H/TMR3H were written.
Work around Two work arounds are available: 1) Stop Timer1/ Timer3 before writing the TMR1H/TMR3H regis- ters; 2) Write TMR1L/TMR3L immediately after writing TMR1H/TMR3H.
Date Codes that pertain to this issue: All engineering and production devices.
In Slave Transmit mode, when a transmission is initiated, the SSPBUF register may be written for up to 10 TCY before additional writes are blocked. The data transfer may be corrupted if SSPBUF is written during this time. The WCOL bit is set any time an SSPBUF write occurs during a transfer.
Work around Avoid writing SSPBUF until the data transfer is complete, indicated by the setting of the SSPIF bit (PIR1<3>). Verify the WCOL bit (SSPCON1<7>) is clear after writing SSPBUF to ensure any potential transfer in progress is not corrupted.
Date Codes that pertain to this issue: All engineering and production devices.
Part Number Device ID Revision ID PIC18F2455 0001 0010 011 0 0010 PIC18F2550 0001 0010 010 0 0010 PIC18F4455 0001 0010 001 0 0010 PIC18F4550 0001 0010 000 0 0010 The Device IDs (DEVID1 and DEVID2) are located at addresses 3FFFFEh:3FFFFFh in the device’s configuration space. They are shown in binary in the format “DEVID2 DEVID1”.
PIC18F2455/2550/4455/4550 Rev. A3 Silicon Errata
DS80220J-page 2 © 2008 Microchip Technology Inc.
If an interrupt occurs during a two-cycle instruction that modifies the STATUS, BSR or WREG register, the unmodified value of the register will be saved to the corresponding Fast Return (Shadow) register and upon a fast return from the interrupt, the unmodified value will be restored to the STATUS, BSR or WREG register. For example, if a high priority interrupt occurs during the instruction, MOVFF TEMP, WREG, the MOVFF instruction will be completed and WREG will be loaded with the value of TEMP before branching to ISR. However, the previous value of WREG will be saved to the Fast Return register during ISR branching. Upon return from the interrupt with a fast return, the previous value of WREG in the Fast Return register will be written to WREG. This results in WREG containing the value it had before execution of MOVFF TEMP, WREG. Affected instructions are: MOVFF Fs, Fd where Fd is WREG, BSR or STATUS; MOVSF Zs, Fd where Fd is WREG, BSR or STATUS; and MOVSS [Zs], [Zd] where the destination is WREG, BSR or STATUS.
Work around
ISR @ 0x CALL Foo, FAST; store current value of WREG, BSR, STATUS for a second time Foo: POP ; clears return address of Foo call : ; insert high priority ISR code here : RETFIEFAST
DS80220J-page 4 © 2008 Microchip Technology Inc.
An optimized C18 version is also provided in Example 3. This example illustrates how it reduces the instruction cycle count from 10 cycles to 3:
#pragma code high_vector_section=0x void high_vector (void) { _asm CALL high_vector_branch, 1 _endasm }
void high_vector_branch (void) { _asm POP GOTO high_isr _endasm }
#pragma interrupt high_isr void high_isr (void) { ... }
© 2008 Microchip Technology Inc. DS80220J-page 5
When monitoring a shutdown condition using a bit test on the ECCPASE bit (ECCP1AS<7>), or performing a bit operation on the ECCPASE bit, the device may produce unexpected results.
Work around Before performing a bit test or bit operation on the ECCPASE bit, copy the ECCP1AS register to the working register and perform the operation there. By avoiding these operations on the ECCPASE bit in the ECCP1AS register, the module will operate normally. In Example 4, ECCPASE bit operations are performed on the W register.
Date Codes that pertain to this issue: All engineering and production devices.
When the CCP1 auto-shutdown feature is con- figured for automatic restart by setting the PRSEN bit (ECCP1DEL<7>), the pulse terminates imme- diately in a shutdown event. In addition, the pulse may restart within the period if the shutdown condition expires. This may result in the generation of short pulses on the PWM output(s).
Work around Configure the auto-shutdown for software restart by clearing the PRSEN bit (ECCP1DEL<7>). The PWM can be re-enabled by clearing the ECCPASE bit (ECCP1AS<7>) after the shutdown condition expires.
Date Codes that pertain to this issue: All engineering and production devices.
When operating either Timer1 or Timer3 as a counter with a prescale value other than 1:1 and operating the ECCP in Compare mode with the Special Event Trigger (CCP1CON bits, CCP1M3:CCP1M0 = 1011 ), the Special Event Trigger Reset of the timer occurs as soon as there is a match between TMRxH:TMRxL and CCPR1H:CCPR1L. This differs from the PIC18F452, where the Special Event Trigger Reset of the timer occurs on the next rollover of the prescale counter after the match between TMRxH:TMRxL and CCPR1H:CCPR1L.
Work around To achieve the same timer Reset period on the PIC18F4550 family as the PIC18F452 family for a given clock source, add 1 to the value in CCPR1H:CCPR1L. In other words, if CCPR1H:CCPR1L = x for the PIC18F452, to achieve the same Reset period on the PIC18F4550 family, CCPR1H:CCPR1L = x + 1, where the prescale is 1, 2, 4 or 8 depending on the T1CKPS1:T1CKPS0 bit values. Date Codes that pertain to this issue: All engineering and production devices.
© 2008 Microchip Technology Inc. DS80220J-page 7
Each of the PORTD pins has a weak internal pull-up. A single control bit, RDPU (PORTE<7>), can turn on all the pull-ups. After the pull-up has been enabled (PORTE<7> = 1 ), any access to the PORTE register would cause the RDPU control bit to clear, except those that write a ' 1 ' to PORTE<7>.
Work around Reassert RDPU after each and every access to the PORTE register, except those that write a ‘ 1 ’ to PORTE<7>, or use external pull-ups.
Date Codes that pertain to this issue: All engineering and production devices.
The I 2 C™ slave address masking feature is not supported, therefore, SSPCON2 register bits, ADMSK<5:1>, do not exist in I 2 C Slave mode.
Work around None. Date Codes that pertain to this issue: All engineering and production devices.
In the BAUDCON register, bits RXDTP and TXCKP do not exist. BAUDCON bit 4 is defined instead as SCKP and has the following definition:
bit 4 SCKP : Synchronous Clock Polarity Select bit Asynchronous mode: Unused in this mode. Synchronous mode: 1 = Idle state for clock (CK) is a high level 0 = Idle state for clock (CK) is a low level
Work around None.
Date Codes that pertain to this issue: All engineering and production devices.
The Ping-Pong Buffer mode in which the ping-pong buffers are enabled for Endpoints 1 to 15 (UCFG<PPB1:PPB0> = 11 ) is not supported.
Work around Use other Ping-Pong Buffer modes. Date Codes that pertain to this issue: All engineering and production devices.
The MSSP configured in SPI Slave mode will generate a write collision if SSPBUF is updated and the previous SSPBUF contents have not been
Re-initializing the MSSP by clearing and setting the SSPEN (SSPCON1<5>) bit prior to rewriting SSPBUF will not prevent the error condition.
Work around Prior to updating the SSPBUF register with a new value, verify whether the previous contents were transferred by reading the BF (SSPSTAT<0>) bit. If the previous byte has not been transferred, update SSPBUF and clear the WCOL (SSPCON1<7>) bit if necessary.
Date Codes that pertain to this issue: All engineering and production devices.
In SPI mode, the SDO output may change after the inactive clock edge of the bit ‘ 0 ’ output. This may affect some SPI components that read data over 300 ns after the inactive edge of SCK.
Work around None
Date Codes that pertain to this issue: All engineering and production devices.
DS80220J-page 8 © 2008 Microchip Technology Inc.
It has been observed that following a Power-on Reset, I 2 C mode may not initialize properly by just configuring the SCL and SDA pins as either inputs or outputs. This has only been seen in a few unique system environments. A test of a statistically significant sample of pre- production systems, across the voltage and current range of the application's power supply, should indicate if a system is susceptible to this issue.
Work around Before configuring the module for I 2 C operation:
Date Codes that pertain to this issue: All engineering and production devices.
When the MSSP is configured for SPI mode, the Buffer Full bit, BF (SSPSTAT<0>), should not be polled in software to determine when the transfer is complete.
Work around Copy the SSPSTAT register into a variable and perform the bit test on the variable. In Example 5, SSPSTAT is copied into the working register where the bit test is performed.
A second option is to poll the Master Synchronous Serial Port Interrupt Flag bit, SSPIF (PIR1<3>). This bit can be polled and will set when the transfer is complete.
Date Codes that pertain to this issue: All engineering and production devices.
In rare situations, one or more extra zero bytes have been observed in a packet transmitted by the module operating in Asynchronous mode. The actual data is not lost or corrupted; only unwanted (extra) zero bytes are observed in the packet. This situation has only been observed when the contents of the transmit buffer, TXREG, are trans- ferred to the TSR during the transmission of a Stop bit. For this to occur, three things must happen in the same instruction cycle:
Work around If possible, do not use the module’s double-buffer capability. Instead, load the TXREG register when the TRMT bit (TXSTA<1>) is set, indicating the TSR is empty. If double-buffering is used and back-to-back transmission is performed, then load TXREG immediately after TXIF is set, or wait 1-bit time after TXIF is set. Both solutions prevent writing TXREG while a Stop bit is transmitted. Note that TXIF is set at the beginning of the Stop bit transmission. If transmission is intermittent, then do the following:
Date Codes that pertain to this issue:
loop_MSB:^ All engineering and production devices. MOVF SSPSTAT, W BTFSS WREG, BF BRA loop_MSB
DS80220J-page 10 © 2008 Microchip Technology Inc.
With MSSP in SPI Master mode, F OSC /64 or Timer2/2 clock rate and CKE = 0 , a write collision may occur if SSPBUF is loaded immediately after the transfer is complete. A delay may be required after the MSSP Interrupt Flag bit, SSPIF, is set or the Buffer Full bit, BF, is set, and before writing SSPBUF. If the delay is insufficiently short, a write collision may occur as indicated by the WCOL bit being set.
Work around Add a software delay of one SCK period after detecting the completed transfer and prior to updating the SSPBUF contents. Verify the WCOL bit is clear after writing SSPBUF. If the WCOL is set, clear the bit in software and rewrite the SSPBUF register.
Date Codes that pertain to this issue: All engineering and production devices.
In an I 2 C system with multiple slave nodes, an unaddressed slave may respond to bus activity when data on the bus matches its address. The first occurrence will set the BF bit. The second occurrence will set the BF and the SSPOV bits. In both situations, the SSPIF bit is not set and an interrupt will not occur. The device will vector to the Interrupt Service Routine only if the interrupt is enabled and an address match occurs.
Work around The I 2 C slave must clear the SSPOV bit after each I 2 C event to maintain normal operation.
Date Codes that pertain to this issue: All engineering and production devices.
When the SPI is using Timer2/2 as the clock source, a shorter than expected SCK pulse may occur on the first bit of the transmitted/received data (Figure 1).
Work around To avoid producing the short pulse, turn off Timer and clear the TMR2 register, load the SSPBUF with the data to transmit and then turn Timer2 back on. Refer to Example 6 for sample code.
Date Codes that pertain to this issue: All engineering and production devices.
Write SSPBUF
bit 7 = 1 bit 6 = 0 bit 5 = 1....
LOOP BTFSSPIR1, SSPIF ;Data received? ;(Xmit complete?) BRA LOOP ;No BCF PIR1, SSPIF ;Clear flag MOVFSSPBUF, W ;W = SSPBUF MOVWFRXDATA ;Save in user RAM MOVFTXDATA, W ;W = TXDATA BCF T2CON, TMR2ON;Timer2 off CLRFTMR2 ;Clear Timer MOVWFSSPBUF ;Xmit New data
© 2008 Microchip Technology Inc. DS80220J-page 11
The EUSART auto-baud feature may periodically measure the incoming baud rate incorrectly. The rate of incorrect baud-rate measurements will depend on the frequency of the incoming synchronization byte and the system clock frequency.
Work around None.
Date Codes that pertain to this issue: All engineering and production devices.
When the A/D clock source is selected as 2 TOSC or RC (when ADCS2:ADCS0 = 000 or x11), in extremely rare cases, the E IL (Integral Linearity Error) and EDL (Differential Linearity Error) may exceed the data sheet specification at codes 511 and 512 only.
Work around Select a different A/D clock source (4 TOSC, 8 TOSC, 16 TOSC, 32 TOSC , 64 TOSC) and avoid selecting the 2 TOSC or RC modes.
Date Codes that pertain to this issue: All engineering and production devices.
If either the HLVD or USB modules are enabled, clearing the SBOREN bit (RCON<6>) when the soft- ware controlled BOR feature is enabled (BOREN1:BOREN0 = 01 ) may cause a Brown-out Reset (BOR) event.
Work around Before clearing the SBOREN bit, temporarily disable the HLVD and USB modules.
Date Codes that pertain to this issue: All engineering and production devices.
When operated in I 2 C™ Master mode, the I^2 C baud rate may be somewhat slower than predicted by the following formula:
Work around If the target application is sensitive to the baud rate and requires more precision, the SSPADD value can be adjusted to compensate. If this work around is going to be used, it is recom- mended that the firmware first check the Revision ID by reading the DEVID1 value at address 3FFFFEh. Silicon revisions B6 and B7 will match the I 2 C baud rate predicted by the given formula.
Date Codes that pertain to this issue: All engineering and production devices.
I 2 C Master mode, clock
© 2008 Microchip Technology Inc. DS80220J-page 13
Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer’s risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.
Trademarks The Microchip name and logo, the Microchip logo, Accuron, dsPIC, K EE L OQ, K EE L OQ logo, MPLAB, PIC, PICmicro, PICSTART, rfPIC and SmartShunt are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. FilterLab, Linear Active Thermistor, MXDEV, MXLAB, SEEVAL, SmartSensor and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A. Analog-for-the-Digital Age, Application Maestro, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, In-Circuit Serial Programming, ICSP, ICEPIC, Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB, MPLINK, mTouch, PICkit, PICDEM, PICDEM.net, PICtail, PIC 32 logo, PowerCal, PowerInfo, PowerMate, PowerTool, REAL ICE, rfLAB, Select Mode, Total Endurance, UNI/O, WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies. © 2008, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. Printed on recycled paper.
Note the following details of the code protection feature on Microchip devices:
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Microchip received ISO/TS-16949:2002 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Company’s quality system processes and procedures are for its PIC ®^ MCUs and dsPIC ®^ DSCs, K EE LOQ ®^ code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified.
DS80220J-page 14 © 2008 Microchip Technology Inc.
Corporate Office 2355 West Chandler Blvd. Chandler, AZ 85224- Tel: 480-792- Fax: 480-792- Technical Support: http://support.microchip.com Web Address: www.microchip.com
Atlanta Duluth, GA Tel: 678-957- Fax: 678-957-
Boston Westborough, MA Tel: 774-760- Fax: 774-760-
Chicago Itasca, IL Tel: 630-285- Fax: 630-285-
Dallas Addison, TX Tel: 972-818- Fax: 972-818-
Detroit Farmington Hills, MI Tel: 248-538- Fax: 248-538-
Kokomo Kokomo, IN Tel: 765-864- Fax: 765-864-
Los Angeles Mission Viejo, CA Tel: 949-462- Fax: 949-462-
Santa Clara Santa Clara, CA Tel: 408-961- Fax: 408-961-
Toronto Mississauga, Ontario, Canada Tel: 905-673- Fax: 905-673-
Asia Pacific Office Suites 3707-14, 37th Floor Tower 6, The Gateway Harbour City, Kowloon Hong Kong Tel: 852-2401- Fax: 852-2401- Australia - Sydney Tel: 61-2-9868- Fax: 61-2-9868- China - Beijing Tel: 86-10-8528- Fax: 86-10-8528- China - Chengdu Tel: 86-28-8665- Fax: 86-28-8665- China - Hong Kong SAR Tel: 852-2401- Fax: 852-2401- China - Nanjing Tel: 86-25-8473- Fax: 86-25-8473- China - Qingdao Tel: 86-532-8502- Fax: 86-532-8502- China - Shanghai Tel: 86-21-5407- Fax: 86-21-5407- China - Shenyang Tel: 86-24-2334- Fax: 86-24-2334- China - Shenzhen Tel: 86-755-8203- Fax: 86-755-8203- China - Wuhan Tel: 86-27-5980- Fax: 86-27-5980- China - Xiamen Tel: 86-592- Fax: 86-592- China - Xian Tel: 86-29-8833- Fax: 86-29-8833- China - Zhuhai Tel: 86-756- Fax: 86-756-
India - Bangalore Tel: 91-80-4182- Fax: 91-80-4182- India - New Delhi Tel: 91-11-4160- Fax: 91-11-4160- India - Pune Tel: 91-20-2566- Fax: 91-20-2566- Japan - Yokohama Tel: 81-45-471- 6166 Fax: 81-45-471- Korea - Daegu Tel: 82-53-744- Fax: 82-53-744- Korea - Seoul Tel: 82-2-554- Fax: 82-2-558-5932 or 82-2-558- Malaysia - Kuala Lumpur Tel: 60-3-6201- Fax: 60-3-6201- Malaysia - Penang Tel: 60-4-227- Fax: 60-4-227- Philippines - Manila Tel: 63-2-634- Fax: 63-2-634- Singapore Tel: 65-6334- Fax: 65-6334- Taiwan - Hsin Chu Tel: 886-3-572- Fax: 886-3-572- Taiwan - Kaohsiung Tel: 886-7-536- Fax: 886-7-536- Taiwan - Taipei Tel: 886-2-2500- Fax: 886-2-2508- Thailand - Bangkok Tel: 66-2-694- Fax: 66-2-694-
Austria - Wels Tel: 43-7242-2244- Fax: 43-7242-2244- Denmark - Copenhagen Tel: 45-4450- Fax: 45-4485- France - Paris Tel: 33-1-69-53-63- Fax: 33-1-69-30-90- Germany - Munich Tel: 49-89-627-144- Fax: 49-89-627-144- Italy - Milan Tel: 39-0331- Fax: 39-0331- Netherlands - Drunen Tel: 31-416- Fax: 31-416- Spain - Madrid Tel: 34-91-708-08- Fax: 34-91-708-08- UK - Wokingham Tel: 44-118-921- Fax: 44-118-921-
WORLDWIDE SALES AND S ERVICE
01/02/