Ir para a página of
Manuais similares
-
Two-Way Radio
Silicon Laboratories C8051F346
282 páginas 2.13 mb -
Two-Way Radio
Silicon Laboratories C8051F344
282 páginas 2.13 mb -
Two-Way Radio
Silicon Laboratories C8051F340
282 páginas 2.13 mb -
Two-Way Radio
Silicon Laboratories C8051F343
282 páginas 2.13 mb -
Two-Way Radio
Silicon Laboratories C8051F347
282 páginas 2.13 mb -
Two-Way Radio
Silicon Laboratories C8051F342
282 páginas 2.13 mb -
Two-Way Radio
Silicon Laboratories C8051F341
282 páginas 2.13 mb -
Two-Way Radio
Silicon Laboratories C8051F345
282 páginas 2.13 mb
Bom manual de uso
As regras impõem ao revendedor a obrigação de fornecer ao comprador o manual com o produto Silicon Laboratories C8051F345. A falta de manual ou informações incorretas fornecidas ao consumidor são a base de uma queixa por não conformidade do produto com o contrato. De acordo com a lei, pode anexar o manual em uma outra forma de que em papel, o que é frequentemente utilizado, anexando uma forma gráfica ou manual electrónicoSilicon Laboratories C8051F345 vídeos instrutivos para os usuários. A condição é uma forma legível e compreensível.
O que é a instrução?
A palavra vem do latim "Instructio" ou instruir. Portanto, no manual Silicon Laboratories C8051F345 você pode encontrar uma descrição das fases do processo. O objetivo do manual é instruir, facilitar o arranque, a utilização do equipamento ou a execução de determinadas tarefas. O manual é uma coleção de informações sobre o objeto / serviço, um guia.
Infelizmente, pequenos usuários tomam o tempo para ler o manual Silicon Laboratories C8051F345, e um bom manual não só permite conhecer uma série de funcionalidades adicionais do dispositivo, mas evita a formação da maioria das falhas.
Então, o que deve conter o manual perfeito?
Primeiro, o manual Silicon Laboratories C8051F345 deve conte:
- dados técnicos do dispositivo Silicon Laboratories C8051F345
- nome do fabricante e ano de fabricação do dispositivo Silicon Laboratories C8051F345
- instruções de utilização, regulação e manutenção do dispositivo Silicon Laboratories C8051F345
- sinais de segurança e certificados que comprovam a conformidade com as normas pertinentes
Por que você não ler manuais?
Normalmente, isso é devido à falta de tempo e à certeza quanto à funcionalidade específica do dispositivo adquirido. Infelizmente, a mesma ligação e o arranque Silicon Laboratories C8051F345 não são suficientes. O manual contém uma série de orientações sobre funcionalidades específicas, a segurança, os métodos de manutenção (mesmo sobre produtos que devem ser usados), possíveis defeitos Silicon Laboratories C8051F345 e formas de resolver problemas comuns durante o uso. No final, no manual podemos encontrar as coordenadas do serviço Silicon Laboratories na ausência da eficácia das soluções propostas. Atualmente, muito apreciados são manuais na forma de animações interessantes e vídeos de instrução que de uma forma melhor do que o o folheto falam ao usuário. Este tipo de manual é a chance que o usuário percorrer todo o vídeo instrutivo, sem ignorar especificações e descrições técnicas complicadas Silicon Laboratories C8051F345, como para a versão papel.
Por que ler manuais?
Primeiro de tudo, contem a resposta sobre a construção, as possibilidades do dispositivo Silicon Laboratories C8051F345, uso dos acessórios individuais e uma gama de informações para desfrutar plenamente todos os recursos e facilidades.
Após a compra bem sucedida de um equipamento / dispositivo, é bom ter um momento para se familiarizar com cada parte do manual Silicon Laboratories C8051F345. Atualmente, são cuidadosamente preparados e traduzidos para sejam não só compreensíveis para os usuários, mas para cumprir a sua função básica de informação
Índice do manual
-
Página 1
Full Speed USB Flash MCU Family C8051F340/1/2/3/4/5/6/7 Rev. 0.5 1/06 Copyright © 2006 by Silicon Laboratories C8051F34x This information applies to a product under dev elopment. Its characteristics and specifications are subject to change without n otice. Analog Peripherals - 10-Bit ADC • Up to 200 ksps • Built-in analog multiplexer with sing[...]
-
Página 2
C8051F340/1/2/3/4/5/6/7 2 Rev. 0.5 N OTES :[...]
-
Página 3
Rev. 0.5 3 C8051F340/1/2/3/4/5/6/7 T able Of Content s 1. System Overview ............ ................................................. ............................ ........... 17 1.1. CIP-51™ Microcontroller Core .. ............................................................. ........... 21 1.1.1. Fully 8051 Compatible...... ..................[...]
-
Página 4
C8051F340/1/2/3/4/5/6/7 4 Rev. 0.5 9.3. Interrupt Handler ................ .................................................................. ............. 87 9.3.1. MCU Interrupt Sources a nd Vectors ............ ................................. ........... 87 9.3.2. External Interrupts .......... ................................ ................[...]
-
Página 5
Rev. 0.5 5 C8051F340/1/2/3/4/5/6/7 14. Oscillators ................ ................ .................................................................. ........... 135 14.1.Programmable Internal Hi gh-Frequency (H-F) Oscillator ... ................. ........... 136 14.1.1.Internal H-F Oscillator Suspend Mode ........... ............................[...]
-
Página 6
C8051F340/1/2/3/4/5/6/7 6 Rev. 0.5 17.3.SMBus Operation ....... ................ ........................................................... ......... 194 17.3.1.Arbitration ......... ................................................. ............................ ......... 195 17.3.2.Clock Low Extension ........ .....................................[...]
-
Página 7
Rev. 0.5 7 C8051F340/1/2/3/4/5/6/7 21.2.Timer 2 ............. ................................ .................................................. ........... 251 21.2.1.16-bit Timer with Auto-Rel oad............... ................................................. 251 21.2.2.8-bit Timers with Auto-Rel oad ............... ...........................[...]
-
Página 8
C8051F340/1/2/3/4/5/6/7 8 Rev. 0.5 N OTES :[...]
-
Página 9
Rev. 0.5 9 C8051F340/1/2/3/4/5/6/7 List of Figures and T ables 1. System Overview Table 1.1. Product Selection Guide . ............... ............................................. ........... 18 Figure 1.1. C8051F340/1/4/5 Blo ck Diagram ............... ................................. ........... 19 Figure 1.2. C8051F342/3/6/7 Blo ck Diagram ...[...]
-
Página 10
C8051F340/1/2/3/4/5/6/7 10 Rev. 0.5 8. Voltage Regulator (REG0) Table 8.1. Voltage Regulator El ectrical Specificati ons .............. ................. ............. 69 Figure 8.1. REG0 Configuratio n: USB Bus-Powered ... ................................. ........... 70 Figure 8.2. REG0 Configuratio n: USB Self-Powered ............ ..............[...]
-
Página 11
Rev. 0.5 11 C8051F340/1/2/3/4/5/6/7 Figure 16.2. USB0 Regi ster Access Scheme ........ ................................................. 166 Table 16.2. USB0 C ontroller Registers .......... ............................................... ......... 169 Figure 16.3. USB FIFO Al location ............. .................................................[...]
-
Página 12
C8051F340/1/2/3/4/5/6/7 12 Rev. 0.5 Figure 20.10. SPI Slave Timing (C KPHA = 0) .............. ................................. ......... 240 Figure 20.11. SPI Slave Timing (C KPHA = 1) .............. ................................. ......... 240 Table 20.1. SPI Slave Timing Para meters ............ ............................ .................[...]
-
Página 13
Rev. 0.5 13 C8051F340/1/2/3/4/5/6/7 List of Registers SFR Definition 5.1. AMX0P: AMUX0 Positive Channel Select . . . . . . . . . . . . . . . . . . . 48 SFR Definition 5.2. AMX0N: AMUX 0 Negative Channel Select . . . . . . . . . . . . . . . . . . 49 SFR Definition 5.3. ADC0CF: ADC0 C onfiguration . . . . . . . . . . . . . . . . . . . . . . . . . . .[...]
-
Página 14
C8051F340/1/2/3/4/5/6/7 14 Rev. 0.5 SFR Definition 14.3. OSCLCN: Inter nal L-F Oscillator Control . . . . . . . . . . . . . . . . . . 138 SFR Definition 14.4. OSCXCN: External Oscillator C ontrol . . . . . . . . . . . . . . . . . . . . 141 SFR Definition 14.5. CLKMUL : Clock Multiplier Control . . . . . . . . . . . . . . . . . . . . . . . 142 SFR D[...]
-
Página 15
Rev. 0.5 15 C8051F340/1/2/3/4/5/6/7 USB Register Definiti on 16.20. EINCSRH: USB0 IN Endpoi nt Control High Byte . . . 187 USB Register Defini tion 16.21. EOUTCSRL: USB0 OUT Endpoint Control Low Byte 189 USB Register Definition 16.22. EOUTCSRH: USB0 OUT Endpoint Control High Byte 190 USB Register Definiti on 16.23. EOUTCNTL: USB0 OUT E ndpoint Coun[...]
-
Página 16
C8051F340/1/2/3/4/5/6/7 16 Rev. 0.5 C2 Register Definition 23.2. DEVICE ID: C2 Device ID . . . . . . . . . . . . . . . . . . . . . . . . 279 C2 Register Definition 23.3. REVID: C2 Revision ID . . . . . . . . . . . . . . . . . . . . . . . . . 280 C2 Register Definition 23.4. FP CTL: C2 Flash Programming Cont rol . . . . . . . . . . . . 280 C2 Regist[...]
-
Página 17
Rev. 0.5 17 C8051F340/1/2/3/4/5/6/7 1. System Overview C8051F340/1/2/3/4/5/6/7 devices are fu lly integrated m ixed-sign al System-on-a-Chip MCUs. Highlighted features are listed below . Refer to Ta b l e 1.1 for specific product feature selection. • High-speed pipelined 8051 -compatibl e microcontroller core (up to 48 MIPS) • In-system, full-s[...]
-
Página 18
C8051F340/1/2/3/4/5/6/7 18 Rev. 0.5 Ta b l e 1.1. Product Selection Guide Ordering Pa rt Number MIPS (Peak) Flash Memory (Bytes) RAM Calibrated Internal Oscillator Low Frequency Oscillator USB with 1k Endpoint RAM Supply V oltage Regulator SMBus/I2C Enhanced SPI UART s T imers ( 16-bit) Programmabl e Counter Array Digital Port I/Os External Memory [...]
-
Página 19
Rev. 0.5 19 C8051F340/1/2/3/4/5/6/7 Figure 1.1. C8051F340/1/4/5 Block Diagram Analog Peripherals 10-bit 200ksps ADC A M U X Temp Sensor 2 Comparators + - VREF VDD CP0 VDD + - CP1 VREF Debug / Programmi ng Hardware Port 0 Drivers P0.0 AIN0 - A IN19 Port I/O Configuratio n Digital Periph erals Priority Crossbar Decoder Crossbar C ontrol Power-On Rese[...]
-
Página 20
C8051F340/1/2/3/4/5/6/7 20 Rev. 0.5 Figure 1.2. C8051F342/3/6/7 Block Diagram Analog Peripherals 10-bit 200 ksps ADC A M U X Temp Sensor 2 Comparators + - VREF VDD CP0 VDD + - CP1 VREF Debug / Programming Hardware Port 0 Drivers P0.0 AIN0 - AIN20 Port I/ O Configuration Digital Peripheral s Prior ity Crossbar Decoder Crossbar Control Power-On Reset[...]
-
Página 21
Rev. 0.5 21 C8051F340/1/2/3/4/5/6/7 1.1. CIP-51™ Microcontroller Core 1.1.1. Fully 8051 Comp atible The C8051F340/1 /2/3/4/5/6/7 family utilizes Silicon Labs' proprietary CIP- 51 microcontroller core. The CIP-51 is fully compatible with the MCS-51™ instruction s et; standard 803x/8 05x assemble rs and com pil - ers can be used to develop s[...]
-
Página 22
C8051F340/1/2/3/4/5/6/7 22 Rev. 0.5 Figure 1.3. On-Chi p Clock and Reset PCA WDT Missing Clock Detector (one- shot) Software Reset (SWRSF ) System Reset Reset Funnel Px.x Px.x EN System Clock CIP-51 Microcontroller Core Extended I nterrupt Handler Clock Select EN WDT Enable MCD Enable Errant FLASH Operation + - Comparator 0 C0RSE F /RST (wired-OR )[...]
-
Página 23
Rev. 0.5 23 C8051F340/1/2/3/4/5/6/7 1.2. On-Chip Memory The CIP-51 has a sta ndard 8051 progr am and dat a addr ess configuration. It in cludes 256 bytes of data RAM, with the upper 128 bytes du al-mappe d. Indirect addressing accesses the up per 128 bytes of gene ral purpose RAM, and direct addr essing accesses the 128 byte SFR addre ss space . Th[...]
-
Página 24
C8051F340/1/2/3/4/5/6/7 24 Rev. 0.5 1.3. Universal Serial Bus Controller The Universal Serial Bus Controller (USB0) is a USB 2.0 compliant Full or Low S peed function with inte - grated transceiver and endp oint FIFO RAM. A total of ei ght endpo int pipes are a vailable: a bi-directional control endpoin t (Endpoint0) an d three pairs of IN/OUT en d[...]
-
Página 25
Rev. 0.5 25 C8051F340/1/2/3/4/5/6/7 1.4. V oltage Regulator C8051F340/1/2/3/4/5/6/7 devices include a voltage regulator (REG0). When en abled, the REG0 output appears on the V DD pin, and can also be used to power other e xternal devices. REG0 can be e nabled/dis - abled by software. 1.5. On-Chip Debug Circuitry The C8051F340/1/2/3/4/ 5/6/7 devices[...]
-
Página 26
C8051F340/1/2/3/4/5/6/7 26 Rev. 0.5 1.6. Programmable Digit al I/O and Crossbar C8051F340/1/4/5 devices include 40 I/O pins (five byte-wide Ports); C8 051F342/3/6/7 devices inclu de 25 I/O pins (three byte-wide Port s, and a 1-bi t-wide Port ). The C8051F 340/1/2/3/4/5/6/7 Port s behave like typ - ical 8051 Ports with a few enhancement s. Each Port[...]
-
Página 27
Rev. 0.5 27 C8051F340/1/2/3/4/5/6/7 1.7. Serial Port s The C8051F340/1/2/3/4/ 5/6/7 Family includes an SMBus/I2C inter face, full-duplex UART s, and an Enhanced SPI inte rface. Each of the serial buses is fully implemented in hardwa re and makes extensive use of the CIP-51's in terrupts, thus requiring very little CPU intervention. 1.8. Progra[...]
-
Página 28
C8051F340/1/2/3/4/5/6/7 28 Rev. 0.5 1.9. 10-Bit Analog to Digit al Converter The C8051F340/1/2/3/4/5 /6/7 devices include an on-chip 10-bit SAR ADC with a true di f fe rential inpu t mul - tiplexer . With a maximum throughput of 200 ksp s, the ADC of fers true 10-b it linearity with an INL o f ±1LSB. The ADC system includes a configurable analog m[...]
-
Página 29
Rev. 0.5 29 C8051F340/1/2/3/4/5/6/7 1.10. Comp arators C8051F340/1/2/3/4/5/6/7 devices include two on-chip volt age comp arators that are enabled/disabled and configured via user soft ware. Port I/O pins may be co nfigured as comparator inpu ts via a selection mux. T wo comparator output s may be routed to a Port pin if desired: a latched out put a[...]
-
Página 30
C8051F340/1/2/3/4/5/6/7 30 Rev. 0.5 2. Absolute Maximum Ratings Ta b l e 2.1. Absolute Maximum Ratings* Parameter Conditions Min T yp Max Unit s Ambient temperature under bias –55 125 °C S to rage T emp erature –65 150 °C V oltage on any Port I/O Pin or /RST with respect to GND –0.3 5.8 V V oltage on V DD with respect to GND –0.3 4.2 V Ma[...]
-
Página 31
Rev. 0.5 31 C8051F340/1/2/3/4/5/6/7 3. Global DC Electrical Characteristics Other electric al characteristics tables ar e found in the dat a sheet section correspond ing to the associated peripherals. For more information o n electrical characte ristics for a specific perip heral, refer to the p age indicated in Ta b l e 3.2 . Ta b l e 3.1. Global [...]
-
Página 32
C8051F340/1/2/3/4/5/6/7 32 Rev. 0.5 Ta b l e 3.2. Index to Electrical Characteristics T ables Ta b l e T i t l e Page No. ADC0 Electrical Characteristics 56 V oltage Refe re nce Electr ical Characteristics 58 Comparator Electrical Characteristics 68 V oltage Regulator Electrical S pecifications 69 Reset Electrical Characteristics 107 Flash Electric[...]
-
Página 33
Rev. 0.5 33 C8051F340/1/2/3/4/5/6/7 4. Pinout and Package Definitions Ta b l e 4.1. Pin Definitions for the C8051F340/1/2/3/4/5/6/7 Name Pin Numbers Ty p e Description 48-pin 32-pin V DD 10 6 Power In Power Out 2.7–3.6 V Power Sup ply V oltage Input. 3.3 V V oltage Regu lator Output. See Section 8 . GND 7 3 Ground. /RST/ C2CK 13 9 D I/O D I/O Dev[...]
-
Página 34
C8051F340/1/2/3/4/5/6/7 34 Rev. 0.5 P1.0 46 26 D I/O or A In Port 1.0. See Section 15 for a complete descrip t ion of Port 1. P1.1 45 25 D I/O or A In Port 1.1. P1.2 44 24 D I/O or A In Port 1.2. P1.3 43 23 D I/O or A In Port 1.3. P1.4 42 22 D I/O or A In Port 1.4. P1.5 41 21 D I/O or A In Port 1.5. P1.6 40 20 D I/O or A In Port 1.6. P1.7 39 19 D I[...]
-
Página 35
Rev. 0.5 35 C8051F340/1/2/3/4/5/6/7 P3.3 27 - D I/O or A In Port 3.3. P3.4 26 - D I/O or A In Port 3.4. P3.5 25 - D I/O or A In Port 3.5. P3.6 24 - D I/O or A In Port 3.6. P3.7 23 - D I/O or A In Port 3.7. P4.0 22 - D I/O or A In Port 4.0. See Section 15 for a complete descrip t ion of Port 4. P4.1 21 - D I/O or A In Port 4.1. P4.2 20 - D I/O or A [...]
-
Página 36
C8051F340/1/2/3/4/5/6/7 36 Rev. 0.5 Figure 4.1. TQFP-48 Pi nout Diagram (T op V iew) 1 2 3 4 5 6 7 8 9 10 11 12 36 35 34 33 32 31 30 29 28 27 26 25 48 47 46 45 44 43 42 41 40 39 38 37 VBUS P2.2 P2.0 P1.7 P1.6 P1.2 P2.4 P2.3 P3.5 P3.4 P3.2 P3.1 P2.1 P0.6 P3.3 P0.7 P0.2 D- REGIN P0.3 P3.0 P1.4 P1.5 P0.5 P1.1 P1.0 P0.4 P1.3 13 14 15 16 17 18 19 20 21 [...]
-
Página 37
Rev. 0.5 37 C8051F340/1/2/3/4/5/6/7 Figure 4.2. TQFP-48 Package Diagram E E1 D D1 48 1 A1 e b PIN 1 IDENTIFIER A2 A T able 4.2. TQFP-48 Package Dimensions MM MIN TYP MAX A- - 1 . 2 0 A1 0.05 - 0.15 A2 0.95 1.00 1.05 b 0.17 0.22 0.27 D- 9 . 0 0 - D1 - 7.00 - e- 0 . 5 0 - E- 9 . 0 0 - E1 - 7.00 -[...]
-
Página 38
C8051F340/1/2/3/4/5/6/7 38 Rev. 0.5 Figure 4.3. LQFP-32 Pi nout Diagram (T op V iew) 1 VBUS P1.2 P1.7 P1.4 P1.3 P1.5 D+ D- GND P0.1 P0.0 P2.0 P2.1 2 3 4 5 6 7 8 24 23 22 21 20 19 18 17 9 10 11 12 13 14 15 16 32 31 30 29 28 27 26 25 P1.6 C8051F342/3/6/7 Top View VDD REGI N /RST / C2C K P3.0 / C2D P2.7 P2.6 P2.5 P2.4 P2.3 P2.2 P1.1 P1.0 P0.7 P0.6 P0.[...]
-
Página 39
Rev. 0.5 39 C8051F340/1/2/3/4/5/6/7 Figure 4.4. LQFP-32 Package Diagram PIN 1 IDENTIFIER A1 e b 1 32 E1 D1 D E A2 A T able 4.3. LQFP-32 Package Dimensions MM MIN TYP MAX A- - 1 . 6 0 A1 0.05 - 0.15 A2 1.35 1.40 1.45 b 0.30 0.37 0.45 D- 9 . 0 0 - D1 - 7.00 - e- 0 . 8 0 - E- 9 . 0 0 - E1 - 7.00 -[...]
-
Página 40
C8051F340/1/2/3/4/5/6/7 40 Rev. 0.5 N OTES :[...]
-
Página 41
Rev. 0.5 41 C8051F340/1/2/3/4/5/6/7 5. 10-Bit ADC (ADC0) The ADC0 subsystem for the C8051F340/1/2/3/4/5/6/7 c onsists of two analog multip lexers (referred to col - lectively as AMUX0), and a 20 0 ksps, 10-bit successive-approxima tion-regist er ADC with integr ated track-and-hold and programm able window detector . The AMUX0 , data con version mod[...]
-
Página 42
C8051F340/1/2/3/4/5/6/7 42 Rev. 0.5 5.1. Analog Multiplexer AMUX0 selects the po sitive and negative input s to the ADC. The positive input (AIN+) can be conn ected to individual Port pins, the o n-chip temperature sensor , or the positive power supply (V DD ) . The negative input (AIN-) can be connected to in dividual Port pins, VREF , or GND. Whe[...]
-
Página 43
Rev. 0.5 43 C8051F340/1/2/3/4/5/6/7 5.2. T emperature Sensor The temperature sensor tra nsfer function is shown in Figure 5.2. The outp ut volt age (V TEMP ) is the positive ADC input when the temperature se nsor is selected by bits AMX0P4-0 in register AMX0P . V alues for the Offset and Slope p arameters can be found in Ta b l e 5.1 . Figure 5.2. [...]
-
Página 44
C8051F340/1/2/3/4/5/6/7 44 Rev. 0.5 Figure 5.3. T emperature Sensor Error with 1- Poin t Calibration (VREF = 2.40 V) -40.00 -20.00 0.0 0 20.0 0 40.0 0 60.0 0 80.0 0 Temperature (degrees C) Error (degrees C) -5.00 -4.00 -3.00 -2.00 -1.00 0.0 0 1.0 0 2.0 0 3.0 0 4.0 0 5.0 0 -5.00 -4.00 -3.00 -2.00 -1.00 0.0 0 1.0 0 2.0 0 3.0 0 4.0 0 5.0 0[...]
-
Página 45
Rev. 0.5 45 C8051F340/1/2/3/4/5/6/7 5.3. Modes of Operation ADC0 has a maximum conversion speed of 200 ksp s. The ADC0 con version clock is a divided ve rsion of the system clock, determined by the AD0SC bits in the ADC0CF register (system clock divided by (AD0SC + 1) for 0 ≤ AD0SC ≤ 31). 5.3.1. St arting a Conversion A conversion ca n be in it[...]
-
Página 46
C8051F340/1/2/3/4/5/6/7 46 Rev. 0.5 5.3.2. T racking Modes The AD0TM bit in r egister ADC0CN controls the ADC0 track-and -hold mode. In its d efault state, the ADC0 input is continuously tracked, except when a conversi on is in progress. When the AD0TM bit is logic 1, ADC0 operates in low-powe r track-and-hold mode. In this mode, each conversion is[...]
-
Página 47
Rev. 0.5 47 C8051F340/1/2/3/4/5/6/7 5.3.3. Settling Tim e Requirement s When the ADC0 input configuration is changed (i.e., a differe nt AMUX0 selection is made), a minimum tracking time is required befo re an accurate conversion c an be performed . This tracking time is determined by the AMUX0 resistance, the ADC0 sampling capacita nce, any extern[...]
-
Página 48
C8051F340/1/2/3/4/5/6/7 48 Rev. 0.5 SFR Definition 5.1. AMX0P: AMUX0 Positive Channel Select Bits7–5: UNUSED. Read = 000b; Write = don’t care . Bits4–0: AMX0P4–0: AMUX0 Positive Input Selection R R R R/W R/W R/W R/W R/W Reset V alue - - - A MX0P4 AMX0P3 AMX0P2 AMX0P1 AMX0P 0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xBB[...]
-
Página 49
Rev. 0.5 49 C8051F340/1/2/3/4/5/6/7 SFR Definition 5.2. AMX0N: AMUX0 Negative Channel Select Bits7–5: UNUSED. Read = 000b; Write = don’t care. Bits4–0: AMX0N4–0: AMUX0 Negative Input Selection. Note that when GND is selected as t he Nega tive Input, ADC0 operates in Sing le-ended mode. For all other Negative Input se lect ions, ADC0 operate[...]
-
Página 50
C8051F340/1/2/3/4/5/6/7 50 Rev. 0.5 SFR Definition 5.3. ADC0CF: ADC0 Configuration SFR Definition 5.4. ADC0H: ADC0 Dat a W ord MSB SFR Definition 5.5. ADC0L: ADC0 Dat a Word LSB Bits7–3: AD0SC4–0: ADC0 SAR Co nv ersion Clock Per iod Bits. SAR Conversion clock is derived from syst em clock by the following equation, where AD0SC refers to the 5-b[...]
-
Página 51
Rev. 0.5 51 C8051F340/1/2/3/4/5/6/7 SFR Definition 5.6. ADC0CN: ADC0 Control Bit7: AD0EN: ADC0 Enable Bit. 0: ADC0 Disabled. ADC0 is in low-power shutdown. 1: ADC0 Enabled. ADC0 is active and ready for data conver sions. Bit6: AD0TM: ADC0 Tr ack Mode Bit. 0: Normal T rack Mode: When ADC0 is enabled, tracking is continuo us unless a conversion is in[...]
-
Página 52
C8051F340/1/2/3/4/5/6/7 52 Rev. 0.5 5.4. Programmable Window Detector The ADC Programmable Win dow Detector continuo us ly compares the ADC0 conver sion result s to user-prog rammed limits, and no tifies the syste m when a desired condition is detected. This is especially effective in an interrupt-driven system, saving co de sp ace and CPU bandwid [...]
-
Página 53
Rev. 0.5 53 C8051F340/1/2/3/4/5/6/7 SFR Definition 5.9. ADC0L T H: ADC0 Less-Than Dat a High Byte SFR Definition 5.10. ADC0L TL: ADC0 Less-Than Dat a Low Byte Bits7–0: High byte of ADC0 Less-Than Dat a W or d. R/W R/W R/W R/W R/W R/W R/W R/W Reset V alue 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xC6 Bits7–0: Low byte of ADC[...]
-
Página 54
C8051F340/1/2/3/4/5/6/7 54 Rev. 0.5 5.4.1. Window Detector In Single-Ended Mode Figure 5.6 shows two ex ample wind ow comparisons fo r right-justified, si ngle-ended dat a, with ADC0L TH:ADC0L TL = 0x0080 (128 d) and ADC0G TH: ADC0G TL = 0x0040 (64d). In single-end ed mode, the input volt age can range from ‘0’ to VREF x (1023/ 1024) with respe[...]
-
Página 55
Rev. 0.5 55 C8051F340/1/2/3/4/5/6/7 5.4.2. Window Detector In Differential Mode Figure 5.8 shows two examp le window compa risons for ri ght-justified, dif ferentia l data, with ADC0L TH:ADC0L TL = 0x0040 (+64d) and ADC0G TH:ADC0G TH = 0xFFFF (-1d). In diff erential mode, the measurable volt age between the input pins is between -VREF a nd VREF*(51[...]
-
Página 56
C8051F340/1/2/3/4/5/6/7 56 Rev. 0.5 Ta b l e 5.1. ADC0 Electrical Characteristics V DD = 3.0 V , VREF = 2.40 V , –40 to +85 °C u nless othe rwise specif ied Paramete r Conditions Min Ty p Max Units DC Accuracy Resolution 10 bits Integral Nonlinearity ±0.5 ±1 LSB Differential Nonlinearity Guarante ed Monotonic ±0.5 ±1 LSB Offset Error 0 LSB F[...]
-
Página 57
Rev. 0.5 57 C8051F340/1/2/3/4/5/6/7 6. V olt age Reference The V oltage refere nce MUX on C8051F340/1/2 /3/4/5/6/7 devices is configurable to u se an externally con - nected volt age reference, the on-ch ip reference volt age genera tor , or the power supply volt age V DD (se e Figure 6.1 ). The REFSL bit in the Refere nce Control regist er (REF0CN[...]
-
Página 58
C8051F340/1/2/3/4/5/6/7 58 Rev. 0.5 SFR Definition 6.1. REF0CN: Reference Control Ta b l e 6.1. V oltage Reference Electrical Characteristics V DD = 3.0 V ; –40 to +85 °C Unless Oth erwise S pecified Parameter Conditions Min Ty p Max Unit s Internal Reference (REFBE = 1) Output V olt age 25 °C ambient 2.38 2.44 2.50 V VREF Short-Circuit Curr en[...]
-
Página 59
Rev. 0.5 59 C8051F340/1/2/3/4/5/6/7 7. Comp arators C8051F340/1/2/3/4/5/6/7 devices in clude two o n-chip progr ammable voltage Comparator s. A block dia - gram of the comp arators is sh own in Figure 7.1 , wher e “n” is the compa rator number (0 or 1). The two Comparators opera te identically with the followin g exce ptions: (1) Their input se[...]
-
Página 60
C8051F340/1/2/3/4/5/6/7 60 Rev. 0.5 Figure 7.1. Comp arator Functional Block Diagram Comparator outp uts can be polled in software, used as an interrupt so urce, and/or ro uted to a Port pin . When routed to a Port pin, Compar ator output s are availa ble asynchronous or syn chronous to the system clock; the asynchronous output is available even in[...]
-
Página 61
Rev. 0.5 61 C8051F340/1/2/3/4/5/6/7 Figure 7.2. Compar ator Hysteresis Plot Comparator hyste resis is prog rammed us ing Bits3-0 in the Comparator Contro l Register CPTnCN (shown in SFR Definition 7.1 and SFR Definition 7.4 ). The amount of n egative hyst eresis voltage is determined b y the settings of the CPnHYN bits . As shown in Figure 7.2 , va[...]
-
Página 62
C8051F340/1/2/3/4/5/6/7 62 Rev. 0.5 SFR Definition 7.1. CPT0CN: Comp arator0 Control Bit7: CP0EN: Comparator0 En ab le Bit. 0: Comparator 0 Disabled. 1: Comparator 0 Enabled. Bit6: CP0OUT : Comparator 0 Ou tp ut S tate Flag. 0: V o ltage on CP0+ < C P0–. 1: V o ltage on CP0+ > C P0–. Bit5: CP0RIF: Comparator 0 Rising -Ed ge Flag. 0: No Co[...]
-
Página 63
Rev. 0.5 63 C8051F340/1/2/3/4/5/6/7 SFR Definition 7.2. CPT0MX: Comparator0 MUX Selection Bit7: U NUSED. Read = 0b, Write = don’t care . Bits6–4: CMX0N2–CMX0N0: Comp arator0 Negative Input MUX Sele ct. These bits selec t which Port p in is used as the Comparator0 negative inp ut. Bit3: UNUSED. Re ad = 0b, Write = don’t care . Bits2–0: C M[...]
-
Página 64
C8051F340/1/2/3/4/5/6/7 64 Rev. 0.5 SFR Definiti on 7.3. CPT0MD: Comp arator 0 Mode Selection Bits7–6: UNUSED. Read = 00b. Write = don’t care. Bit5: CP0RIE: Comparator0 Rising-Edge Interrupt Enable. 0: Comparator 0 rising-edge interru pt disabled. 1: Comparator 0 rising-edge interru pt enabled. Bit4: CP0FIE: Comparator0 Falling-Edge Interrupt E[...]
-
Página 65
Rev. 0.5 65 C8051F340/1/2/3/4/5/6/7 SFR Definition 7.4. CPT1CN: Comp arator1 Control Bit7: CP1EN: Comparator1 En ab le Bit. 0: Comparator 1 Disabled. 1: Comparator 1 Enabled. Bit6: CP1OUT : Comparator 1 Ou tp ut S tate Flag. 0: V o ltage on CP1+ < C P1–. 1: V o ltage on CP1+ > C P1–. Bit5: CP1RIF: Comparator 1 Rising -Ed ge Flag. 0: No Co[...]
-
Página 66
C8051F340/1/2/3/4/5/6/7 66 Rev. 0.5 SFR Definition 7.5. CPT1MX: Comparator1 MUX Selection Bit7: UNUSED. Read = 0b , Write = don’t care. Bits6–4: CMX1N2–CMX1N0: Comp arat or1 Nega tive Input MUX Select. These bit s select which Port pin is us ed as the Comp arator1 negative inp ut. Bit3: UNUSED. Read = 0b , Write = don’t car e. Bits2–0: CM[...]
-
Página 67
Rev. 0.5 67 C8051F340/1/2/3/4/5/6/7 SFR Definiti on 7.6. CPT1MD: Comp arator 1 Mode Selection Bits7–6: UNUSED. Read = 00b, Write = don’t care. Bit5: CP1RIE: Comparator1 Rising-Edge Interrupt Enable. 0: Comparator 1 rising-edge interru pt disabled. 1: Comparator 1 rising-edge interru pt enabled. Bit4: CP1FIE: Comparator1 Falling-Edge Interrupt E[...]
-
Página 68
C8051F340/1/2/3/4/5/6/7 68 Rev. 0.5 Ta b l e 7.1. Comparator Electri cal Characteristics V DD = 3.0 V , –40 to +85 °C unless other w ise noted. All specifications apply to both Comp arator0 and Comp arator1 unless otherwise noted. Paramete r Conditions Min Ty p Max Units Response T ime: Mode 0, Vcm* = 1.5 V CP0+ – CP0– = 100 mV 100 ns CP0+ ?[...]
-
Página 69
Rev. 0.5 69 C8051F340/1/2/3/4/5/6/7 8. V oltage Regulator (REG0) C8051F340/1/2/3/4/5/6/7 devices include a voltage regulator (REG0). When en abled, the REG0 output appears on the V DD pin and can be used to powe r external d evices. REG0 can be en abled/disabled by software using bit REGEN in register R EG0CN. See Ta b l e 8.1 for REG0 electrical c[...]
-
Página 70
C8051F340/1/2/3/4/5/6/7 70 Rev. 0.5 Figure 8.1. REG0 Confi guration: USB Bus-Powered Figure 8.2. REG0 Configur ation: USB Self-Powered Voltage Regulator (REG 0) 5 V In 3 V Out VBUS Sens e REGIN VBUS From VBUS To 3 V Powe r Net Dev i ce Powe r Net VDD Voltage Regu lator (REG0) 5 V In 3 V O ut VBUS Sens e REGI N VBUS To 3 V Power Net De vi ce Powe r [...]
-
Página 71
Rev. 0.5 71 C8051F340/1/2/3/4/5/6/7 Figure 8.3. REG0 Conf iguration: USB Self-Pow ered, Regulator Disabled Figure 8.4. REG0 Configur ation: No USB Connection Voltage Regu lator (REG0) 5 V In 3 V O ut VBUS Sens e REGI N VBUS From 3 V Power Net De vi ce Powe r Net VDD From VBUS Voltage Regulator (REG 0) 5 V In 3 V Out VBUS Sens e REGIN VBUS To 3 V Po[...]
-
Página 72
C8051F340/1/2/3/4/5/6/7 72 Rev. 0.5 SFR Definition 8.1. REG0CN: V olt age Regulator Control Bit7: REGDIS: V oltag e Regulator Disable. 0: V o ltage Regulator Ena bled. 1: V o ltage Regulator Disab led. Bit6: VBST A T : VBUS Signal S tatus. 0: VBUS signal currently absent (device not att ached to USB network) . 1: VBUS signal currently present (devi[...]
-
Página 73
Rev. 0.5 73 C8051F340/1/2/3/4/5/6/7 9. CIP-51 Microcontroller The MCU system controller core is the CIP-51 microcon troller . The CIP-51 is fully compatible with the MCS-51™ instruction set; st andard 803x/805x a ssemble rs and compilers can be used to develop sof t - ware. The MCU family has a super set of all the peripherals included with a st [...]
-
Página 74
C8051F340/1/2/3/4/5/6/7 74 Rev. 0.5 Performance The CIP-51 emplo ys a p ipeli ned architectu re tha t grea tly increases it s instr uction throug hput over the st an - dard 8051 architecture. In a standar d 8051, all instructions except for MUL and DIV ta ke 12 or 24 system clock cycles to execute, and usually have a maximum system clock of 12 MHz.[...]
-
Página 75
Rev. 0.5 75 C8051F340/1/2/3/4/5/6/7 CIP-51 Instruction Set Summar y , which includes the mnemonic, number of bytes, and number of clock cycles for each instruction. 9.1.2. MOVX Instruction and Program Memory The MOVX instruction is typically used to access external data memor y (Note: the C8051F340/1/2/3/4/5/6/ 7 does not support of f-chip dat a or[...]
-
Página 76
C8051F340/1/2/3/4/5/6/7 76 Rev. 0.5 ORL A, direct OR direct byte to A 2 2 ORL A, @Ri OR indirect RAM to A 1 2 ORL A, #data OR immediate to A 2 2 ORL direct, A OR A to direct byte 2 2 ORL direct, #d ata OR immediate to direct byte 3 3 XRL A, Rn Exclusive-OR Register to A 1 1 XRL A, direct Exclusive-OR direct byte to A 2 2 XRL A, @Ri Exclusive-OR ind[...]
-
Página 77
Rev. 0.5 77 C8051F340/1/2/3/4/5/6/7 XCH A, @Ri Exchange indirect RAM with A 1 2 XCHD A, @Ri Exchange low nibble of indirect RAM with A 1 2 Boolean Manipulation CLR C Clear Carry 1 1 CLR bit Clear direct bit 2 2 SETB C Set Carry 1 1 SETB bit Set direct bit 2 2 CPL C Compleme nt Carry 1 1 CPL bit Complement direct bit 2 2 ANL C, bit AND direct bit to[...]
-
Página 78
C8051F340/1/2/3/4/5/6/7 78 Rev. 0.5 Notes on Registers, Operands and Addr essing Modes: Rn - Register R0-R7 of the curren tly selected register bank. @Ri - Data RAM location address ed indirectly thro ugh R0 or R1. rel - 8-bit, signed (two’ s complem ent) of fset relative to the first byte of the following instr uction. Used by SJMP and all condi[...]
-
Página 79
Rev. 0.5 79 C8051F340/1/2/3/4/5/6/7 9.2. Memory Organization The memory organ ization of the CIP-51 Syste m Controller is similar to that of a stan dard 8051. There ar e two separa te memory sp aces: prog ram memory and data m emory . Progra m and dat a memory sh are the same addres s sp ace but are ac cessed via different in struction types. The C[...]
-
Página 80
C8051F340/1/2/3/4/5/6/7 80 Rev. 0.5 9.2.2. Dat a Memory The CIP-51 includes 256 of intern al RAM mapped in to the dat a memory sp ace from 0x00 through 0 xFF . The lower 128 bytes of data memory are used for ge neral purpose register s and scratch pad memory . Either direct or indir ect addressing may be used to access the lower 128 bytes o f data [...]
-
Página 81
Rev. 0.5 81 C8051F340/1/2/3/4/5/6/7 9.2.6. Spec ial Function Registers The direct-access dat a memory locations from 0x80 to 0xFF constitute the sp ecial function registers (SFRs). The SFRs provide control and dat a exchang e with the CIP- 51's resources and per ipherals. The CIP-51 duplicates the SFRs found in a typical 805 1 implementa tion [...]
-
Página 82
C8051F340/1/2/3/4/5/6/7 82 Rev. 0.5 Ta b l e 9.3. Special Function Registers SFRs are listed in alph abetical order . All undefine d SFR locatio ns are reserved. Register Address Description Page ACC 0xE0 Accumulator 86 ADC0CF 0xBC ADC0 Configuration 50 ADC0CN 0xE8 ADC0 Control 51 ADC0G TH 0xC4 ADC0 Greater- Th a n Co mpare High 52 ADC0G TL 0xC3 AD[...]
-
Página 83
Rev. 0.5 83 C8051F340/1/2/3/4/5/6/7 P1MDIN 0xF2 Port 1 Inpu t Mo de Con fig ur at ion 156 P1MDOUT 0xA5 Port 1 Output Mode Con figuration 156 P1SKIP 0xD5 Port 1 Skip 157 P2 0xA0 Port 2 Latch 157 P2MDIN 0xF3 Port 2 Inpu t Mo de Con fig ur at ion 157 P2MDOUT 0xA6 Port 2 Output Mode Con figuration 158 P2SKIP 0xD6 Port 2 Skip 158 P3 0xB0 Port 3 Latch 15[...]
-
Página 84
C8051F340/1/2/3/4/5/6/7 84 Rev. 0.5 SBUF0 0x99 UART0 Dat a Buf fer 217 SCON0 0x98 UART0 Control 216 SMB0CF 0xC1 SMBus Configuration 200 SMB0CN 0xC0 SMBus Control 202 SMB0DA T 0xC2 SMBus Data 204 SMOD1 0xE5 UART1 Mode 225 SP 0x81 S t ack Pointer 85 SPI0CFG 0xA1 SPI Configuration 236 SPI0CKR 0xA2 SPI Clock Rate Control 238 SPI0CN 0xF8 SPI Control 237[...]
-
Página 85
Rev. 0.5 85 C8051F340/1/2/3/4/5/6/7 9.2.7. Register Descriptions Following are descr iptions of SFRs related to the operati on of the CIP-51 System Controller . Reserved bits should not be set to logic l. Future product version s may use these bits to implement new feature s in which case the reset value of the bit will be logic 0, sele cting the f[...]
-
Página 86
C8051F340/1/2/3/4/5/6/7 86 Rev. 0.5 SFR Definiti on 9.4. PSW: Program S tatus W ord SFR Definition 9.5. ACC: Accumulator Bit7: CY : Ca rry Flag . This bit is set when the last arithmetic operat ion resulted in a carry (addition) or a bo rrow (subtraction). It is cleared to logi c 0 by all other arithmetic operations. Bit6: A C: Auxiliary Carry Flag[...]
-
Página 87
Rev. 0.5 87 C8051F340/1/2/3/4/5/6/7 SFR Definiti on 9.6. B: B Register 9.3. Interrupt Handler The CIP-51 includes a n extended inter rupt system supp orting multiple interr upt sources with two priority levels. The al location of interrupt sources between on -chip peripherals and extern al inputs pins varies according to the specific version of the[...]
-
Página 88
C8051F340/1/2/3/4/5/6/7 88 Rev. 0.5 /INT0 and /IN T1 are assigned to Port pins as define d in the IT01CF register (see SFR Definition 9.13). Note that /INT0 and /INT0 Port p in assignment s are indep endent of any Cr ossbar assignment s. /INT0 and /INT1 will monitor their assigned Port pins without disturbing th e peripheral that was assigned the P[...]
-
Página 89
Rev. 0.5 89 C8051F340/1/2/3/4/5/6/7 9.3.5. Interrupt Register Descriptions The SFRs used to enable th e inte rrupt sources an d set t heir priori ty level ar e descr ibed be low . Refer to the datasheet sectio n associated with a particular o n-chip per ipheral for information r egarding valid in terrupt conditions for th e perip h er al an d th e [...]
-
Página 90
C8051F340/1/2/3/4/5/6/7 90 Rev. 0.5 SFR Definition 9.7. IE: Interrupt Enable Bit7: EA: Enable All Interrupts. This bit globally enab les/disabl es all interrupt s. It overrides the individual interrupt mask set- tings. 0: Disable all interrupt sources. 1: Enable e ach interrupt ac cord ing to its individual mask setting. Bit6: ESPI0: Enable Seri al[...]
-
Página 91
Rev. 0.5 91 C8051F340/1/2/3/4/5/6/7 SFR Definition 9.8. IP: Interrupt Priority Bit7: UNUSED. Read = 1, Write = don't care. Bit6: PSPI0: Serial Periph eral Interface (SPI0) In terrupt Priority Control. This bit set s the priori ty of the SPI0 interrupt. 0: SPI0 interrupt set to low priority level. 1: SPI0 interr upt set to high priority level. [...]
-
Página 92
C8051F340/1/2/3/4/5/6/7 92 Rev. 0.5 SFR Definition 9.9. EIE1: Extended Interrupt Enable 1 Bit7: ET3: Enable T imer 3 Interrupt. This bit sets the masking of the T imer 3 interrupt. 0: Disable T imer 3 interrupt s. 1: Enable interrupt reque st s generated by the TF3L or TF3H flags. Bit6: ECP1: Enable Comp arator1 (CP1) Interrupt. This bit sets th e [...]
-
Página 93
Rev. 0.5 93 C8051F340/1/2/3/4/5/6/7 SFR Definition 9.10. EIP1: Extended Interrupt Priority 1 Bit7: PT3: T imer 3 Interr upt Priority Control. This bit set s the priori ty of the T imer 3 interrupt. 0: Timer 3 interrupts se t to low priority level. 1: T imer 3 interrupts set to high priority level. Bit6: PCP1: Comparator1 (CP1) Interrupt Prio rity C[...]
-
Página 94
C8051F340/1/2/3/4/5/6/7 94 Rev. 0.5 SFR Definition 9.1 1. EIE2: Extended Interrupt Enable 2 SFR Definition 9.12. EIP2: Extended Interrupt Priority 2 Bits7–2: UNUSED. Read = 000000 b. Write = don’t care. Bit1: ES1: Enable UART1 Interr upt. This bit sets the ma sking of the UART1 interrupt. 0: Disable UART1 interrupt. 1: Enable UART1 interrupt. B[...]
-
Página 95
Rev. 0.5 95 C8051F340/1/2/3/4/5/6/7 SFR Definition 9.13. IT01CF: INT0/INT 1 Configuration Bit7: IN1PL: /INT1 Polarity 0: /INT1 input is active low . 1: /INT1 inp ut is active h igh. Bits6–4: IN1SL2–0: /INT1 Port Pin Selection Bit s These bit s select which Port pin is assigned to /INT1. Note that this pin assignment is inde- pendent of the Cros[...]
-
Página 96
C8051F340/1/2/3/4/5/6/7 96 Rev. 0.5 9.4. Power Management Modes The CIP-51 core has two sof tware programmable power manage ment modes: Idle and S top. Idle mode halts the CPU whi le leaving the periph erals and clocks active. In S top mode, the CPU is halted, all inter - rupts, are inactive, and the internal oscillator is st opped (analog pe riphe[...]
-
Página 97
Rev. 0.5 97 C8051F340/1/2/3/4/5/6/7 SFR Definition 9.14. PCON: Power Control Bits7–2: GF5–GF0: General Pur pose Flags 5–0. These are general purp ose flags for use under sof tware control. Bit1: STOP: S top Mode Select. Setting this bit will place the CIP-51 in S top mode. This bit will always be read as 0. 1: CPU goes into S top mode (intern[...]
-
Página 98
C8051F340/1/2/3/4/5/6/7 98 Rev. 0.5 N OTES :[...]
-
Página 99
Rev. 0.5 99 C8051F340/1/2/3/4/5/6/7 10. Prefetch Engine The C8051F340/1/2/3/4/5/6/7 family of devices in corporat e a 2-byte prefetch engine. Because the access time of the FLASH memory is 40 n s, and the minimum instruction time is roughl y 20 ns, the pr efetch engine is necessary for full- speed code execution. In structions ar e read from FLASH [...]
-
Página 100
C8051F340/1/2/3/4/5/6/7 100 Rev. 0.5 N OTES :[...]
-
Página 101
Rev. 0.5 101 C8051F340/1/2/3/4/5/6/7 1 1. Reset Sources Reset circuitry allows the controller to be easily placed in a pred efined default condition. On entry to this reset state, th e following occur: • CIP-51 halts program exec ution • S pecial Function Registers (SFRs) are initialized to their defined reset values • External Port pins are [...]
-
Página 102
C8051F340/1/2/3/4/5/6/7 102 Rev. 0.5 1 1.1. Power-On Reset During power-up, the de vice is held in a rese t state and the /RST pin is driven low until V DD settles above V RST . A Power-On Reset delay (T PORDelay ) occurs before the de vice is released from reset; this delay is typically less than 0.3 ms. Figure 11 . 2 . plot s the power-on and V D[...]
-
Página 103
Rev. 0.5 103 C8051F340/1/2/3/4/5/6/7 1 1.2. Power-Fail Reset / V DD Monitor When a power-down transition or power irregular ity causes V DD to drop below V RST , the power supply monitor will drive the /RST pin low and ho ld the CIP-51 in a reset state (see Figure 11 . 2 ). When V DD returns to a level ab ove V RST , the CIP-51 will be released fro[...]
-
Página 104
C8051F340/1/2/3/4/5/6/7 104 Rev. 0.5 1 1.3. External Reset The external /RST pin provides a means for extern al ci rcuitry to force the device into a reset state. Assert - ing an active-low signal on th e /RST pin generates a re set; an extern al pull-up and/or de coupling of the / RST pin may be necessary to avoid err oneous noise-induced re set s[...]
-
Página 105
Rev. 0.5 105 C8051F340/1/2/3/4/5/6/7 1 1.8. Sof tware Reset Software may force a reset by writing a ‘1’ to the SWRSF bit (RSTSRC.4). The SWRSF bit will read ‘1’ fol - lowing a soft ware forced reset. The st ate of the /RST pin is unaf fected by this reset. 1 1.9. USB Reset Writing ‘1’ to the USBRSF bit in register RSTSRC sele cts USB0 a[...]
-
Página 106
C8051F340/1/2/3/4/5/6/7 106 Rev. 0.5 SFR Definition 11 . 2 . RSTSRC: Reset Source Bit7: USBRSF: USB Reset Flag 0: Read: Last reset was not a USB reset; Wri te : USB resets disabled. 1: Read: Last reset was a USB reset; Wr i te : USB resets enabled. Bit6: F ERROR: Flash Error Indicator . 0: Source of last reset was not a Flash read/write/erase e rro[...]
-
Página 107
Rev. 0.5 107 C8051F340/1/2/3/4/5/6/7 Ta b l e 11 . 1 . Reset Electrical Characteristics –40 to +85 °C unless otherwise s pecified. Parameter Conditions Min T yp Max Unit s /RST Output Low V oltage I OL = 8.5 mA, V DD = 2.7 to 3.6 V 0.6 V /RST Input High V oltage 0.7 x V DD V /RST Input Low V oltage 0.3 x V DD /RST Input Pull-Up Current /RST = 0.[...]
-
Página 108
C8051F340/1/2/3/4/5/6/7 108 Rev. 0.5 N OTES :[...]
-
Página 109
Rev. 0.5 109 C8051F340/1/2/3/4/5/6/7 12. Flash Memo ry On-chip, re-programmab le Flash memory is included fo r program code and non-vo latile data storag e. The Flash memo ry can be prog rammed in-sy stem throug h the C2 inte rface or by s oftware using the MO VX instruction. On ce cleared to lo gic 0, a Flash bit mu st be erased to se t it back to[...]
-
Página 110
C8051F340/1/2/3/4/5/6/7 110 Rev. 0.5 12.1.3. Flash Write Procedure Bytes in Flash mem ory can be written on e byte at a time, or in groups of two. Th e FLBWE bit in registe r PFE0CN ( SFR Definit ion 10.1 ) controls whether a single byte or a block of two bytes is written to Flash during a write operation. When FLBWE is cleared to ‘0’, the Flas[...]
-
Página 111
Rev. 0.5 111 C8051F340/1/2/3/4/5/6/7 12.2. Non-volatile Dat a S torage The Flash memory can be used for non-vo latile data storage as well as p rogram code. This allows dat a such as calibration coefficient s to be calculated and stor ed at run time. Dat a is written using the M OVX write instruction and read using the MOVC instructi on. Note: MOVX[...]
-
Página 112
C8051F340/1/2/3/4/5/6/7 112 Rev. 0.5 Figure 12.1. Flash Program Me mory Map and Security Byte Access limit set according to the FLASH security lock byte C8051F340/2/4 /6 0x0000 0xFBFF Lock B y te Reserved 0xFBFE 0xFC00 FLASH memory organiz e d in 512-b yte pages 0xFA00 Unlocked FLASH Pages Locked when any other FLASH pages are locked C8051F341/3/5/[...]
-
Página 113
Rev. 0.5 113 C8051F340/1/2/3/4/5/6/7 The level of FLASH security depends on the FLASH access meth od. The three FLASH access methods that can be restricted a re reads, w r ites, and erases from the C2 debug in terface, user fi r mware executing on unlocked p ages, and user firm ware executing on locke d pages. Accessing FLASH from the C2 debug inte[...]
-
Página 114
C8051F340/1/2/3/4/5/6/7 114 Rev. 0.5 SFR Definition 12.1. PSCTL: Program Store R/W Control SFR Definition 12.2. FLKEY : Flash Lock and Key Bits7–3: Unused: Read = 00 000b. Write = d on’t care. Bit2: Reserved. Read = 0b. Must Write = 0b. Bit1: PS EE: Program S tore Erase Enable Setting this bit (in combination with PSWE) a llows an entire page o[...]
-
Página 115
Rev. 0.5 115 C8051F340/1/2/3/4/5/6/7 SFR Definition 12.3. FLSCL: F lash Scale Bits7: FOSE: Flash One-shot En able This bit enables the Flash read one-shot. W hen the Flash one- shot disabled, the Flash sense amps are enabled for a full clock cycle during Flash reads. At system clock frequen- cies below 10 MHz, disabling the Flash one-s hot will inc[...]
-
Página 116
C8051F340/1/2/3/4/5/6/7 116 Rev. 0.5 N OTES :[...]
-
Página 117
Rev. 0.5 117 C8051F340/1/2/3/4/5/6/7 13. External Data Memory Interface and On-Chip XRAM 4k Bytes (C8 051F340/2/ 4/6) or 2k Bytes (C8051F341/3/5/7) of RAM are included on-chip , and mapped into the external dat a memory space (XRAM) . The 1k Bytes of USB FIFO space can also be map ped into XRAM address sp ace for additional gene ral-purpose dat a s[...]
-
Página 118
C8051F340/1/2/3/4/5/6/7 118 Rev. 0.5 13.2. Accessing USB FIFO Sp ace The C8051F340/1/2 /3/4/5/6/7 include 1k of RA M which functions a s USB FIFO space. Figure 13.1 shows an expand ed view of the FIFO space an d user XRAM . FIFO sp ace is normally accessed via USB FIFO registers; see Sec tion “16.5. FIFO Manageme nt” on p age 171 for more infor[...]
-
Página 119
Rev. 0.5 119 C8051F340/1/2/3/4/5/6/7 13.3. Configuring the External Memory Interface Configuring the External Memory Interface co nsists of five step s: 1. Configure the Outpu t Modes of the associated port pin s as either push-p ull or open-drai n (push-pull is most common), and skip the associated pins in the crossbar . 2. Configure Port la tches[...]
-
Página 120
C8051F340/1/2/3/4/5/6/7 120 Rev. 0.5 SFR Definition 13.1. EMI0CN: External Memo ry Interface Control Bits7–0: PGSE L[7:0]: XR AM Page Select Bits. The XRAM Page Select Bit s provide the high byte of the 16-bit exter n al da ta memor y address when using an 8-bit MOVX command, ef fectively selecting a 256-byte p age of RAM. 0x00: 0x0000 to 0x00FF [...]
-
Página 121
Rev. 0.5 121 C8051F340/1/2/3/4/5/6/7 SFR Definition 13.2. EMI0CF: External Memory Configuration Bit7: Unused. Read = 0b. Write = don’t care . Bit6: USBF AE: USB FIFO Access Enable. 0: USB FIFO RAM not availabl e through MOVX instruction s. 1: USB FIFO RAM available using MOVX instru ctions. The 1k of USB RAM will be mapped in XRAM space at addres[...]
-
Página 122
C8051F340/1/2/3/4/5/6/7 122 Rev. 0.5 13.5. Multiplexed and Non-multiplexed Selection The External Memory In terface is capable of acting in a Multiplexe d mode or a No n-multiplexed mode, depending on the st ate of the EMD2 (EMI0CF .4) bit. 13.5.1. Multiplexed Configuration In Multiplexed mode, the Dat a Bus and the lower 8-bit s of the Address Bus[...]
-
Página 123
Rev. 0.5 123 C8051F340/1/2/3/4/5/6/7 13.5.2. Non-multiplexed Configuration In Non-multiplexe d mode, the Dat a Bus and the Address Bus pins are n ot shared. An example o f a Non-multiplexed Config uration is shown in Figure 13.3 . See Se ction “13.7. 1. Non-multiplexed Mode” on pa ge 127 fo r mor e information about Non- multiplexed operation. [...]
-
Página 124
C8051F340/1/2/3/4/5/6/7 124 Rev. 0.5 13.6.1. Internal XRAM Only When EMI0CF .[3:2] are set to ‘00’, all MOVX instructions will ta rget the internal XRAM space on the device. Memory accesses to addresses beyond the populated space will wrap on 2k or 4k boundaries (depending on the RAM availa ble on the device). As an e xample, the addresses 0x10[...]
-
Página 125
Rev. 0.5 125 C8051F340/1/2/3/4/5/6/7 13.6.3. Split Mode with Bank Select When EMI0CF .[3:2] are set to ‘1 0’, the XRAM memory map is split into two ar eas, on-chip space an d off-chip space. • Effective addresses below the internal XRAM size boundary will access on-chip XRAM space. • Effective addresses above the internal XR AM size boundar[...]
-
Página 126
C8051F340/1/2/3/4/5/6/7 126 Rev. 0.5 SFR Definition 13.3. EMI0TC: External Me mory T iming Control Bits7–6: EAS1–0: EMIF Addr ess Setup T ime Bits. 00: Address setup time = 0 SYS CLK cycles. 01: Address setup time = 1 SYS CLK cycle. 10: Address setup time = 2 SYS CLK cycles. 1 1: Address setup time = 3 SYSCLK cycles. Bits5–2: EWR3–0: EMIF /[...]
-
Página 127
Rev. 0.5 127 C8051F340/1/2/3/4/5/6/7 13.7.1. Non-multiplexed Mode 13.7.1.1.16-bit MOVX: EMI0CF[4:2] = ‘1 01’, ‘1 10’, or ‘1 1 1’. Figure 13.5. Non-multip lexed 16-bit MOVX Timing EMIF ADDRESS (8 MSBs) from DPH EMIF ADDRESS (8 LSBs) from DPL P3 P2 P1.7 P1.6 P4 EMIF WR ITE DAT A P3 P2 P1.7 P1.6 P4 T ACH T WDH T ACW T ACS T WDS ADDR[15:8] [...]
-
Página 128
C8051F340/1/2/3/4/5/6/7 128 Rev. 0.5 13.7.1.2.8-bit MOVX without Bank Se lect: EMI0CF[4:2] = ‘101’ or ‘1 1 1’. Figure 13.6. Non-multip lexed 8-bit MOVX withou t Bank Select Timing EMIF ADDRESS (8 LSBs) from R0 or R1 P3 P2 P1.7 P1.6 P4 EMIF WRITE D ATA P3 P1.7 P1.6 P4 T ACH T WDH T ACW T ACS T WDS ADDR[15:8] ADDR[7 :0] DATA[7:0] /WR /RD EMIF[...]
-
Página 129
Rev. 0.5 129 C8051F340/1/2/3/4/5/6/7 13.7.1.3.8-bit MOVX with Bank Select: EMI0CF[4:2] = ‘1 10’. Figure 13.7. Non-multip lexed 8-bit MOVX with Bank Select Timing P4 P3 P4 ADDR[15:8] AD[7:0] P3 P1.7 P1.6 P1.3 P1.7 P1.6 P1.3 T ACH T WDH T ACW T ACS T WDS ALE /WR /RD EMIF ADDRESS (8 MSBs) from EMI0CN EMIF WRITE DATA EMIF ADDRESS (8 LSBs) fro m R0 [...]
-
Página 130
C8051F340/1/2/3/4/5/6/7 130 Rev. 0.5 13.7.2. Multiplexed Mode 13.7.2.1.16-bit MOVX: EMI0CF[4:2] = ‘0 01’, ‘010’, or ‘01 1’. Figure 13.8. Multiple xed 16-bit MOVX Timing P4 P3 P4 ADDR[15: 8] AD[7:0 ] P3 P1.7 P1.6 P1.3 P1.7 P1.6 P1.3 T ACH T WDH T ACW T ACS T WDS ALE /WR /RD EMIF ADDRESS (8 MSBs) from DPH EMIF WRITE DATA EMIF ADDRESS (8 L[...]
-
Página 131
Rev. 0.5 131 C8051F340/1/2/3/4/5/6/7 13.7.2.2.8-bit MOVX without Bank Se lect: EMI0CF[4:2] = ‘001’ or ‘01 1’. Figure 13.9. Multiplexed 8-bit MO VX without Bank Select T iming P4 P3 P4 ADDR[15:8] AD[7:0] P1.7 P1.6 P1.3 P1.7 P1.6 P1.3 T ACH T WDH T ACW T ACS T WDS ALE /WR /RD EMIF WRITE DATA EMIF ADDRESS (8 LSBs) from R0 or R1 T ALEH T ALEL P[...]
-
Página 132
C8051F340/1/2/3/4/5/6/7 132 Rev. 0.5 13.7.2.3.8-bit MOVX with Bank Select : EMI0CF[4:2 ] = ‘010’. Figure 13.10. Multiplexed 8-bit MOVX with Bank Select Timing P4 P3 P4 ADDR[15:8] AD[7:0] P3 P1.7 P1.6 P1.3 P1.7 P1.6 P1.3 T ACH T WDH T ACW T ACS T WDS ALE /WR /RD EMIF ADDRESS (8 MSBs) from EMI0CN EMIF WRITE DATA EMIF ADDRESS (8 LSBs) from R0 or R[...]
-
Página 133
Rev. 0.5 133 C8051F340/1/2/3/4/5/6/7 Ta b l e 13.1. AC Parameters for Exte rnal Memory Interface Parameter Description Min* Max* Unit s T ACS Address / Control Setup T ime 0 3 x T SYSCLK ns T ACW Address / Control Pulse Wid th 1 x T SYSCLK 16 x T SYSCLK ns T ACH Address / Control Hold T ime 0 3 x T SYSCLK ns T ALEH Address Latch Enable High Time 1 [...]
-
Página 134
C8051F340/1/2/3/4/5/6/7 134 Rev. 0.5 N OTES :[...]
-
Página 135
Rev. 0.5 135 C8051F340/1/2/3/4/5/6/7 14. Oscillators C8051F340/1/2/3/4/5/6/7 de vices include a prog rammable internal high-fre quency oscillator , a program - mable internal low-frequency oscillator (C8051F 340/1/2/3/4/5), an exte rnal oscillator drive circuit, and a 4x Clock Multiplier . The internal high -frequency and low-freq uency oscillators[...]
-
Página 136
C8051F340/1/2/3/4/5/6/7 136 Rev. 0.5 14.1. Programmable Internal Hi gh-Frequency (H-F) Oscillator All C8051F340/1/2/3/4/5/6/7 devices include a programmable internal oscillator that defaults as the system clock after a system rese t. The internal oscillato r period can be programmed via the OSCICL register shown in SFR Definition 14.2 . The OSCICL [...]
-
Página 137
Rev. 0.5 137 C8051F340/1/2/3/4/5/6/7 SFR Definition 14.2. OSCICL: Internal H-F Oscillat or Calibration 14.2. Programmable Internal Low -Frequency (L-F) Oscillator The C8051F340/1/2/3/4/5 dev ices include a prog rammable internal os cillator which operat es at a nominal frequency of 80 kHz. The low-frequen cy oscillator circuit includes a divi der t[...]
-
Página 138
C8051F340/1/2/3/4/5/6/7 138 Rev. 0.5 SFR Definition 14.3. OSCLCN: Internal L-F Oscillator Control Bit7: OSC LEN: Internal L-F Oscillator Enable. 0: Internal L-F Oscillator Disabled. 1: Internal L-F Oscillator Enabled. Bit6: OSC LR DY : Internal L-F Oscillator Ready Flag. 0: Internal L-F Oscillato r frequency not stabilized. 1: Internal L-F Oscilla [...]
-
Página 139
Rev. 0.5 139 C8051F340/1/2/3/4/5/6/7 14.3. External Oscill ator Drive Circuit The external oscillator circuit may driv e an external crystal, ce ramic resonator , capacito r , or RC network. A CMOS clock m ay also provide a clock inp ut. For a crys tal or ceramic resonato r configuration, the cryst al/ resonator must be wired across the XT AL1 an d[...]
-
Página 140
C8051F340/1/2/3/4/5/6/7 140 Rev. 0.5 14.3.3. External RC Example If an RC network is used as an external oscillator so urce for the MCU, the circ uit should be configured as shown in Figure 14.1 , Op tion 2. The capacitor should be no greater than 10 0 pF; however fo r very small capacitors, the tot al capacit ance may be do minated by p arasitic c[...]
-
Página 141
Rev. 0.5 141 C8051F340/1/2/3/4/5/6/7 SFR Definition 14.4. OSCXCN: External Oscillator Control Bit7: XTL VLD: Crystal Oscillator V a lid Flag. (Read only when XOSCMD = 1 1x.) 0: Crystal Oscillator is unused or not yet stable. 1: Crystal Oscillator is running and stable. Bits6–4: XOSCMD2–0: Extern al Oscillator Mode Bits. 00x: External Osc illato[...]
-
Página 142
C8051F340/1/2/3/4/5/6/7 142 Rev. 0.5 14.4. 4x Clock Multiplier The 4x Clock Multiplier allows a 12 MHz oscillator to generate the 48 MHz clock required for Full S peed USB communication (see Section “16.4. USB Clock Configuration” on p age 170 ). A divided version of the Multiplier output can also be used as the system clock. See Section 14.5 f[...]
-
Página 143
Rev. 0.5 143 C8051F340/1/2/3/4/5/6/7 14.5. System and US B Clock Selection The internal oscillator requires littl e start-up time and may be selected as the system or USB clock immedi - ately following the O SCICN write that enab les th e inte rnal oscillator . External crystals and ceramic resona - tors typically req uire a start-up time befo re t[...]
-
Página 144
C8051F340/1/2/3/4/5/6/7 144 Rev. 0.5 SFR Definition 14.6. CLKSEL: Clock Select Bit 7: Unused. Read = 0b; Write = do n’t care. Bits6–4: USBCLK2–0: USB Clock Select These bit s select the clock supplied to USB0. When oper ating USB0 in full-speed mode, th e selected clock should be 4 8 MHz. When operating USB0 in low-spee d mode, the selected c[...]
-
Página 145
Rev. 0.5 145 C8051F340/1/2/3/4/5/6/7 Ta b l e 14.1. Oscillator Electrical Characteristics V DD = 2.7 to 3.6 V ; –40 to +85 °C unless otherwise specified Parameter Conditions Min T yp Max Unit s Internal High-Frequency Oscillator (U sing Factory- Calibrated Settings ) Oscillator Frequency IFCN = 1 1b 1 1.82 12.00 12.18 MHz Oscillator Supply Curre[...]
-
Página 146
C8051F340/1/2/3/4/5/6/7 146 Rev. 0.5 N OTES :[...]
-
Página 147
Rev. 0.5 147 C8051F340/1/2/3/4/5/6/7 15. Port Inp ut/Output Digital an d analog reso urces are ava ilable through 40 I/O pins (C8051F34 0/1/4/5) or 25 I/O pins (C8051F342/3/6/7). Port pins are orga nized as shown in Figure 15.1 . Each of the Port pins can be defined as general-pu r pose I/O (GPI O) or an a log in pu t; Port pi ns P0.0-P3.7 can be a[...]
-
Página 148
C8051F340/1/2/3/4/5/6/7 148 Rev. 0.5 Figure 15.2. Port I/O Cell Block Di agram GND /PORT-OUTE NABLE PORT-OUT PUT PUSH-P ULL VDD VDD /W EAK-PULLUP (WEA K) PORT PAD ANALOG INPUT Analog Select PORT-INP UT[...]
-
Página 149
Rev. 0.5 149 C8051F340/1/2/3/4/5/6/7 15.1. Priority Crossbar Decoder The Priority Crossb ar Decoder (F igure 15.3) assigns a priority to each I/O function, starting a t the top with UART0. When a digital re source is selected, the leas t- significant unassigned Port pi n is assigned to that resource (excluding UAR T0, which is always at pins 4 an d[...]
-
Página 150
C8051F340/1/2/3/4/5/6/7 150 Rev. 0.5 Figure 15.4. Crossbar Priority D ecoder with Cryst al Pins Skipped Registers XBR0, XBR1, and XBR2 ar e used to assign the d igital I/O r esources to the physical I/O Po rt pins. Note that when the SMBus is selected, the Cro ssbar assigns both pins associated with the SMBus (SDA and SCL); when either UAR T is sel[...]
-
Página 151
Rev. 0.5 151 C8051F340/1/2/3/4/5/6/7 15.2. Port I/O Initialization Port I/O initialization consis ts of the following step s: S tep 1. Select the input mode (analog or digital) for all Por t pins, using the Port Input Mode register (PnMDIN). S tep 2. Select the output mode (open-drain or pu sh -pull) for all Port pins, using the Port Output Mode re[...]
-
Página 152
C8051F340/1/2/3/4/5/6/7 152 Rev. 0.5 SFR Definition 15.1. XBR0: Port I/O Cro ssbar Register 0 Bit7: CP1AE: Comparator1 Asynchronou s Output Enable 0: Asynchronou s CP1 un av ailable at Port pin. 1: Asynchro nous CP1 ro uted to Por t pin. Bit6: CP1E: Comparator1 Output En able 0: CP1 unavailable at Port pin. 1: CP1 routed to Port pin. Bit5: CP0AE: C[...]
-
Página 153
Rev. 0.5 153 C8051F340/1/2/3/4/5/6/7 SFR Definition 15.2. XBR1: Port I/O Cro ssbar Register 1 SFR Definition 15.3. XBR2: Port I/O Cro ssbar Register 2 Bit7: WEAKPUD: Port I/O Weak Pull-up Disable. 0: Weak Pull-up s enabled (except for Port s whose I/O are configured as analog input or push-pull output). 1: Weak Pull-up s disabled. Bit6: XBARE: Cros[...]
-
Página 154
C8051F340/1/2/3/4/5/6/7 154 Rev. 0.5 15.3. General Purpose Port I/O Port pins that remain un assigned by the Crossbar an d are not used by analog p eripherals can be used for general purpo se I/O. Port s 3-0 are accessed through corresponding special function registers (S FRs) that are both byte addressable and bit addressable. Por t 4 (C8051F340/1[...]
-
Página 155
Rev. 0.5 155 C8051F340/1/2/3/4/5/6/7 SFR Definition 15.6. P0MDOUT : Port0 Output Mode SFR Definition 15.7. P0SKIP: Port0 Skip Bits7–0: Output Configuration Bit s for P0.7–P0.0 (res pe ctively): ignored if corresponding bit in regis- ter P0MDIN is logic 0. 0: Corresponding P0.n Output is open-dr ain. 1: Corresponding P0.n Output is push -p ull. [...]
-
Página 156
C8051F340/1/2/3/4/5/6/7 156 Rev. 0.5 SFR Definition 15.8. P1: Port1 Latch SFR Definition 15.9. P1MDIN: Port1 Input Mode SFR Definition 15.10. P1MDOUT : Port1 Output Mode Bits7–0: P1.[7:0] Write - Output appears on I/O pins per Crossbar Re gisters (when XBARE = ‘1’). 0: Logic Low O utput. 1: Logic High O utput (high impedance if corresponding [...]
-
Página 157
Rev. 0.5 157 C8051F340/1/2/3/4/5/6/7 SFR Definition 15.1 1. P1SKIP: Port1 Skip SFR Definition 15.12. P2: Port2 Latch SFR Definition 15.13. P2MDIN: Port2 Input Mode Bits7–0: P1SKIP[7:0]: Port1 Cr ossbar Skip Enable Bits. These bits select Por t pin s to be skipped by the Crossbar Decoder . Port pins used as ana- log inputs (for ADC or Compa rator)[...]
-
Página 158
C8051F340/1/2/3/4/5/6/7 158 Rev. 0.5 SFR Definition 15.14. P2MDOUT : Port2 Output Mode SFR Definiti on 15.15. P2SKIP: Port2 Skip Bits7–0: Output Configuration Bit s for P2.7–P2.0 (res pe ctively): ignored if corresponding bit in regis- ter P2MDIN is logic 0. 0: Corresponding P2.n Output is open-dr ain. 1: Corresponding P2.n Output is push -p ul[...]
-
Página 159
Rev. 0.5 159 C8051F340/1/2/3/4/5/6/7 SFR Definition 15.16. P3: Port3 Latch SFR Definition 15.17. P3MDIN: Port3 Input Mode SFR Definition 15.18. P3MDOUT : Port3 Output Mode Bits7–0: P3.[7:0] Write - Outp ut appears on I/O pins. 0: Logic Low O utput. 1: Logic High O utput (high impedance if corresponding P3MDOUT .n bit = 0). Read - Always reads ‘[...]
-
Página 160
C8051F340/1/2/3/4/5/6/7 160 Rev. 0.5 SFR Definiti on 15.19. P3SKIP: Port3 Skip SFR Definition 15.20. P4: Port4 Latch Bits7–0: P3SKIP[3:0]: Port3 Cr ossbar Skip Enable Bits. These bits select Por t pin s to be skipped by the Crossbar Decoder . Port pins used as ana- log inputs (for ADC or Compa rator) or used as special functions (VREF inpu t, ext[...]
-
Página 161
Rev. 0.5 161 C8051F340/1/2/3/4/5/6/7 SFR Definition 15.21. P4MDIN: Port4 Input Mode SFR Definition 15.22. P4MDOUT : Port4 Output Mode Bits7–0: Analog Input Configuration Bit s for P4.7–P4.0 (respectively). Port pins configured as analog input s have their weak pull-u p, digital driver , and digit a l receiver disabled . 0: Corresponding P4.n pi[...]
-
Página 162
C8051F340/1/2/3/4/5/6/7 162 Rev. 0.5 Ta b l e 15.1. Port I/O DC Electri cal Characteristics V DD = 2.7 to 3.6 V , –40 to +85 °C u nless otherwise specified Parameters Conditions Min T yp Max Unit s Output High V oltage I OH = –3 mA, Port I/ O push-pull I OH = –10 µA, Port I/O push-pull I OH = –10 mA, Port I/O push-pull V DD – 0.7 V DD ?[...]
-
Página 163
Rev. 0.5 163 C8051F340/1/2/3/4/5/6/7 16. Universal Serial Bus Controller (USB0) C8051F340/1/2/3/4/5/6/7 devices include a comple te Full/Low S peed USB function for USB peripheral implementations*. The USB Funct ion Controller (USB0 ) c onsists of a Seri al Interface Engine (SIE), USB T ransceive r (including match ing resistors and configurab le p[...]
-
Página 164
C8051F340/1/2/3/4/5/6/7 164 Rev. 0.5 16.1. End point Addressing A total of eight endpoint pipes are available. T he control endpoint (E ndpoint0) al ways functions as a bi-directional IN/OUT end point. The other endpo ints are imple mented as three pairs of IN/OUT end point pipes: 16.2. USB T ransceiver The USB T ransceiver is config ured via the U[...]
-
Página 165
Rev. 0.5 165 C8051F340/1/2/3/4/5/6/7 SFR Definition 16.1. USB0XCN: USB0 T ransceiver Control Bit7: PREN : Internal Pu ll-up Resistor Enable The location of the pull-up resistor (D + or D–) is determined by the SPEED bit. 0: Internal pull-up resistor disabled (d evic e ef fectively det ached from the USB network). 1: Internal pull-up resistor ena [...]
-
Página 166
C8051F340/1/2/3/4/5/6/7 166 Rev. 0.5 16.3. USB Register Access The USB0 controller reg isters listed in T able 16.2 ar e accessed th rough two SFRs : USB0 Addre ss (USB0ADR) and USB0 Data (USB0DA T). The USB0ADR register se lects which USB register is targeted by reads/writes of the USB0DA T register . See Figure 16.2 . Endpoint co ntrol/sta tus re[...]
-
Página 167
Rev. 0.5 167 C8051F340/1/2/3/4/5/6/7 SFR Definition 16.2. USB0ADR: USB0 Indirect Address Bits7: BUSY : USB0 Register Read Busy Flag This bit is used during indirect USB0 register ac cesses. Sof tware should wr ite ‘1’ to this bit to initiate a read of the USB0 register targeted by the USBAD DR bits (USB0ADR.[5-0]). The target address and BUSY b[...]
-
Página 168
C8051F340/1/2/3/4/5/6/7 168 Rev. 0.5 SFR Definition 16.3. USB0DA T : USB0 Dat a This SFR is used to indirectly read and write USB0 registers. Wri te Procedure: 1. Poll for BUSY (USB 0AD R.7) => ‘0’. 2. Load the target USB0 register address into the USBADDR bits in register USB0ADR. 3. Write dat a to USB0DA T . 4. Repeat (S tep 2 may be skipp[...]
-
Página 169
Rev. 0.5 169 C8051F340/1/2/3/4/5/6/7 USB Register Definition 16.4. INDEX: USB0 End point Index Ta b l e 16.2. USB0 Controller Registers USB Register Name USB Register Address Description Page Numbe r Interrupt Registers IN1INT 0x02 Endpoint0 an d Endpoint s1-3 IN Inte rrupt Flags 177 OUT1INT 0x04 Endpoint s1-3 OUT Interrupt Fla gs 177 CMINT 0x06 Co[...]
-
Página 170
C8051F340/1/2/3/4/5/6/7 170 Rev. 0.5 16.4. USB Clock Configuration USB0 is cap able of communication a s a Full or Low S peed USB function. Communication speed is selected via the SPEED bit in SFR USB0XCN. When operati ng as a Low S peed func tion, the USB0 clock must be 6 MHz. When operating as a Full S peed function, the USB0 clock must be 48 MHz[...]
-
Página 171
Rev. 0.5 171 C8051F340/1/2/3/4/5/6/7 16.5. FIFO Management 1024 bytes of on-chip XRAM a re used as FIFO sp ace for USB0. This FIFO space is sp lit between Endpoint s0-3 as shown in Figu re 16.3 . FIFO space allocated for End point s1-3 is configurable as IN, OUT , or both (S plit Mode: half IN, half OUT). Figure 16.3. USB FIFO Allocation 16.5.1. FI[...]
-
Página 172
C8051F340/1/2/3/4/5/6/7 172 Rev. 0.5 16.5.2. FIFO Double Buffering FIFO slots for End point s1-3 can be configured for double-buffered mode. In this mode , the maximum packet size is halved an d the FIFO may cont ain tw o packets at a time. This mode is availa ble for Endpoint s1-3. When an end point is configured for S plit Mode, double buf fering[...]
-
Página 173
Rev. 0.5 173 C8051F340/1/2/3/4/5/6/7 16.6. Function Addressing The F ADDR register holds the current USB0 function addre ss. Soft ware should wr ite the host-assig ned 7-bit function address to the F ADDR register when rec eived as part of a SET_ADDRESS command. A new address written to F ADDR will not take ef fect (USB0 will not respond to the new[...]
-
Página 174
C8051F340/1/2/3/4/5/6/7 174 Rev. 0.5 “14. Oscillators” on p age 135 for more details on internal oscillator configuration, in cluding the Suspend mode feature of the internal oscillator . USB0 exits Suspend mod e when any of the following occur: ( 1) Resume sig naling is detected or gene r - ated, (2) Reset signaling is dete cted, or (3) a devi[...]
-
Página 175
Rev. 0.5 175 C8051F340/1/2/3/4/5/6/7 USB Register Definition 16. 8. POWER: USB0 Power Bit7: ISO UD: ISO Update This bit af fects a ll IN Isochronous end points. 0: When software writes INPRDY = ‘1’, USB0 w ill send the pa cket when the next IN token is received. 1: When software writes INPRDY = ‘1’, USB0 will wait for a SOF token before sen[...]
-
Página 176
C8051F340/1/2/3/4/5/6/7 176 Rev. 0.5 USB Register Definition 16.9. FRAMEL: USB0 Frame Number Low USB Register Definiti on 16.10. FRAMEH: US B0 Frame Number High 16.8. Interrupt s The read-only USB0 interru pt flags are located in the USB registers sh own in USB Register Definition 16.1 1 through USB Register Definition 16.13 . The as sociated inte [...]
-
Página 177
Rev. 0.5 177 C8051F340/1/2/3/4/5/6/7 USB Register Definition 16.1 1. IN1I NT : USB0 IN Endpoint Interrupt USB Register Definition 16.12. OUT1INT : USB0 Out Endpoint Interrupt Bits7–4: Unused. Read = 0000b. W rite = don’t care. Bit3: IN3: IN Endpoint 3 Interrupt-pend ing Flag This bit is cleare d when sof twa re reads the IN1INT register . 0: IN[...]
-
Página 178
C8051F340/1/2/3/4/5/6/7 178 Rev. 0.5 USB Register Definition 16.13. CMINT : USB0 Common Interrupt Bits7–4: Unused. Read = 0000b; W rite = don’t care. Bit3: S OF: S tart of Frame Int errupt Set by hardware when a SOF token is received. This interrupt eve nt is synthesized by hard- ware: an interrupt will be generated when hardware expects to rec[...]
-
Página 179
Rev. 0.5 179 C8051F340/1/2/3/4/5/6/7 USB Register Definition 16. 14. IN1IE: USB0 IN Endpoint Interrupt Enable USB Register Definition 16.15. OUT1IE: USB0 Out End point Interrupt Enable Bits7–4: Unused. Read = 0000b. W rite = don’t care. Bit3: IN3E: IN Endpoint 3 Interrupt Enable 0: IN Endpoint 3 inte rrupt disabl ed. 1: IN Endpoint 3 interrupt [...]
-
Página 180
C8051F340/1/2/3/4/5/6/7 180 Rev. 0.5 USB Register Definition 16.16. CM IE: USB0 Common Interrupt Enable 16.9. The Serial Interface Engine The Serial Inter face Engine (SIE) perfor ms all low level USB protocol tasks, interr upting the processor when data has successfully been trans mitted or received. When receivin g data, the SIE w ill interrupt t[...]
-
Página 181
Rev. 0.5 181 C8051F340/1/2/3/4/5/6/7 The E0CNT register (USB Register Defin ition 16.18) holds the n umber of received data bytes in th e Endpoint0 FIFO . Hardware will automatically detect protocol errors and send a ST AL L condition in response. Firmware may force a ST ALL conditio n to abo rt the cu rr ent tra nsfer . When a ST ALL condition is [...]
-
Página 182
C8051F340/1/2/3/4/5/6/7 182 Rev. 0.5 16.10.3.End point0 OUT T ransactions When a SETUP request is received that requires th e host to transmit data to USB0, one or more OUT requests will be sent by the host. W hen an OUT packet is su ccessfully received by USB0, hardware will set the OPRDY bit (E0CSR.0) to ‘1’ and generate an End point0 interru[...]
-
Página 183
Rev. 0.5 183 C8051F340/1/2/3/4/5/6/7 USB Register Definiti on 16.17. E0CSR: USB0 End point0 Control Bit7: SSUEND: Serviced Setup End Wri t e: Software should set this bit to ‘1’ afte r serv icing a Setup En d (bit SUEND) e vent. Hardware clears the SUEND bit when software writes ‘1’ to SSUEND. Read: This bit always reads ‘0’. Bit6: SOP [...]
-
Página 184
C8051F340/1/2/3/4/5/6/7 184 Rev. 0.5 USB Register Definiti on 16.18. E0CNT : USB0 Endpoint 0 Dat a Count 16.1 1. Configuring Endpoint s1-3 Endpoint s1-3 are config ured and cont ro lled through their own set s of the following co ntrol/status registers: IN registers EINCSRL and EINCSRH, and OUT re gi sters EOUTCSRL and EOUTCSRH. Only on e set of en[...]
-
Página 185
Rev. 0.5 185 C8051F340/1/2/3/4/5/6/7 Writing ‘1’ to INPRDY without writin g any dat a to the endpoint FIFO w ill cause a zero-length p acket to be transmitted upon reception of the next IN token. A Bulk or Interrupt pipe can be shut down (or Halted) by writing ‘1’ to the SDSTL bit (EINCSRL.4). While SDSTL = ‘1’, hardware will respond to[...]
-
Página 186
C8051F340/1/2/3/4/5/6/7 186 Rev. 0.5 USB Register Definition 16.19. EINCSRL: USB0 IN Endpoint Control Low Byte Bit7: Unused. Read = 0; Write = don’t care. Bit6: CLRDT : Clear Data T oggle. Wri t e: Software should wr ite ‘1’ to this bit to reset the IN End point dat a toggle to ‘0’. Read: This bit always reads ‘0’. Bit5: STSTL: Sent S[...]
-
Página 187
Rev. 0.5 187 C8051F340/1/2/3/4/5/6/7 USB Register Definition 16. 20. EINCSRH: USB0 IN En d point Control High Byte 16.13. Controlling Endpoint s1-3 OUT Endpoint s1-3 OUT are managed via USB registers EOUTCSRL and EOUTCSRH. All OUT endpoi nts can be used for In terr upt, Bulk, or Isochr onous transfers. Isochronou s (ISO) mode is enabled by writing [...]
-
Página 188
C8051F340/1/2/3/4/5/6/7 188 Rev. 0.5 A Bulk or Interrupt pi pe ca n be sh ut down ( or Halted ) by writing ‘1’ to the SDSTL bit (EOUTCSRL.5). While SDSTL = ‘1’, hardware will respond to all OUT requests with a ST ALL condi tion. Each time hardware gen - erates a ST ALL condition, an interr upt will be generated an d the STSTL bit (EOUTCSRL.[...]
-
Página 189
Rev. 0.5 189 C8051F340/1/2/3/4/5/6/7 USB Register Definition 16.21. EOUTCSRL: USB0 OUT Endpoint Control Low Byte Bit7: CLRDT : Clear Data T oggle Wri t e: Software should wr ite ‘1’ to this bit to reset the OUT end point dat a toggle to ‘0’. Read: This bit always reads ‘0’. Bit6: STSTL: Sent S ta ll Hardware sets this bit to ‘1’ whe[...]
-
Página 190
C8051F340/1/2/3/4/5/6/7 190 Rev. 0.5 USB Register Defini tion 16.22. EOUTCSRH: USB0 OUT Endpoint Control High Byte USB Register Definition 16.23. EOUTCNTL: USB0 OUT End point Count Low USB Register Definition 16.24. EOUTCNTH: USB0 OUT End point Count High Bit7: DBOEN: Double-buffer Enable 0: Double-buf fering disable d for the selected OUT end poin[...]
-
Página 191
Rev. 0.5 191 C8051F340/1/2/3/4/5/6/7 Ta b l e 16.4. USB T ransceiver Electri cal Characteristics V DD = 3.0 to 3.6 V , –40 to +85 °C u nless otherwise specified Parameters Symbol Conditions Min T yp Max Units Tr a n s m i t t e r Output High V oltage V OH 2.8 V Output Low V oltage V OL 0.8 V Output Crossover Point V CRS 1. 3 2.0 V Output Impedan[...]
-
Página 192
C8051F340/1/2/3/4/5/6/7 192 Rev. 0.5 N OTES :[...]
-
Página 193
Rev. 0.5 193 C8051F340/1/2/3/4/5/6/7 17. SMBus The SMBus I/O interface is a two-wire, bi-directional se rial bus. The SMBus is compliant with the System Management Bus S pecification, version 1.1, and com patible with the I2C serial b us. Reads and w rites to the interface by the system controller are byte oriented with the SMBu s interface autonom[...]
-
Página 194
C8051F340/1/2/3/4/5/6/7 194 Rev. 0.5 17.1. Supporting Document s It is assumed the reader is familiar with or has access to th e following suppo rting document s: 1. The I2C-Bus and How to Use It (including specifications), Philips Semiconductor . 2. The I2C-Bus S pecification -- V e rsion 2.0, Philips Semiconductor . 3. System Management Bus S pec[...]
-
Página 195
Rev. 0.5 195 C8051F340/1/2/3/4/5/6/7 The direction bi t (R/W) occupies the least-significan t bit position of th e address byte. The di rection bit is set to logic 1 to indicate a "READ" operation and cleare d to logic 0 to indicate a "WRITE" operation. All transaction s are initiat ed by a ma ster , wit h one or mo re addressed[...]
-
Página 196
C8051F340/1/2/3/4/5/6/7 196 Rev. 0.5 17.3.2. Clock Low Extension SMBus provides a clock synchronizati on mechanism, similar to I2C, wh ich allows devices with dif ferent speed capabilities to coexist on the bus. A clock-low extensio n is used during a transf er in order to allow slower slave devices to communicate with faster masters. The slave may[...]
-
Página 197
Rev. 0.5 197 C8051F340/1/2/3/4/5/6/7 SMBus configuration optio ns include: • T imeout detection (SCL Low T imeout and/or Bus Free T imeout) • SDA setup and hold time extensions • Slave event en ab le /d isab le • Clock source selection These options are selected in the SMB0CF register , as described in Section “17.4.1. SMBus Configura - t[...]
-
Página 198
C8051F340/1/2/3/4/5/6/7 198 Rev. 0.5 17.4.1. SMBus Configuration Register The SMBus Configuration re gister (S MB0CF) is used to en able the SMBus Master an d/or Slave modes, select the SMBus clock source, and select the SMBus timing and timeout options. When the ENSMB bit is set, the SMBus is enabled for all master and slave event s. Slave event s[...]
-
Página 199
Rev. 0.5 199 C8051F340/1/2/3/4/5/6/7 Figure 17.4 shows the typical SCL generation described by Equa tion 17.2. Notice that T HIGH is typically twice as large as T LOW . The actual SCL outpu t may vary due to other devices o n the bus (SCL may be extended lo w by slower sla ve devices, or d riven low by co ntending mast er devices). The bit rate wh [...]
-
Página 200
C8051F340/1/2/3/4/5/6/7 200 Rev. 0.5 SFR Definition 17.1. SMB0CF: SMBus Clock/Configuration Bit7: ENSMB: SMBus Enable. This bit enables/disables the SMBus interface. When enabled, the inter face const antly mon- itors the SDA and SCL pin s. 0: SMBus interface disabled. 1: SMBus interface enabled. Bit6: INH: SMBus S lave Inhibit. When this bit is se[...]
-
Página 201
Rev. 0.5 201 C8051F340/1/2/3/4/5/6/7 17.4.2. SMB0CN Control Register SMB0CN is used to control the interface an d to provid e st atus information (see SFR Definition 17.2). The higher four bit s of SMB0CN (MASTER, TXMODE, ST A, and ST O) form a st atus vector that can be used to jump to service routines. MASTER an d TXMODE indicate the master/sla v[...]
-
Página 202
C8051F340/1/2/3/4/5/6/7 202 Rev. 0.5 SFR Definition 17.2. SMB0CN: SMBus Control Bit7: M ASTER: SMB us Mast er/Slave Indicator . This read-only bit indicates when the SMBus is operating as a master . 0: SMBus operating in Slave Mode. 1: SMBus operating in Master Mod e. Bit6: T XMODE: SMBus T ransmit Mode Indicator . This read-only bit indicates when[...]
-
Página 203
Rev. 0.5 203 C8051F340/1/2/3/4/5/6/7 Ta b l e 17.3. Sources for Hardware Changes to SMB0CN Bit Set by Hardware When: Cleared by Hardware When: MASTER • A ST AR T is gen erated. • A STOP is generated. • Arbitration is lost. TXMODE • ST AR T is generated . • SMB0DA T is written before the star t of an SMBus frame. • A ST ART is detected. [...]
-
Página 204
C8051F340/1/2/3/4/5/6/7 204 Rev. 0.5 17.4.3. Data Re gister The SMBus Data registe r SMB0DA T holds a byte of serial dat a to be transmi tted or one that has just been received. Sof tware may safely rea d or write to the da ta register when the SI flag is set. Sof twar e should not attempt to ac cess the SMB0DA T register wh en the SM Bus is enable[...]
-
Página 205
Rev. 0.5 205 C8051F340/1/2/3/4/5/6/7 Figure 17.5. T ypical Mast er T ransmitter Sequence A A A S W P Data Byte Data By te SLA S = START P = STOP A = ACK W = WR ITE SLA = Slave Addres s Received by SMBus Inte rface Transmi t ted by SMBus Interface Inter rup t Interrupt Inter rup t Interrupt[...]
-
Página 206
C8051F340/1/2/3/4/5/6/7 206 Rev. 0.5 17.5.2. Master Receiver Mode Serial data is receive d on SDA while t he serial c lock is output on SCL. The SMBus interfa ce generat es the ST ART condition and tr ansmits the first b yte cont aining the address of the tar get slave and the dat a direc - tion bit. In this case the data direction bit (R/W) will b[...]
-
Página 207
Rev. 0.5 207 C8051F340/1/2/3/4/5/6/7 17.5.3. Slave Receiver Mode Serial data is received on SDA and the clock is re ceived on SCL. When slave event s are enabled (INH = 0), the inter face en ters Slav e Rece iver Mo de wh en a ST ART followed by a s lav e addr ess an d dir ectio n bit (WRITE in this case) is received. Upon entering Slave Receiver M[...]
-
Página 208
C8051F340/1/2/3/4/5/6/7 208 Rev. 0.5 17.5.4. Slave T ransmitter Mode Serial dat a is transmi tted on SDA and the clock is re ceived on SCL . When slave even ts are en abled (INH = 0), the interface en ters Slave Receiver Mode ( to re ceive the sla ve address) when a ST ART followed by a slave address and direction bit (READ in this case) is receive[...]
-
Página 209
Rev. 0.5 209 C8051F340/1/2/3/4/5/6/7 Ta b l e 17.4. SMBus St atus Decoding Mode V alues Read Current SMbus S t ate T ypical Response Options Va l u e s Wri t te n Stat us Ve c t o r ACKRQ ARBLOST ACK ST A ST o ACK Master T ransmitter 111 0 0 0 X A master ST ART was gen erated. Load slave address + R/W into SMB0DA T . 0 0 X 11 0 0 000 A master data [...]
-
Página 210
C8051F340/1/2/3/4/5/6/7 210 Rev. 0.5 Slave T ransmitter 0100 000 A slave byte was transmitted; NACK received. No action required (expect - ing ST OP condition). 0 0 X 001 A slave byte was transmitted; ACK received. Lo ad SMB0DA T with next data byte to transmit. 0 0 X 01 X A Slave byte was transmitted; error detected. No action required (e xp ect -[...]
-
Página 211
Rev. 0.5 211 C8051F340/1/2/3/4/5/6/7 18. UART0 UART0 is an asynchronous , full duplex serial port offering modes 1 and 3 of the standard 805 1 UART . Enhanced baud rate su pport allows a wide r ange o f clock sour ces to gene rate st andard baud rates (de t ails in Section “18. 1. Enhanced Baud Rate Generation” on p age 212 ). Received data buf[...]
-
Página 212
C8051F340/1/2/3/4/5/6/7 212 Rev. 0.5 18.1. Enhanced Baud Rate Generation The UART 0 baud rate is generated by T imer 1 in 8-bit auto-reload mode. The TX clock is genera ted by TL1; the RX clock is generated by a copy of TL1 (shown as RX T imer in Figure 18.2 ), which is not user-accessible. Both TX and RX T imer overflows are divided by two to gen [...]
-
Página 213
Rev. 0.5 213 C8051F340/1/2/3/4/5/6/7 Figure 18.3. UART Interconnect Diagram 18.2.1. 8-Bit UART 8-Bit UART mode uses a total of 10 bits per dat a byte: one st art bit, e ight dat a bit s (LSB first), a nd one stop bit. Data are transm itted LSB firs t from the TX0 pin a nd received at the RX0 pin. On receive, the eight dat a bits are sto red in SBUF[...]
-
Página 214
C8051F340/1/2/3/4/5/6/7 214 Rev. 0.5 18.2.2. 9-Bit UART 9-bit UAR T mode uses a tot al of eleven bit s per data byte: a start bit, 8 data b its ( LSB first), a prog ramma - ble ninth dat a bit, and a stop bit. The state of the nint h transmit data bit is determ ined by the v alue in TB80 (SCON0.3), which is assigned by use r sof t ware. It ca n be [...]
-
Página 215
Rev. 0.5 215 C8051F340/1/2/3/4/5/6/7 Figure 18.6. UART Multi-Processor Mode Interconnect Diagram Master Device Slave Device TX RX RX TX Slave Device RX TX Slave Device RX TX V+[...]
-
Página 216
C8051F340/1/2/3/4/5/6/7 216 Rev. 0.5 SFR Definition 18.1. SCON0: Serial Port 0 Control Bit7: S0MODE: Serial Port 0 Operation Mode. This bit selects the U ART0 Operation Mode . 0: 8-bit UAR T with V ariable Baud Rate. 1: 9-bit UAR T with V ariable Baud Rate. Bit6: UNU SED. Read = 1b. Write = don’t care. Bit5: MCE0: Multiprocessor Communication Ena[...]
-
Página 217
Rev. 0.5 217 C8051F340/1/2/3/4/5/6/7 SFR Definition 18.2. SBUF0: Serial (UART0 ) Port Dat a Buffer Bits7–0: SBUF0[7:0]: Serial Da ta Buf fer Bit s 7–0 (MSB-LSB) This SFR accesses tw o registers; a transmit sh ift register and a receive latch re gister . When data is written to SBUF0, it goes to the transmit shift registe r and is held f or seri[...]
-
Página 218
C8051F340/1/2/3/4/5/6/7 218 Rev. 0.5 Ta b l e 18.1. T imer Settings for St andard Baud Rates Using The In ternal Oscillator Ta r g e t Baud Rate (bp s) Actual Baud Rate (bp s) Baud Rate Error Oscillator Divide Factor Tim er Cl o ck Source SCA1-SCA0 (pre-scale select* T1M* Tim e r 1 Reload Va l u e ( h e x ) SYSCLK = 12 MHz 230400 23076 9 0.16% 52 S[...]
-
Página 219
Rev. 0.5 219 C8051F340/1/2/3/4/5/6/7 19. UART1 (C8051F340/1/4/5 Only) UART1 is an asynch ronou s, full dup lex serial port of feri ng a variety of data formatting options. A dedicated baud rate generator with a 16-bi t timer and select able prescaler is included, which can generate a wide range of baud rates (det ails in Sect ion “19.1. Baud Rate[...]
-
Página 220
C8051F340/1/2/3/4/5/6/7 220 Rev. 0.5 19.1. Baud Rate Generator The UAR T1 baud rate is generated by a dedicated 16-bi t timer which runs fr om the controller ’s core clock (SYSCLK), and has prescaler options of 1, 4, 12, or 48. Th e timer and prescaler op tions combined allow for a wide selection of baud rates over many SYSCLK fre que ncies. The [...]
-
Página 221
Rev. 0.5 221 C8051F340/1/2/3/4/5/6/7 19.2. Dat a Format UART1 ha s a number of available options for d ata format ting. Data tr ansfers begin with a st art bit (logic low), followed by the data bit s (sent LSB- first), a parity or extra bit (if selecte d), and end with o ne or two stop bits (logic high ). The data len gth is variable between 5 and [...]
-
Página 222
C8051F340/1/2/3/4/5/6/7 222 Rev. 0.5 19.3. Configuration and Operation UART1 pro vides standa rd asynchronous, full d uplex communication. It can operate in a po int-to-point serial communications a pplication, or as a node on a multi-processor serial in terface. T o operate in a point-to-point application, where t here are only two devices on the [...]
-
Página 223
Rev. 0.5 223 C8051F340/1/2/3/4/5/6/7 byte in the FIFO. After SBUF1 is re ad, the next byte in the FIFO is loaded into SBUF 1, and space is made available in the FIFO for anothe r incoming byte. If enabled, an in terrupt will oc cur when RI1 is set. If the extra bit functio n is enabled (XBE1 = ‘1’) and the pa rity function is disabled (PE1 = ?[...]
-
Página 224
C8051F340/1/2/3/4/5/6/7 224 Rev. 0.5 SFR Definition 19.1. SCON1: UART1 Control Bit7: OVR1: Rece ive FIFO Over run Flag. This bit is used to indicate a re ceive F IF O ove r ru n con d itio n. 0: Receive F IFO Overrun has not occ urred. 1: Receive FIFO Overrun has occurred (an incom i ng character was discarded due to a full FIFO). This bit must be [...]
-
Página 225
Rev. 0.5 225 C8051F340/1/2/3/4/5/6/7 SFR Definition 19.2. SMOD1: UART1 Mode Bit7: M CE1: Multiprocessor Communication Enable . 0: RI will be activated if stop bit(s) are ‘1’. 1: RI will be activated if stop bit(s) and extra bit are ‘1’ (e xtra bit must be enabled using XBE1). Note: This function is not availabl e when hardware p arity is en[...]
-
Página 226
C8051F340/1/2/3/4/5/6/7 226 Rev. 0.5 SFR Definition 19.3. SBUF1: UART1 Data Buffer SFR Definition 19.4. SBCON1: UART1 Baud Rate Generator Control Bits7–0: SBUF1[7:0]: Serial Da ta Buf fer Bit s 7–0 (MSB-LSB) This SFR is used to both send data fro m th e UART an d to read received dat a from the UART1 receive FIFO. Write: W riting a byte to SBUF[...]
-
Página 227
Rev. 0.5 227 C8051F340/1/2/3/4/5/6/7 SFR Definition 19.5. SBRLH1: UART1 Baud Rate Generator High Byte SFR Definition 19.6. SBRLL1: UART1 Baud Rate Generator Low Byte Bits7–0: SBR LH1[7:0]: High Byte of relo ad value for UART1 Baud Rate Genera to r . R/W R/W R/W R/W R/W R/W R/W R/W Reset V alue 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR [...]
-
Página 228
C8051F340/1/2/3/4/5/6/7 228 Rev. 0.5 N OTES :[...]
-
Página 229
Rev. 0.5 229 C8051F340/1/2/3/4/5/6/7 20. Enhanced Serial Peri pheral Interface (SPI0) The Enhanced Ser ial Periphera l Interface (SPI0) pr ov ides access to a flexible, full-duplex synchronous serial bus. SPI 0 can oper ate as a m aster or sla ve devi ce in both 3-wire or 4-wire modes, and suppo rts mul - tiple masters and slaves on a single SPI b [...]
-
Página 230
C8051F340/1/2/3/4/5/6/7 230 Rev. 0.5 20.1. Signal Descriptions The four signals used by SPI0 (MOSI, MISO, SCK, NSS) are described below . 20.1.1. Master Out, Slave In (MOSI) The master-out, slave-in (MOSI) sig nal is an output fr om a master dev ice and an inpu t to slav e dev ices. It is used to serially trans fer data from the ma ster to th e sla[...]
-
Página 231
Rev. 0.5 231 C8051F340/1/2/3/4/5/6/7 20.2. SPI0 Master Mode Operation A SPI master device initiate s all data tra nsfers on a SPI bus. SPI0 is placed in master mode by setting the Master Enable flag (MSTEN, SPI0CN.6). W riting a byte of da ta to the SPI0 data reg ister (SPI0DA T) when in master mode writes to the transmit buf fe r . If the SPI shif[...]
-
Página 232
C8051F340/1/2/3/4/5/6/7 232 Rev. 0.5 Figure 20.2. Multiple-Master Mode Connect ion Diagram Figure 20.3. 3-Wire Single Master and Slave Mode Connection Diagram Figure 20.4. 4-Wire Single Master Mo de and Slave Mode Connection Diagram Master Device 2 Master Device 1 MOSI MISO SCK MISO MOSI SCK NSS GPIO NSS GPIO Slave Device Master Device MOSI MISO SC[...]
-
Página 233
Rev. 0.5 233 C8051F340/1/2/3/4/5/6/7 20.3. SPI0 Slave Mode Operation When SPI0 is enabled and not configured as a master , it will operate as a SPI slav e. As a slave, bytes are shifted in through the MOSI pin a nd out through the MISO pin by a ma ster device controlling the SCK sig - nal. A bit coun ter in the SPI0 lo gic count s SCK edges. When 8[...]
-
Página 234
C8051F340/1/2/3/4/5/6/7 234 Rev. 0.5 20.5. Serial Clock Timing Four combinations of ser ial clock p hase and polarity can be selected using the cloc k control bits in the SPI0 Configuration Register (SPI0CFG). The CKPHA bit ( SPI0CFG .5) selects one of two clock ph ases (edge used to latch the dat a). The CKPOL bi t (SPI0CFG .4) selects between an [...]
-
Página 235
Rev. 0.5 235 C8051F340/1/2/3/4/5/6/7 Figure 20.6. Slave Mode Data /Clock T iming (CKPHA = 0) Figure 20.7. Slave Mode Data /Clock T iming (CKPHA = 1) MSB Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 MIS O NSS (4-W i re Mode) MSB Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 MOSI SCK (CKPOL=0, C KPHA=0) SCK (CKPOL=1, C KPHA=0) SCK (CKPOL=0, CK PH A=1) SCK ([...]
-
Página 236
C8051F340/1/2/3/4/5/6/7 236 Rev. 0.5 20.6. SPI Special Function Registers SPI0 is accessed and controlled through four special function registers in the system contr oller: SPI0CN Control Register , SPI0DA T Data Re gister , SPI0CFG Configura tion Register , and SPI0CKR C lock Rate Register . The four special function registers related to the opera[...]
-
Página 237
Rev. 0.5 237 C8051F340/1/2/3/4/5/6/7 SFR Definition 20.2. SPI0CN: SPI0 Control Bit 7: SPIF: SPI0 Interrupt Flag. This bit is set to logic 1 by hardware at the end of a dat a trans fer . If interrupt s are enabled, setting this bit causes the CPU to vector to the SPI0 interrupt service routine. This bit is not automatically cleared by hardware. It m[...]
-
Página 238
C8051F340/1/2/3/4/5/6/7 238 Rev. 0.5 SFR Definition 20.3. SPI0CKR: SPI0 Clock Rate SFR Definition 20.4. SPI0DA T : SPI0 Dat a Bits 7–0: SCR7–SCR0: SPI0 Clock Rate. These bit s determine the frequ ency of the SCK output when the SPI0 module is con figured for master mode operatio n. The SCK clock frequency is a divided vers ion of the system clo[...]
-
Página 239
Rev. 0.5 239 C8051F340/1/2/3/4/5/6/7 Figure 20.8. SPI Master Tim in g (C K PH A = 0 ) Figure 20.9. SPI Master Tim in g (C K PH A = 1 ) SCK* T MCKH T MCKL MOSI T MIS MISO * SCK is shown f or CKPOL = 0. SCK is the opposite polarity for CKPOL = 1. T MIH SCK* T MCKH T MCK L MISO T MIH MOSI * SCK is sh own for CKPOL = 0. SCK is the opposite polarity for[...]
-
Página 240
C8051F340/1/2/3/4/5/6/7 240 Rev. 0.5 Figure 20.10. SPI Slave Timing (CKPHA = 0) Figure 20.1 1. SPI Slave Timing (CKPHA = 1) SCK* T SE NSS T CKH T CKL MOSI T SIS T SIH MISO T SD T SOH * SCK is shown for CKPOL = 0. SCK is the op posite polarity for CKPOL = 1. T SEZ T SDZ SCK* T SE NSS T CKH T CKL MOSI T SIS T SIH MISO T SD T SOH * SCK is shown for CK[...]
-
Página 241
Rev. 0.5 241 C8051F340/1/2/3/4/5/6/7 Ta b l e 20.1. SPI Slave Timing Parameters Paramete r Description Min Max Unit s Master Mode T iming* (See Figure 20.8 and Figure 20 .9) T MCKH SCK High T ime 1 x T SYSCLK ns T MCKL SCK Low T ime 1 x T SYSCLK ns T MIS MISO V a lid to SCK Shift Edge 1 x T SYSCLK + 20 ns T MIH SCK Shift Edge to MISO Change 0 ns Sl[...]
-
Página 242
C8051F340/1/2/3/4/5/6/7 242 Rev. 0.5 N OTES :[...]
-
Página 243
Rev. 0.5 243 C8051F340/1/2/3/4/5/6/7 21. T imers Each MCU includes four counter/timers: two ar e 16-bit counter/time rs compatible with th ose found in the standar d 8051, and two are 16 -bit auto-reload timer for use with th e ADC, SMBus, USB (frame measure - ments), Low-Frequency Oscillator (p eriod measurements), or for general purpose use. Thes[...]
-
Página 244
C8051F340/1/2/3/4/5/6/7 244 Rev. 0.5 The C/T0 bit (TMOD.2) selects the cou nter/timer's cloc k source. Whe n C/T0 is set to logic 1, high-to-low transitions at the selected T imer 0 input pin (T0) incremen t the timer register (Refer to Se ction “15.1. Priority Crossbar Decoder” on p age 149 for information on selecting and configuring ext[...]
-
Página 245
Rev. 0.5 245 C8051F340/1/2/3/4/5/6/7 21.1.3. Mode 2: 8-bit Counter/Timer with Auto-Reload Mode 2 configur es T imer 0 and T imer 1 to ope rate as 8- bit counter/time rs with automatic reload of the st art value. TL0 holds the count and T H0 holds the reload va lue. When the counte r in TL0 overflows from a ll ones to 0x00, the timer over flo w flag[...]
-
Página 246
C8051F340/1/2/3/4/5/6/7 246 Rev. 0.5 21.1.4. Mode 3: T wo 8-bit Counter/T imers (T imer 0 Only) In Mode 3, T imer 0 is configured as two separate 8- bit counter/time rs held in TL0 and TH0. The coun ter/ timer in TL0 is co ntrolled using the T imer 0 control/status bits in TCO N and TMOD: T R0, C/T0, GA TE0 a nd TF0. TL0 can use ei ther the system [...]
-
Página 247
Rev. 0.5 247 C8051F340/1/2/3/4/5/6/7 SFR Definition 21.1. TCON: T imer Control Bit7: TF1: Timer 1 Over flow Flag. Set by hardware when T imer 1 overflows. This flag can be cleared by soft ware but is auto- matically cleared when the CPU vectors to the T imer 1 interrupt service routine. 0: No T imer 1 overflow det ec te d. 1: T imer 1 has overflowe[...]
-
Página 248
C8051F340/1/2/3/4/5/6/7 248 Rev. 0.5 SFR Definition 21.2. TMOD: Timer Mode Bit7: GA TE1: Ti me r 1 Gate Control. 0: T imer 1 enabled when TR1 = 1 irres pe ctiv e of /IN T1 log ic leve l. 1: T imer 1 enabled only whe n TR1 = 1 AND /INT1 is active as defined by bit IN1PL in regis- ter INT01CF (see SFR Definition 9.13). Bit6: C/T1: C ounter/T imer 1 S[...]
-
Página 249
Rev. 0.5 249 C8051F340/1/2/3/4/5/6/7 SFR Definition 21.3. CKCON: Clock Control Bit7: T3MH: T imer 3 H igh Byte Clock Select. This bit selects th e clock supplied to the T imer 3 high byte if T imer 3 is configured in sp lit 8-bit timer mode. T3MH is ignor ed if T imer 3 is in any other mode. 0: T imer 3 high byte uses the clock defined by the T3XCL[...]
-
Página 250
C8051F340/1/2/3/4/5/6/7 250 Rev. 0.5 SFR Definition 21.4. TL0: T imer 0 Low Byte SFR Definition 21.5. TL1: T imer 1 Low Byte SFR Definition 21.6. TH0: T imer 0 High Byte SFR Definition 21.7. TH1: T imer 1 High Byte Bits 7–0 : TL0: T imer 0 Lo w Byte. The TL0 re gister is the low byte of th e 16-bit Timer 0. R/W R/W R/W R/W R/W R/W R/W R/W Res et [...]
-
Página 251
Rev. 0.5 251 C8051F340/1/2/3/4/5/6/7 21.2. Timer 2 T imer 2 is a 16-bit time r formed by two 8-bi t SFRs: TMR2L (low byte) and TMR2H (high by te). T imer 2 may operate in 16-bit a uto-reload mode, (sp lit) 8-bit auto-reload mode, USB S tart-of-Frame (SOF) ca pture mode, or Low-Frequency Os cillator (LFO) Falling Edge capture mode. The Timer 2 opera[...]
-
Página 252
C8051F340/1/2/3/4/5/6/7 252 Rev. 0.5 21.2.2. 8-bit Timers with Auto-Reload When T2SPLIT = ‘ 1’ and T2CE = ‘0’, T imer 2 operates as two 8-bit timers ( TMR2H and TMR2L) . Both 8-bit timers operate in auto-reload mode as shown in Figur e 21.5 . TMR2RLL holds the reload value for TMR2 L; TMR2RLH holds the re load value for TMR2H. The TR2 bit i[...]
-
Página 253
Rev. 0.5 253 C8051F340/1/2/3/4/5/6/7 21.2.3. Timer 2 Capture Modes: USB S t art-of-Fra me or LFO Falling Edge When T2CE = ‘1’, T imer 2 will operate in one of two special capture modes. The capture event can be selected between a USB S tart-of-Frame (SOF) capture, and a Low- Frequency Oscillator (LFO) Falling Edge capture, using the T2CSS bit. [...]
-
Página 254
C8051F340/1/2/3/4/5/6/7 254 Rev. 0.5 When T2SPLIT = ‘1’, the T imer 2 registers (TMR2H and TMR2L) act as two 8-bit counte rs. Each counter counts up indepe ndently and overflows fro m 0xFF to 0x00. Each time a capture event is r eceived, the con - tents of the Timer 2 registers ar e latched into th e T imer 2 Reload registers (T MR2RLH and TMR2[...]
-
Página 255
Rev. 0.5 255 C8051F340/1/2/3/4/5/6/7 SFR Definition 21.8. TMR2CN: Timer 2 Control Bit7: T F2H: T imer 2 High Byte Overflow Flag. Set by hardware when the T imer 2 high byte ov erflows from 0xFF to 0x00. In 16 bit mod e, this will occur when T imer 2 overflows from 0xFF FF to 0x0000. When the T imer 2 inte rrupt is enabled, sett ing this bit ca uses[...]
-
Página 256
C8051F340/1/2/3/4/5/6/7 256 Rev. 0.5 SFR Definition 21.9. TMR2RLL: Timer 2 Relo ad Register Low Byte SFR Definition 21.10. TMR2RLH: T imer 2 Relo ad Register High Byte SFR Definition 21.1 1. TMR2L: Timer 2 Low Byte SFR Definition 21.12. TMR2H T imer 2 High Byte Bits 7–0: TMR2RLL: T imer 2 Reload Register Low Byte. TMR2RLL holds the low byte of th[...]
-
Página 257
Rev. 0.5 257 C8051F340/1/2/3/4/5/6/7 21.3. Timer 3 T imer 3 is a 16-bit time r formed by two 8-bi t SFRs: TMR3L (low byte) and TMR3H (high by te). T imer 3 may operate in 16-bit a uto-reload mode, (sp lit) 8-bit auto-reload mode, USB S tart-of-Frame (SOF) ca pture mode, or Low-Frequency Os cillator (LFO) Rising Edge capture mode. The T imer 3 opera[...]
-
Página 258
C8051F340/1/2/3/4/5/6/7 258 Rev. 0.5 21.3.2. 8-bit Timers with Auto-Reload When T3SPLIT is ‘1’ and T3CE = ‘0’, T imer 3 operates as two 8-bi t timers (TMR3H and TMR3L). Both 8-bit timers operate in auto-reload mode as shown in Figur e 21.5 . TMR3RLL holds the reload value for TMR3 L; TMR3RLH holds the re load value for TMR3H. The TR3 bit in[...]
-
Página 259
Rev. 0.5 259 C8051F340/1/2/3/4/5/6/7 21.3.3. USB St art-of-Frame Capture When T3CE = ‘1’, T imer 3 will operate in one of two special capture modes. The capture event can be selected between a USB S t art-of-Frame (SOF) captur e, and a Low-Fr equency Oscillator (LFO) Rising Edge capture, using the T3CSS bit. T he USB SOF capt ure mode can be us[...]
-
Página 260
C8051F340/1/2/3/4/5/6/7 260 Rev. 0.5 When T3SPLIT = ‘1’, the T imer 3 registers (TMR3H and TMR3L) act as two 8-bit counte rs. Each counter counts up indepe ndently and overflows fro m 0xFF to 0x00. Each time a capture event is r eceived, the con - tents of the Timer 3 registers ar e latched into th e T imer 3 Reload registers (T MR3RLH and TMR3[...]
-
Página 261
Rev. 0.5 261 C8051F340/1/2/3/4/5/6/7 SFR Definition 21.13. TMR3CN: T imer 3 Control Bit7: T F3H: T imer 3 High Byte Overflow Flag. Set by hardware when the T imer 3 high byte ov erflows from 0xFF to 0x00. In 16 bit mod e, this will occur when T imer 3 overflows from 0xFF FF to 0x0000. When the T imer 3 inte rrupt is enabled, sett ing this bit ca us[...]
-
Página 262
C8051F340/1/2/3/4/5/6/7 262 Rev. 0.5 SFR Definiti on 21.14. TMR3RLL: Timer 3 Reload Register Low Byte SFR Definition 21.15. TMR3RLH: T imer 3 Relo ad Register High Byte SFR Definition 21.16. TMR3L: T imer 3 Low Byte SFR Definition 21.17. TMR3H T imer 3 High Byte Bits 7–0: TMR3RLL: T imer 3 Reload Register Low Byte. TMR3RLL holds the low byte of t[...]
-
Página 263
Rev. 0.5 263 C8051F340/1/2/3/4/5/6/7 22. Programmable Counter Array (PCA0) The Programmable Cou nter Array (PCA0) provides enh anced timer functionality while req uiring less CPU intervention th an the standard 80 51 counter/timers. Th e PCA co nsists of a dedicat ed 16-bit counter/timer and five 16-bit capt ure/compare module s. Each c apture/comp[...]
-
Página 264
C8051F340/1/2/3/4/5/6/7 264 Rev. 0.5 22.1. PCA Counter/Timer The 16-bit PCA counter/tim er consists o f two 8-bi t SFRs: PCA0L and PCA0H. PCA0H is the high byte (MSB) of the 16-b it counter/timer an d PCA0L is the low byte (LSB). Reading PCA0L automatically latche s the value of P CA0H into a “sna pshot” register; the following PCA0H r ead acce[...]
-
Página 265
Rev. 0.5 265 C8051F340/1/2/3/4/5/6/7 22.2. Capture/Comp are Modules Each module can b e configured to op erate independen tly in one of six operation modes: Edge-triggered Capture, Soft ware T imer , High S peed Output, Frequency Output, 8-Bit Pulse Wid th Modulator , or 16-Bit Pulse Width Modulat or . Each module has S pecial Functi on Registers ([...]
-
Página 266
C8051F340/1/2/3/4/5/6/7 266 Rev. 0.5 22.2.1. Edge-triggered Capture Mode In this mode, a valid transition on the CEXn pin ca uses the PCA to capture th e value of the PCA counter/ timer and load it into the corr esponding module' s 16-bit capture/comp are register (PCA0CPL n and PCA0CPHn). The CAPPn and CAPNn bits in the PCA0CPMn re giste r ar[...]
-
Página 267
Rev. 0.5 267 C8051F340/1/2/3/4/5/6/7 22.2.2. Software T imer (Comp are) Mode In Sof twa re T imer mode, the PCA counter/timer valu e is comp ared to the module' s 16-bit capture/ comp ar e register (PCA0CPHn and PCA0CPLn) . When a match o ccurs, the Capture/Comp are Flag ( CCFn) in PCA0CN is set to logic 1 and an interrupt requ est is generate[...]
-
Página 268
C8051F340/1/2/3/4/5/6/7 268 Rev. 0.5 22.2.3. High Speed Output Mode In High S peed Output mode, a module’ s associated CEXn pin is toggled ea ch time a match occu rs between the PCA Co unter and the mod ule's 16- bit capture/compar e register (PCA0CPHn and PCA0CPLn) Setting the T OGn, MA Tn, and ECOM n bi t s in the PCA0CPMn regis ter enable[...]
-
Página 269
Rev. 0.5 269 C8051F340/1/2/3/4/5/6/7 22.2.4. Frequency Output Mode Frequency Output Mode p roduces a programmable- freq uency squar e wave on the module’ s associated CEXn pin. The ca pture/compare mo dule high byte holds the number of PCA clocks to count before the out - put is toggled. The frequency of the squar e wave is then de fined by Equat[...]
-
Página 270
C8051F340/1/2/3/4/5/6/7 270 Rev. 0.5 22.2.5. 8-Bit Pulse Wid th Modulator Mode Each module can be u sed inde pende ntly to gen erate a pulse wid th mod ulated (PWM ) outp ut on it s associ - ated CEXn pin. The frequency of the output is de pe ndent on the timebase for the PCA counter/timer . The duty cycle of the PWM output signal is varied usin g [...]
-
Página 271
Rev. 0.5 271 C8051F340/1/2/3/4/5/6/7 22.2.6. 16-Bit Pulse Wid th Modulator Mode A PCA module may also be o perate d in 16-Bit PWM mod e. In th is m ode , the 16- bit captu re/comp are mod - ule defines the numbe r o f PCA clocks for the low tim e of the PWM signal. When the PCA counter m atches the module content s, the output on CEXn is asserted h[...]
-
Página 272
C8051F340/1/2/3/4/5/6/7 272 Rev. 0.5 22.3. W atchdog Timer Mode A programmable wa tchdog timer (WDT) function is avai l able throu gh the PCA Module 4. The WDT is used to generate a reset if the time between writes to th e WDT up da te reg ister ( PCA0 CPH4 ) exceed a spe cified limit. The WDT can be configured and en abled/disabled as needed by so[...]
-
Página 273
Rev. 0.5 273 C8051F340/1/2/3/4/5/6/7 Equation 22.4. W atchdog Timer Offset in PCA Clocks The WDT reset is gener ated when PCA0L overflo w s while there is a match betwe en PCA0CPH4 and PCA0H. Software may force a WDT reset by wr iting a ‘1’ to the CCF4 flag (PCA0CN.4) while the WDT is enabled. 22.3.2. W atchdog Ti mer Usage T o configure the WD[...]
-
Página 274
C8051F340/1/2/3/4/5/6/7 274 Rev. 0.5 22.4. Register Descriptions for PCA Following are deta iled descriptions of the special function regi sters related to the operation of the PCA. SFR Definition 22.1. PCA0CN: PCA Control Bit7: CF: P CA Counter/T imer Overflow Flag. Set by hardware when the PCA Counter/T ime r overflows from 0xFFFF to 0x0000 . Whe[...]
-
Página 275
Rev. 0.5 275 C8051F340/1/2/3/4/5/6/7 SFR Definition 22.2. PCA0MD: PCA Mode Bit7: CID L: PCA Counter/Timer Idle Control. S pecifies PCA behavior wh en CPU is in Idle Mode. 0: PCA continues to function normally while the system controller is in Idle Mode. 1: PCA operation is suspended while th e system controller is in Idle Mode. Bit6: WDTE: Watchdog[...]
-
Página 276
C8051F340/1/2/3/4/5/6/7 276 Rev. 0.5 SFR Definition 22.3. PCA0CPMn: PCA Capture/Compare Mode PCA0CPMn Address: PCA0CPM0 = 0xDA (n = 0), PCA0CPM1 = 0xDB (n = 1), PCA0CPM2 = 0xDC (n = 2), PCA0CP M3 = 0xDD (n = 3), PCA0CPM4 = 0xDE (n = 4) Bit7: PWM16n: 16-bit Pulse Width Modulation Ena ble. This bit selects 16- bit mode when Pulse Wid th Modulation mo[...]
-
Página 277
Rev. 0.5 277 C8051F340/1/2/3/4/5/6/7 SFR Definition 22.4. PCA0L: PCA Counter/T imer Low Byte SFR Definition 22.5. PCA0H: PCA Counter /Timer High Byte SFR Definition 22.6. PCA0CPLn: PCA Capture Module Low Byte Bits 7–0: PCA0L: PCA Counter/T imer Low Byte. The PCA0L register holds the low byte (LSB) of the 16-bit PCA Counter/T imer . R/W R/W R/W R/[...]
-
Página 278
C8051F340/1/2/3/4/5/6/7 278 Rev. 0.5 SFR Definition 22.7. PCA0CPHn: PCA Captur e Module High Byte PCA0CPHn Address: PCA0CPH0 = 0xFC (n = 0), PCA0CPH1 = 0xEA (n = 1), PCA0CPH2 = 0xEC (n = 2), PCA0CPH3 = 0xEE (n = 3), PCA0CPH4 = 0xFE (n = 4) Bits7–0: PCA0CPHn: PCA Capture Mod ule High Byte. The PCA0CPHn register holds the high byte (MSB) of the 16-[...]
-
Página 279
Rev. 0.5 279 C8051F340/1/2/3/4/5/6/7 23. C2 Interface C8051F340/1/2/3/4/5/6/7 devic es include an on-chip Silicon Labs 2- Wire (C2) debug in terface to allow Flash programming a nd in-system debuggin g with the produ ction p art inst alled in the end application. The C2 interface uses a clock signal (C2CK) and a bi- direc tional C2 da ta signal (C2[...]
-
Página 280
C8051F340/1/2/3/4/5/6/7 280 Rev. 0.5 C2 Register Definition 23.3. REVID: C2 Revision ID C2 Register Definition 23.4. FPCTL: C2 Flash Programming Control C2 Register Definition 23.5. FPDA T : C2 Flash Programming Data This read-on ly register r eturns the 8- bit revision ID . Reset V alue Va r i a b l e Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7?[...]
-
Página 281
Rev. 0.5 281 C8051F340/1/2/3/4/5/6/7 23.2. C2 Pin Sharing The C2 protocol allows th e C2 pins to be shar ed wi th user functions so that in-system debugging and Flash programming fun ctions may be performed. This is possible because C2 communication is typically performed when the device is in th e halt sta te, where all on-chip periphe rals and us[...]
-
Página 282
C8051F340/1/2/3/4/5/6/7 282 Rev. 0.5 C ONT ACT I NFORMATION Silicon Laborato ries Inc. 4635 Boston Lane Austin, TX 78735 T el: 1+(512) 416-8500 Fax: 1+(512) 416-9669 T oll Free: 1+(87 7) 444-3032 Email: MCUinfo@silabs.com Internet: www .silabs.com Silicon Laboratories and Silicon Labs are trademarks of Silico n Laboratories Inc. Other products or b[...]