PIC18F8723 数据手册
PIC18F系列单片机
在正常情况下:OSC2段输出的波形应当是一个平滑的正 弦波,其峰峰值应当在4~5V之间(VDD=5V)。 检验方法:在最高电压和最低温度下测量输出波形应最大。 如果在VDD和VSS附近波形出现限幅或失真,而电容过大 又影响频率时可以通过增加RS的方法。但是RS过大又会造 成电路易受干扰。所以RS应当在10K左右,当RS过大可以 适当增加C2的方法协调。总之RS、C2的值尽可能的接近 厂家的要求(RS<10K、C2=20~32pf)。
时钟系统原理图
主振荡器 OSC2 SLEEP OSC1 施密特触发器 T1OSO T1OSCEN T1OSI
时钟源选择
4×PLL
FOSC2:FOSC0
MUX
TSCLK
TIMER1振荡器
其他模块的 时钟源选项
2.2 振荡器控制寄存器OSCCON
OSCCON寄存器用于系统时钟在主振荡器与 TIMR1之间的切换控制。 其中D7~D1:未用位,读出值为0; D0:SCS系统时钟切换位。 1. 如果OSCSEN=0 ,且T1OSCEN=1则: SCS=1时,系统时钟切换到Timer1振荡器/时钟引 脚; SCS=0时,系统时钟使用主振荡器/时钟引脚。 D7 D0 2. 如果OSCSEN=0 、T1OSCEN为其它状态,SCS=0。 SCS
无增益、关闭振 荡器节省电流
频率最高的应用 内部频率为外部 频率的4倍
1:0:1
ECIO
I/O
时钟输出 外部时钟输入模 式,可由CMOS 驱动
1:0:0
EC
FOSC2: FOSC0
OSC 模式 RC
OSC反相器增 OSC2/CLKO 益 引脚功能
无增益、关闭振 荡器节省电流
PIC18F2525_05中文资料
PIC18F2525_05中⽂资料2005 Microchip Technology Inc.DS80222B-page 1PIC18F2525/2620/4525/4620Clarifications/Corrections to the Data Sheet:In the Device Data Sheet (DS39626B ), the following clarifications and corrections should be noted. Any silicon issues related to the PIC18F2525/2620/4525/4620 devices will be reported in a separate silicon errata. Please check the Microchip web site for any existing issues.1.Module:I/O PortsThe TRIS setting for the TX pin on PORTC in T able 10-5 of the Device Data Sheet was incorrectly stated as ‘1’.The correct TRIS setting for the TX pin on PORTC is ‘0’.2.Module:ResetsThe PR2 initialization condition shown in Table 4-4RESET Instruction,Stack Resets and Wake-up via WDT or Interrupt should read “uuuu uuuu ” as shown in the following table (changes are shown in bold text):3.Module:Voltage-Frequency GraphThe title information for Figure 26-2: Voltage-Frequency Graph (Extended), references the wrong device family and has been changed to read as follows:FIGURE 26-2:PIC18F2525/2620/4525/4620 VOLTAGE-FREQUENCY GRAPH (EXTENDED)TABLE 4-4:INITIALIZATION CONDITIONS FOR ALL REGISTERSRegisterApplicable DevicesPower-on Reset,Brown-out Reset MCLR Resets,WDT Reset,RESET Instruction,Stack ResetsWake-up via WDT or Interrupt PR225252620452546201111 1111uuuu uuuuuuuu uuuuLegend:u = unchanged, x = unknown, - = unimplemented bit, read as ‘0’, q = value depends on condition.Shaded cells indicate conditions do not apply for the designated device.PIC18F2525/2620/4525/4620 Data Sheet ErrataPIC18F2525/2620/4525/4620DS80222B-page 2? 2005 Microchip Technology Inc.4.Module:DC CharacteristicsIn Section 26.3 “DC Characteristics” (page 336),the specifications for V IL parameters D033B and D034 have been clarified and now read as follows:5.Module:A/D Converter CharacteristicsIn Table 26-24: A/D Converter Characteristics (page 359), specification A40 has been added:TABLE 26-24:A/D CONVERTER CHARACTERISTICS:PIC18FX525/X620 (INDUSTRIAL, EXTENDED)PIC18LFX525/X620 (INDUSTRIAL)6.Module:Instruction SetIn Table 24-2: PIC18FXXXX Instruction Set (pages 270-271), the ADDWF , ADDWFC and BTG instructions have been modified. The changes are shown in bold text:26.3DC Characteristics:PIC18F2525/2620/4525/4620 (Industrial, Extended)PIC18LF2525/2620/4525/4620 (Industrial)DC CHARACTERISTICS Standard Operating Conditions (unless otherwise stated)Operating temperature -40°C ≤ T A ≤+85°C for industrialParamNo.Symbol CharacteristicMinMaxUnitsConditionsV ILInput Low Voltage D033B D034OSC1T13CKIV SS V SS0.30.3V VXT, LP modesParamNo.Symbol CharacteristicMin Typ Max Units Conditions A40I ADA/D Current from V DD PIC18FXXXX—180—µA Average current during conversionPIC18LFXX20—90—µATABLE 26-25:PIC18FXXXX INSTRUCTION SETMnemonic,OperandsDescriptionCycles16-Bit Instruction WordStatus AffectedNotesMSbLSbBYTE-ORIENTED OPERATIONS ADDWF ADDWFC f, d, a f, d, a Add WREG and fAdd WREG and Carry bit to f 110010001001da 00da ffff ffff ffff ffff C, DC, Z, OV, N C, DC, Z, OV, N 1, 21, 2BIT-ORIENTED OPERATIONSBTG f, b , aBit Toggle f10111bbbaffffffff None1, 2Note 1:When a Port register is modified as a function of itself (e.g., MOVF PORTB, 1, 0), the value used will be that value present on the pins themselves. For example, if the data latch is ‘1’ for a pin configured as input and is driven low by an external device, the data will be written back with a ‘0’.2:If this instruction is executed on the TMR0 register (and where applicable, ‘d’ = 1), the prescaler will be cleared if assigned. PIC18F2525/2620/4525/4620 7.Module:Timing Diagrams andSpecificationsTable 26-6: External Clock Timing Requirements(page 343), has been revised (changes andadditions are shown in bold text).TABLE 26-6:EXTERNAL CLOCK TIMING REQUIREMENTS8.Module:EUSARTThe RX pin sampling information in Section 18.1.2“Sampling” has changed. This section now reads as follows:18.1.2SAMPLINGThe data on the RX pin is sampled three times by a majority detect circuit to determine if a high or a low level is present at the RX pin when SYNC is clear or when BRG16 and BRGH are both not set.The data on the RX pin is sampled once when SYNC is set or when BRGH16 and BRGH are both set.9.Module:MSSPIn Section 17.3.2 “Operation”, the following note has been added:10.Module:QFNIn the QFN pin diagram on page 3 and in Table1-3: PIC18F4525/4620 Pinout I/O Descriptions, the following note has been added: Note:It is recommended to connect the bottom pad of QFN package parts to V SS.Param.No.Symbol Characteristic Min Max Units Conditions1A F OSC External CLKI Frequency(1)DC1MHz XT, RC Oscillator modeDC25MHz HS Oscillator modeDC31.25kHz LP Oscillator modeDC40MHz EC Oscillator modeOscillator Frequency(1)DC4MHz RC Oscillator mode0.14MHz XT Oscillator mode425MHz HS Oscillator mode410MHz HS + PLL Oscillator mode5200kHz LP Oscillator mode1T OSC External CLKI Period(1)1000—ns XT, RC Oscillator mode40—ns HS Oscillator mode32—µs LP Oscillator mode25—ns EC Oscillator modeOscillator Period(1)250—ns RC Oscillator mode2501µs XT Oscillator mode40250ns HS Oscillator mode100250ns HS + PLL Oscillator mode5200µs LP Oscillator modeNote1:Instruction cycle period (T CY) equals four times the input oscillator time base period for all configurations except PLL. All specified values are based on characterization data for that particular oscillator type under standard operating conditions with the device executing code. Exceeding these specified limits may result in an unstable oscillator operation and/or higher than expected current consumption. All devices are tested to operate at “min.” values with an external clock applied to the OSC1/CLKI pin. When an external clockinput is used, the “max.” cycle time limit is “DC” (no clock) for all devices.Note:The SSPBUF register cannot be used withread-modify-write instructions, such asBCF, BTFSC, COMF, etc.2005 Microchip Technology Inc.DS80222B-page 3PIC18F2525/2620/4525/4620DS80222B-page 4? 2005 Microchip Technology Inc.11.Module:Electrical CharacteristicsParameters D031A and D041A have been added to Section 26-3 “DC Characteristics”, as shown below:12.Module:Electrical CharacteristicsIn Table 26-1: Memory Programming Require-ments, parameters D132, D132A, D133 and D133A have been changed. The changes are shown in bold :TABLE 26-1:MEMORY PROGRAMMING REQUIREMENTS13.Module:Pinout I/O DescriptionsThe QFN column has been removed from T able 1-2:PIC18F2525/2620 Pinout I/O Descriptions.The PIC18F2525/2620 devices are not available in a QFN package.26.3DC Characteristics:PIC18F2525/2620/4525/4620 (Industrial)PIC18LF2525/2620/4525/4620 (Industrial)DC CHARACTERISTICS Standard Operating Conditions (unless otherwise stated)Operating temperature -40°C ≤ T A ≤+85°C for industrialParamNo.Symbol CharacteristicMinMaxUnitsConditionsV ILInput Low Voltage I/O ports:D031Awith SMBus bufferV SS0.8VV IHInput High Voltage I/O ports:D041Awith SMBus buffer2.1V DDVDC CHARACTERISTICS Standard Operating Conditions (unless otherwise stated)Operating temperature -40°C ≤ T A ≤+85°C for industrialParam No.SymCharacteristicMinTyp?MaxUnitsConditionsProgram Flash MemoryD132V IE V DD for Block Erase3.0— 5.5V Using ICSP? port, 25°C D132A V IW V DD for Externally Timed Erase or Write4.5—5.5V Using ICSP port, 25°C D133T IEICSP Block Erase Cycle Time —4—ms V DD ≥ 4.5V D133A T IW ICSP Erase or Write Cycle Time (externally timed) 1——ms V DD ≥ 4.5V, 25°CD133A T IWSelf-Timed Write Cycle Time—2—msPIC18F2525/2620/4525/4620REVISION HISTORYRev A Document (01/2005)First revision of this document.Data Sheet Clarification issues 1 (I/O Ports),2(Resets), 3 (Voltage-Frequency Graph), 4 (DCCharacteristics), 5 (A/D Converter Characteristics),6(Instruction Set) and 7 (Timing Diagrams andSpecifications).Rev B Document (09/2005)Added Data Sheet Clarification issues 8 (EUSART), 9(MSSP), 10 (QFN), 11-12 (Electrical Characteristics)and 13 (Pinout I/O Descriptions).2005 Microchip Technology Inc.DS80222B-page 5PIC18F2525/2620/4525/4620NOTES:DS80222B-page 6? 2005 Microchip Technology Inc.2005 Microchip Technology Inc.DS80222B-page 7Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with yourspecifications.MICROCHIP MAKES NO REPRESENTATIONS OR WAR-RANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED,WRITTEN OR ORAL, STATUTORY OR OTHERWISE,REL ATED TO THE INFORMATION, INCL UDING BUT NOT L IMITED TO ITS CONDITION, QUAL ITY , PERFORMANCE,MERCHANTABI LITY OR FITNESS FOR PURPOSE .Microchip disclaims all liability arising from this information and its use. Use of Microchip’s products as critical components in life support systems is not authorized except with express written approval by Microchip. No licenses are conveyed,implicitly or otherwise, under any Microchip intellectual property rights.TrademarksThe Microchip name and logo, the Microchip logo, Accuron, dsPIC, K EE L OQ , micro ID , MPLAB, PIC, PICmicro, PICSTART, PRO MATE, PowerSmart, rfPIC, and SmartShunt areregistered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.AmpLab, FilterLab, Migratable Memory, MXDEV, MXLAB, PICMASTER, SEEVAL, SmartSensor and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A.Analog-for-the-Digital Age, Application Maestro, dsPICDEM,/doc/e4ada243e45c3b3567ec8bce.html , dsPICworks, ECAN, ECONOMONITOR, FanSense, FlexROM, fuzzyLAB, In-Circuit SerialProgramming, ICSP , ICEPIC, Linear Active Thermistor, MPASM, MPLIB, MPLINK, MPSIM, PICkit, PICDEM,/doc/e4ada243e45c3b3567ec8bce.html , PICLAB, PICtail, PowerCal, PowerInfo, PowerMate, PowerTool, rfLAB, rfPICDEM, Select Mode, Smart Serial, SmartTel, Total Endurance and WiperLock are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.All other trademarks mentioned herein are property of their respective companies.2005, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved.Printed on recycled paper.Note the following details of the code protection feature on Microchip devices:?Microchip products meet the specification contained in their particular Microchip Data Sheet.Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions.There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property.Microchip is willing to work with the customer who is concerned about the integrity of their code.Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.”Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.Microchip received ISO/TS-16949:2002 quality system certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona and Mountain View, California in October 2003. The Company’s quality system processes andprocedures are for its PICmicro ? 8-bit MCUs, K EE L OQ ? code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified.AMERICASCorporate Office2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7200Fax: 480-792-7277 Technical Support:/doc/e4ada243e45c3b3567ec8bce.html Web Address:/doc/e4ada243e45c3b3567ec8bce.html AtlantaAlpharetta, GATel: 770-640-0034Fax: 770-640-0307BostonWestborough, MATel: 774-760-0087Fax: 774-760-0088 ChicagoItasca, ILTel: 630-285-0071Fax: 630-285-0075DallasAddison, TXTel: 972-818-7423Fax: 972-818-2924DetroitFarmington Hills, MITel: 248-538-2250Fax: 248-538-2260 Kokomo Kokomo, INTel: 765-864-8360Fax: 765-864-8387Los AngelesMission Viejo, CATel: 949-462-9523Fax: 949-462-9608San JoseMountain View, CATel: 650-215-1444Fax: 650-961-0286 Toronto Mississauga, Ontario, Canada Tel: 905-673-0699Fax: 905-673-6509ASIA/PACIFICAustralia - SydneyTel: 61-2-9868-6733Fax: 61-2-9868-6755China - BeijingTel: 86-10-8528-2100Fax: 86-10-8528-2104 China - ChengduTel: 86-28-8676-6200Fax: 86-28-8676-6599 China - FuzhouTel: 86-591-8750-3506 Fax: 86-591-8750-3521 China - Hong Kong SAR Tel: 852-2401-1200Fax: 852-2401-3431China - QingdaoTel: 86-532-8502-7355 Fax: 86-532-8502-7205 China - ShanghaiTel: 86-21-5407-5533 Fax: 86-21-5407-5066 China - Shenyang Tel: 86-24-2334-2829 Fax: 86-24-2334-2393 China - Shenzhen Tel: 86-755-8203-2660 Fax: 86-755-8203-1760 China - ShundeTel: 86-757-2839-5507 Fax: 86-757-2839-5571 China - WuhanTel: 86-27-5980-5300 Fax: 86-27-5980-5118 China - XianTel: 86-29-8833-7250 Fax: 86-29-8833-7256 ASIA/PACIFICIndia - Bangalore Tel: 91-80-2229-0061 Fax: 91-80-2229-0062 India - New Delhi Tel: 91-11-5160-8631 Fax: 91-11-5160-8632 India - PuneTel: 91-20-2566-1512 Fax: 91-20-2566-1513 Japan - Yokohama Tel: 81-45-471- 6166 Fax: 81-45-471-6122 Korea - GumiTel: 82-54-473-4301 Fax: 82-54-473-4302 Korea - SeoulTel: 82-2-554-7200Fax: 82-2-558-5932 or 82-2-558-5934 Malaysia - Penang Tel: 604-646-8870 Fax: 604-646-5086 Philippines - Manila Tel: 632-634-9065 Fax: 632-634-9069 SingaporeTel: 65-6334-8870 Fax: 65-6334-8850 Taiwan - Hsin Chu Tel: 886-3-572-9526 Fax: 886-3-572-6459 Taiwan - Kaohsiung Tel: 886-7-536-4818 Fax: 886-7-536-4803 Taiwan - TaipeiTel: 886-2-2500-6610 Fax: 886-2-2508-0102 Thailand - Bangkok Tel: 66-2-694-1351 Fax: 66-2-694-1350 EUROPEAustria - WeisTel: 43-7242-2244-399 Fax: 43-7242-2244-393 Denmark - Copenhagen Tel: 45-4450-2828 Fax: 45-4485-2829 France - ParisTel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79 Germany - Munich Tel: 49-89-627-144-0Fax: 49-89-627-144-44Italy - MilanTel: 39-0331-742611Fax: 39-0331-466781Netherlands - DrunenTel: 31-416-690399Fax: 31-416-690340Spain - MadridTel: 34-91-352-30-52Fax: 34-91-352-11-47UK - WokinghamTel: 44-118-921-5869Fax: 44-118-921-5820 W ORLDWIDE S ALES AND S ERVICE 08/24/05DS80222B-page 8? 2005 Microchip Technology Inc.。
PIC18F2XK20_4XK20产品简介_41276a_cn
字
SRAM (字节)
数据 EEPROM (字节)
引脚
I/O
4K
512
256
28 25 10 通道 2 1/1 有 无 1 1
4K
512
256 40/44 36 13 通道 2 1/1 有 有 1 1
8K
768
256
28 25 10 通道 2 1/1 有 无 1 1
8K
768
256 40/44 36 13 通道 2 1/1 有 有 1 1
RA2/AN2/C2IN+/VREF-/CVREF RA3/AN3/C1IN+/VREF+ RA4/T0CKI/C1OUT
RA5/AN4/SS/LVDIN/C2OUT VSS
OSC1/CLKI/RA7 OSC2/CLKO/RA6
28 27 26 25 24 23 22
1
21
2
20
3
19
4 PIC18F2XK20 18
16K
1536
256
28 25 10 通道 2 1/1 有 无 1 1
16K
1536
256 40/44 36 13 通道 2 1/1 有 有 1 1
32K
3936
1024
28 25 10 通道 2 1/1 有 无 1 1
32K
3936
1024 40/44 36 13 通道 2 1/1 有 有 1 1
RC3/SCK/SCL
RD0/PSP0
RD1/PSP1
RD2/PSP2
RD3/PSP3
RC4/SDI/SDA
RC5/SDO
RC6/TX/CK
NC
34
MikroElektronika PIC18FK 4K 系列开发板说明书
Compact development system rich with on-board peripherals for all-round multimedia development on PIC18F67K40 device.for PIC18FKmikromediaNebojsa MaticGeneral ManagerThe PIC®, dsPIC®, PIC24®, PIC32® and Windows® logos and product names are trademarks of Microchip Technology® and Microsoft® in the U.S.A. and other countries.Introduction to mikromedia for PIC18FK4 Package Contains 5 Key Features 6 System Specification 7 1. Power supply 8Battery power supply 8 USB power supply 8 2. PIC18F67K40 microcontroller 9Key microcontroller features 9 3. Programming the microcontroller 10 Programming with mikroBootloader 11 step 1 – Connecting mikromedia 11 step 2 – Browsing for .HEX file 12 step 3 – Selecting .HEX file 12 step 4 – Uploading .HEX file 13 step 5 – Finish upload 14 Programing with mikroProg programmer15 mikroProg Suite for PIC® Software 16 Programing with ICD2® or ICD3® programmer 174. Reset Button 185. microSD Card Slot 196. Crystal oscillator 207. Audio Module 218. Touch Screen 229. Accelerometer 2310. USB connection 2411. Flash Memory 2512. Pinouts 2613. Dimensions 2714. Schematic 2815. Mikromedia accessories 32 What’s next? 33Table of Contentsit convenient platform for mobile devices.0916010203040506070809101112131415Connection Pads TFT 320x240 display Micro USB connector CHARGE indication LED LI-Polymer battery connector 3.5mm headphone connector Power supply regulator Serial Flash memory RESET buttonVS1053 Stereo mp3 coder/decoder PIC18F87J50 microcontroller Accelerometer Crystal oscillator Power indication LED microSD Card Slot ICD2/3 connector mikroProg connector170306070811101213141516040517System Specificationpower supplyVia USB cable (5V DC)board dimensions81.2 x 60.5 mm (3.19 x 2.38 inch)weight~45.5g (0.10lbs)power consumption52 mA with erased MCU (when back-light is ON)CAUTION: Electrostatic Sensitive DevicePermanent damage may occur on devices subjected to high energy electrostatic discharges which readily accumulate on the human body or test equipment and can discharge without detection.class B productProduct complies with the Class B limit of EN 55022 and can be used in the domestic, residential, commercial and industrial environments.USB power supply - You can apply power supply to the board using micro USB cable provided with the board. On-board voltage regulators provide the appropriate voltage levels to each component on the board. Power LED (green) will indicate the presence of power supply.You can also power the board using Li-Polymer battery, via on-board battery connector. On-board battery charger circuit MCP73832 enables you to charge the battery over USB connection. LED diode (RED) will indicate when battery is charging. Charging current is ~250mA and charging voltage is 4.2V DC.Battery power supplyUSB power supplyFigure 1-1: Connecting USB power supplyFigure 1-2: Connecting Li-Polymer batteryKey MCU features- 128K bytes Program Flash - 3568 Bytes Data SRAM - 1024 Bytes Data EEPROMSleep mode: Lowest Power ConsumptionPIC18F67K40 is a 64-Pin, low-power, high performance microcontroller with XLP technology. equipped with a 10-bit ADC with Computation (ADCC) automating Capacitive Voltage Divider (CVD) techniques for advanced touch sensing, averaging, filtering, oversampling and performing automatic threshold comparisons.The microcontroller can be programmed in three ways:01 02 03Via USB UART mikroBootloader Using mikroProg external programmer Using ICD2/3® external programmerPIC18F67K40 microcontrollerYou can program the microcontroller with a bootloader which is preprogrammed by default. To transfer .hex file from a PC to MCU you need bootloader software (mikroBootloader USB HID) which can be downloaded from:Figure 3-2: mikroBootloader windowstep 1 – Connecting clicker 2 for PIC18FK01To start, connect the USB cable, or if already connected pressthe Reset button on your clicker 2 for PIC18FK. Click the Connect button within 5s to enter the bootloader mode, otherwise existingmicrocontroller program will execute.After the mikroBootloader software is downloaded, unzip it to desired location and start it.https:///examples/starter-boards/clicker-2/pic18fk/clicker-2-pic18fk-mikrobootloader-v100.zipclicker 2 for PIC18FK Bootloader WinRAR ZIP archiveclicker 2 for PIC18FK Bootloader File folderSoftware File foldermikroBootloader USB.exeBootloader tool for mikroElektron...mikroElektronikaPIC18F67K40_Bootloader_Firmware_v100.hex HEX FileFirmware File folder01step 3 – Selecting .HEX filestep 2 – Browsing for .HEX file Figure 3-3: Browse for HEXFigure 3-4: Selecting HEX0101020101Click the Browse for HEX button and from apop-up window (Figure 3-4) choose the .HEX file which will be uploaded to MCU memory.Select .HEX file using open dialog window.Click the Open button.step 4 – Uploading .HEX fileFigure 3-5: Begin uploadingFigure 3-6: Progress bar010101To start .HEX file bootloading click theBegin uploading button.Progress bar enables you to monitor .HEX file uploading.step 5 – Finish uploadFigure 3-7: Restarting MCU Figure 3-8: mikroBootloader ready for next job010102Click OK button after the uploading process is finished.Press Reset button on clicker 2 for PIC18FK board and waitfor 5 seconds. Your program will run automatically.The microcontroller can be programmed with mikroProg programmer and mikroProg Suite for PIC ® software. The mikroProg programmer is connected to the development system via the CN6 connector, Figure 3-9.mikroProg is a fast USB 2.0 programmer with mikroICD ™ hardware In-Circuit Debugger. Smart engineering allows mikroProg ™ to support PIC10®, PIC12®, PIC16®, PIC18®, dsPIC30/33®, PIC24® and PIC32® devices in a single programmer. It supports over 570 microcontrollers from Microchip ®. Outstanding performance, easy operation and elegant design are it’s key features.Programing with mikroProg programmerFigure 3-9:Connecting mikroProg to mikromediaspecial programming softwarecalled mikroProg Suite for PIC. Thissoftware is used for programmingof ALL Microchip® microcontrollerfamilies, including PIC10®, PIC12®,PIC16®, PIC18®, dsPIC30/33®, PIC24®and PIC32®. Software has intuitiveinterface and SingleClick™ programmingtechnology. Just by downloading thelatest version of mikroProg Suite yourprogrammer is ready to program newdevices. mikroProg Suite is updatedregularly, at least four times a year, soyour programmer will be more and morepowerful with each new release.Figure 3-10: Main window of mikroProg Suite for PIC® programming softwarePrograming with ICD2® or ICD3® programmerThe microcontroller can be also programmedwith ICD2® or ICD3® programmer. Theseprogrammers connects with mikromediaboard via ICD2 CONNECTOR BOARD.In order to enable the ICD2® and ICD3®programmers to be connected to thedevelopment system, it is necessary to providethe appropriate connector such as the ICD2CONNECTOR BOARD. This connector should befirst soldered on the CN5 connector. Then youshould plug the ICD2® or ICD3® programmerinto it, Figure 3-11.Figure 3-11:Connecting ICD2®or ICD3® programmerBoard is equipped with reset button, which is located at the top of the front side (Figure 4-2). If you want to reset the circuit, press the reset button. It will generate low voltage level on microcontroller reset pin (input). In addition, a reset can be externally provided through pin 27 on side headers(Figure 4-3).Figure 4-2: Frontal reset buttonFigure 4-1: Location of additional reset buttonFigure 4-1.5. microSD Card SlotFigure 6-1: microSD card slotBoard contains microSD card slot for using microSD cards in yourprojects. It enables you to store large amounts of data externally, thus savingmicrocontroller memory. microSD cards use Serial Peripheral Interface (SPI) forcommunication with the microcontroller.Figure 5-1:Crystal oscillator moduleBoard is equipped with 16MHz crystal oscillator (Y1) circuitthat provides external clock waveform to the microcontrollerCLKO and CLKI pins. This base frequency is suitable for further clockmultipliers and ideal for generation of necessary USB clock, which ensuresproper operation of bootloader and your custom USB-based applications.The use of crystal in all other schematics is implied even if it is purposely left out, because of the schematics clarity.Figure 8-2: 3.5mm headphones jackThe development system features a TFT 320x240 displaycovered with a resistive touch panel. Together they form afunctional unit called a touch screen. It enables data to beentered and displayed at the same time. The TFT display iscapable of showing graphics in 262.144 diffe r ent colors. Figure 7-1: Touch ScreenOn board ADXL345 accelerometer is used to measure accelerationin three axis: x, y and z. The accelerometer function is defined by theuser in the program loaded into the microcontroller. Communicationbetween the accelerometer and the microcontroller is performed viathe I2C interface.You can set the accelerometer address to 0 or 1 by re-soldering the SMDjumper (zero-ohm resistor) to the appropriate position. Jumper is placed inaddress 1 position by default.10. USB connectionFigure 9-1: ConnectingUSB cable to Micro USBconnectorPIC18F67K40 microcontroller has an integrated USB module, which enables you toimplement USB communication functionality to your mikromedia board. Connection withtarget USB host is done over micro USB connector which is positioned next to the battery connector.Figure 11-1: Flash memory moduleSince multimedia applications are getting increasingly demanding, it is necessary to provide additional memory spaceto be used for storing more data. The flash memory module enables the microcontroller to use additional 8Mbit flash memory. It is connected to the microcontroller via the Serial Peripheral Interface (SPI).VSYS RST GND GND RA0L RA1R RA2RC2RB4RC6RA4RC7RA5RG6RF0RA3RB0RB5RB1RB6RB2RB7RB3RH0RE0RH1RE1RD1RE2RD2RE3RD3RE4RD4RE5RA6RE6RA7RE7RG2RC3RG7RC4RD6RC5RD53.3V 3.3V GNDGNDSPI LinesInterrupt Lines Analog Lines Digital linesI2C Lines UART lines PWM lines81.1560.45 1.6 47144080LegendVCC-3V3R2610kC17100n0203BatteryBoost shieldPROTO shield0607Li-Polymer batteryWire Jumpers05mikroBUS shieldYou still don’t have an appropriate compiler? Locate PIC ® compiler that suits you best on our site:Choose between mikroC, mikroBasic and mikroPascal and download fully functional demo version, so you can begin building your first applications.Once you have chosen your compiler, and since you already got the board, you are ready to start writing your first projects. Visual TFT software for rapid development of graphical user interfaces enables you to quickly create your GUI. It will automatically create necessary code which is compatible with mikroElektronika compilers. Visual TFT is rich with examples, which are an excellent starting point for your future projects. Just load the example, read well commented code, and see how it works on hardware. Visual TFT is also available on our site:You have now completed the journey through each and every feature of mikromedia for PIC18FK board. You got to know it’s modules and organization. Now you are ready to start using your new board. We are suggesting several steps which are probably the best way to begin. We invite you to join the users of mikromedia ™ brand. You will find very useful projects and tutorials and can get help from a large ecosystem of users. Welcome!CompilerProjectsIf you want to learn more about our products, please visit our web site at If you are experiencing some problems with any of our products or just need additional information, please place your ticket at /supportIf you have any questions, comments or business proposals,do not hesitate to contact us at *****************。
PIC18 单片机学习
PIC18 单片机学习(程序实例)说明:18F基本模块初始化程序均在内,且测试通过,主程序可以调用各个程序!编译器使用PICC18//程序主要用于18F单片机学习#include <pic18.h> //18系列单片机头文件//-------------函数定义--------------void delay(unsigned int rr);void timer1(void);void SPI_Iint(void); //串行SPI输出设置函数void display(void);void i2cint(void); //i2c总线初始化程序void c64R(void); //i2c接口的EEPROM存储器(读程序)void c64W(void); //写程序void Start(void); //起始位发送函数void Stop(void); //停止位发送函数void WriteWait(void); //等待函数void Senddata(unsigned char data); //数据发送函数void Restart(void); //重复启动函数void Datain(void); //数据读入void Uartint(void); //通用同步/异步收发器初始化程序void Udatas(unsigned char dad); //UART数据发送void Uartrs(void); //串口接收数据发送函数void ADint(void); //AD模块初始化void shuchai(void);//-----------数据寄存器定义----------const unsigned char table[10]={0xee,0x82,0xdc,0xd6,0xb2,0x76,0x7e,0xc2,0xfe,0xf6}; //显示段码unsigned char buf[5]; //显示缓存unsigned char receive[10]; //定义接收缓存unsigned char dd; //定时器0,中断计数寄存器unsigned char save;unsigned char conet;unsigned char *Counter; //接收数据指针unsigned char DADh; //AD缓存,unsigned char DADl;unsigned int Dat;unsigned int Dat1; //保存上次的AD转换值,用于比volatile bit DADflage; //AD转换标志volatile bit I2Cerror; //I2C错误标志volatile bit Uartsend; //异步串口数据发送允许union //联合体用来对C64的地址进行操作!{unsigned char dizhi[2];unsigned int Adress;}add;#define AddLow add.dizhi[0]#define AddHigh add.dizhi[1]#define ADDss add.Adress//***********************************//初始化//***********************************void PICint(){SWDTEN=1; //禁止看门狗,18F看门狗是可以用软件控制开启的!INTCON=0;ADCON1=0x07; //AD端口全部始能为数字IO口TRISB7=0; //设置为输出端口RB7=0;PIE1=0;PIE2=0;PIE3=0;buf[0]=0;buf[1]=0;buf[2]=0;buf[3]=0;//CMCON=0x07; //关闭比较器,18F2680没有比较器}//***********************************//高优先级中断函数//***********************************void interrupt HI_ISR(){if(TMR0IF&TMR0IE) //确认是定时器0中断{dd++;TMR0IF=0;TMR0H=0xd8; //10ms定时常数TMR0L=0xef;if(dd==100){dd=0;buf[0]++;if(buf[0]==10){buf[0]=0;buf[1]++;if(buf[1]==10){buf[1]=0;buf[2]++;if(buf[2]==10){buf[2]=0;buf[3]++;if(buf[3]==10){buf[3]=0;}}}}}}if(ADIF) //判断是否是AD转换中断{ADIF=0; //清0DADh=ADRESH;DADl=ADRESL;Dat=256*DADh+DADl;if(((Dat-Dat1)==1)||((Dat1-Dat)==1)){Dat=Dat1;}DADflage=1;}}//***********************************//低优先级中断函数//***********************************void interrupt low_priority LOW_ISR(){if(RCIF&RCIE) //如果是串口接收中断的话,则进入中断处理{RCIF=0; //清中断标志*Counter=RCREG;//读取数据到数组Counter++;if((Counter-&receive[0])==10){Counter=&receive[0];Uartsend=1;}}}//***********************************//定时器0初始化子程序//***********************************void timer1(){IPEN=1; //打开高低优先级T0CON=0x09; //把定时器0设定为16位定时器,内部时钟触发,不使用分频器TMR0IE=1; //允许定时器0溢出中断TMR0IF=0; //清除中断标志TMR0IP=1; //设定定时器0中断为高优先级TMR0H=0xD8; //定时常数TMR0L=0xef;GIE=1;PEIE=1;TMR0ON=1;}//***********************************//AD转换初始化函数//***********************************void ADint() //使用于18F2680!{ADCON0=0x01; //AD转换速率为Fosc/4,并使能AD转换模块ADCON1=0x0e; //选择为右对齐模式,并且使能AD0为模拟通道ADCON2=0x91;TRISA=1; //RA0为输入模式ADIF=0;ADIE=1; //中断使能IPEN=1; //使能高低中断优先级ADIP=1; //AD转换设置为高优先级中断GIE=1; //开总中断以及外部中断PEIE=1;DADflage=0;}//***********************************//I2C初始化函数//***********************************void i2cint(){SSPCON1=0x08; //允许串口工作,I2C主控方式,时钟=Fosc/[4*(SSPADD+1)] RC4=1; //设置为输入RC3=1;SSPADD=7; //时钟频率约为0.125MSSPSTAT=0x80; //关闭标准速度方式SSPCON2=0;SSPEN=1; //使能串口(SSP模块)I2Cerror=0;}//***********************************//SPI初始化程序//***********************************void SPI_Iint(){TRISC5=0; //SDO引脚TRISC4=1; //SDI引脚TRISC3=0; //SCK,串行时钟输出引脚TRISA5=0; //RA5为从动SS端SSPCON1=0x30; //使能串口,高电平为空闲状态,并且发送频率为fose/4,主控方式; SSPSTAT=0xc0; //时钟下降沿发送数据!SSPIF=0;conet=0;}//***********************************//通用同步/异步收发器(UART)初始化//***********************************void Uartint(){TXSTA=0x04; //设置为高速异步,方式RCSTA=0x80; //使能UARTTRISC6=0; //设置为输入,对外部呈现高阻态TRISC7=1;SPBRG=25; //设置波特率为9600//波特率计算公式//1.同步方式:波特率=Fosc/[4(X+1)]//2.异步方式:BRGH=0:波特率=Fosc/[64(x+1)]// BRGH=1:波特率=Fosc/[16(x+1)]IPEN=1; //开中断优先级RCIP=0; //串口接收使能为低优先级RCIE=1; //串口接收中断使能RCIF=0;TXIE=0; //禁止发送中断GIE=1; //开总中断和外围中断PEIE=1;TXEN=1; //使能串口发送CREN=1; //使能串口接收,注意18F是CREN而不是RCEN,编译器都认为是正确的但是RCEN不管用! Counter=&receive[0];//把数组的首地址给指针Uartsend=0;}//***********************************//AD转换函数//***********************************void ADchange(){ADCON0=ADCON0|0x02; //启动AD转换if(DADflage) //如果AD转换完成,这里采用{DADflage=0;shuchai();display();}}//***********************************//AD 数据拆分//***********************************void shuchai(){unsigned int i;Dat1=Dat; //保存这次的计数值i=Dat;buf[3]=i/1000; //取出千位i=i%1000; //取出百位数buf[2]=i/100; //取出百位数i=i%100; //取出十位数buf[1]=i/10;i=i%10;buf[0]=i;}//***********************************//Uart receive data send//***********************************void Uartrs(){if(Uartsend){unsigned char i;Uartsend=0;for(i=0;i<10;i++){Udatas(*Counter);Counter++;}Counter=&receive[0]; //重新初始化}}//***********************************//Uart 数据发送子程序//***********************************void Udatas(unsigned char dad){TXREG=dad;while(1){if(TXIF==1) break; //等待数据写入}delay(80);}//***********************************//I2C写子程序//***********************************void c64W(){Start();if(I2Cerror==1){I2Cerror=0;return; //返回防止死循环}Senddata(0xa0); //发送寻址地址,以及写操作地址!if(I2Cerror==1){I2Cerror=0;Stop(); //错误处理return; //返回防止死循环}Senddata(0x00); //发送高位地址if(I2Cerror==1){I2Cerror=0;Stop(); //错误处理return; //返回防止死循环}Senddata(0x40); //发送地址低字节if(I2Cerror==1){I2Cerror=0;Stop(); //错误处理return; //返回防止死循环}Senddata(0x55); //发送数据if(I2Cerror==1){I2Cerror=0;Stop(); //错误处理return; //返回防止死循环}Stop();}//***********************************//I2C读数据程序//***********************************void c64R(){Start();if(I2Cerror==1){I2Cerror=0;return; //返回防止死循环}Senddata(0xa0); //发送寻址地址,以及写操作地址!if(I2Cerror==1){I2Cerror=0;Stop(); //错误处理return; //返回防止死循环}Senddata(0x00); //发送高位地址if(I2Cerror==1){I2Cerror=0;Stop(); //错误处理return; //返回防止死循环}Senddata(0x40); //发送地址低字节if(I2Cerror==1){I2Cerror=0;Stop(); //错误处理return; //返回防止死循环}Restart(); //发送重新起始位Senddata(0xa1); //发送读命令if(I2Cerror==1){I2Cerror=0;Stop(); //错误处理return; //返回防止死循环}Datain();Stop();if(save==0x55){RB7=1;}conet++;}//***********************************//I2C重复启动//***********************************void Restart(){RSEN=1;while(1){if(SSPIF==1) break;}SSPIF=0;}//***********************************//I2C数据写等待//***********************************void WriteWait(){while(1){Start(); //在数据写入时间,如果在给器件发送数据不会有响应Senddata(0xa0);Stop();if(I2Cerror==0) break; //等待数据写入,=0则有应答位产生}}//***********************************//I2C起始位发送函数//***********************************void Start(){unsigned char i=0;SEN=1; //起始位发送while(1){i++;if(SSPIF==1) break;if(i==200) //防止死循环{i=0;I2Cerror=1;break;}}SSPIF=0;}//***********************************//I2C停止位发送//***********************************void Stop(){PEN=1;while(1){if(SSPIF==1) break;}SSPIF=0;}//***********************************//I2C数据发送函数//***********************************void Senddata(unsigned char data){unsigned char i;SSPBUF=data; //发送数据while(1){if(SSPIF==1) break;}SSPIF=0;for(i=0;i<10;i++){}if(ACKSTAT) //如果没有发出应答信号{I2Cerror=1;}else //如果发出应答信号{I2Cerror=0;}}//***********************************//I2C 数据读入函数//***********************************void Datain(){RCEN=1;while(1){if(SSPIF==1) break;}SSPIF=0;save=SSPBUF; //读数ACKDT=1; //发送非应答位ACKEN=1;while(1){if(SSPIF==1) break;}SSPIF=0;}//***********************************//164显示程序//***********************************void display() //164显示程序,用SPI端口发送数据{unsigned char i;unsigned char y,t; //传输完四个字节for(i=0;i<4;i++){y=buf[i];t=table[y];SSPBUF=t;while(1){if(SSPIF) break;}SSPIF=0;}}//***********************************//延时函数//*********************************** void delay(unsigned int rr) //延时函数{unsigned int asd;for(asd=0;asd<rr;asd++){}}//***********************************//主函数//*********************************** void main(){PICint(); //初始化函数//Uartint(); //异步串行口初始化//SPI_Iint();//ADint(); //AD模块初始化//timer1();//display();//i2cint(); //I2C初始化//c64W(); //往C64里写一次数据//WriteWait();//c64R(); //读C64里while(1){//CLRWDT();//delay(20000);CLRWDT();RB7=1;CLRWDT();SLEEP(); //等待看门狗复位RB7=0;delay(20000);CLRWDT();}}PIC18 单片机学习(程序实例)说明:18F基本模块初始化程序均在内,且测试通过,主程序可以调用各个程序!编译器使用PICC18//程序主要用于18F单片机学习#include <pic18.h> //18系列单片机头文件//-------------函数定义--------------void delay(unsigned int rr);void timer1(void);void SPI_Iint(void); //串行SPI输出设置函数void display(void);void i2cint(void); //i2c总线初始化程序void c64R(void); //i2c接口的EEPROM存储器(读程序)void c64W(void); //写程序void Start(void); //起始位发送函数void Stop(void); //停止位发送函数void WriteWait(void); //等待函数void Senddata(unsigned char data); //数据发送函数void Restart(void); //重复启动函数void Datain(void); //数据读入void Uartint(void); //通用同步/异步收发器初始化程序void Udatas(unsigned char dad); //UART数据发送void Uartrs(void); //串口接收数据发送函数void ADint(void); //AD模块初始化void shuchai(void);//-----------数据寄存器定义----------const unsigned char table[10]={0xee,0x82,0xdc,0xd6,0xb2,0x76,0x7e,0xc2,0xfe,0xf6}; //显示段码unsigned char buf[5]; //显示缓存unsigned char receive[10]; //定义接收缓存unsigned char dd; //定时器0,中断计数寄存器unsigned char save;unsigned char conet;unsigned char *Counter; //接收数据指针unsigned char DADh; //AD缓存,unsigned char DADl;unsigned int Dat;unsigned int Dat1; //保存上次的AD转换值,用于比volatile bit DADflage; //AD转换标志volatile bit I2Cerror; //I2C错误标志volatile bit Uartsend; //异步串口数据发送允许union //联合体用来对C64的地址进行操作!{unsigned char dizhi[2];unsigned int Adress;}add;#define AddLow add.dizhi[0]#define AddHigh add.dizhi[1]#define ADDss add.Adress//***********************************//初始化//***********************************void PICint(){SWDTEN=1; //禁止看门狗,18F看门狗是可以用软件控制开启的!INTCON=0;ADCON1=0x07; //AD端口全部始能为数字IO口TRISB7=0; //设置为输出端口RB7=0;PIE1=0;PIE2=0;PIE3=0;buf[0]=0;buf[1]=0;buf[2]=0;buf[3]=0;//CMCON=0x07; //关闭比较器,18F2680没有比较器}//***********************************//高优先级中断函数//***********************************void interrupt HI_ISR(){if(TMR0IF&TMR0IE) //确认是定时器0中断{dd++;TMR0IF=0;TMR0H=0xd8; //10ms定时常数TMR0L=0xef;if(dd==100){dd=0;buf[0]++;if(buf[0]==10){buf[0]=0;buf[1]++;if(buf[1]==10){buf[1]=0;buf[2]++;if(buf[2]==10){buf[2]=0;buf[3]++;if(buf[3]==10){buf[3]=0;}}}}}}if(ADIF) //判断是否是AD转换中断{ADIF=0; //清0DADh=ADRESH;DADl=ADRESL;Dat=256*DADh+DADl;if(((Dat-Dat1)==1)||((Dat1-Dat)==1)){Dat=Dat1;}DADflage=1;}}//***********************************//低优先级中断函数//***********************************void interrupt low_priority LOW_ISR(){if(RCIF&RCIE) //如果是串口接收中断的话,则进入中断处理{RCIF=0; //清中断标志*Counter=RCREG;//读取数据到数组Counter++;if((Counter-&receive[0])==10){Counter=&receive[0];Uartsend=1;}}}//***********************************//定时器0初始化子程序//***********************************void timer1(){IPEN=1; //打开高低优先级T0CON=0x09; //把定时器0设定为16位定时器,内部时钟触发,不使用分频器TMR0IE=1; //允许定时器0溢出中断TMR0IF=0; //清除中断标志TMR0IP=1; //设定定时器0中断为高优先级TMR0H=0xD8; //定时常数TMR0L=0xef;GIE=1;PEIE=1;TMR0ON=1;}//***********************************//AD转换初始化函数//***********************************void ADint() //使用于18F2680!{ADCON0=0x01; //AD转换速率为Fosc/4,并使能AD转换模块ADCON1=0x0e; //选择为右对齐模式,并且使能AD0为模拟通道ADCON2=0x91;TRISA=1; //RA0为输入模式ADIF=0;ADIE=1; //中断使能IPEN=1; //使能高低中断优先级ADIP=1; //AD转换设置为高优先级中断GIE=1; //开总中断以及外部中断PEIE=1;DADflage=0;}//***********************************//I2C初始化函数//***********************************void i2cint(){SSPCON1=0x08; //允许串口工作,I2C主控方式,时钟=Fosc/[4*(SSPADD+1)] RC4=1; //设置为输入RC3=1;SSPADD=7; //时钟频率约为0.125MSSPSTAT=0x80; //关闭标准速度方式SSPCON2=0;SSPEN=1; //使能串口(SSP模块)I2Cerror=0;}//***********************************//SPI初始化程序//***********************************void SPI_Iint(){TRISC5=0; //SDO引脚TRISC4=1; //SDI引脚TRISC3=0; //SCK,串行时钟输出引脚TRISA5=0; //RA5为从动SS端SSPCON1=0x30; //使能串口,高电平为空闲状态,并且发送频率为fose/4,主控方式; SSPSTAT=0xc0; //时钟下降沿发送数据!SSPIF=0;conet=0;}//***********************************//通用同步/异步收发器(UART)初始化//***********************************void Uartint(){TXSTA=0x04; //设置为高速异步,方式RCSTA=0x80; //使能UARTTRISC6=0; //设置为输入,对外部呈现高阻态TRISC7=1;SPBRG=25; //设置波特率为9600//波特率计算公式//1.同步方式:波特率=Fosc/[4(X+1)]//2.异步方式:BRGH=0:波特率=Fosc/[64(x+1)]// BRGH=1:波特率=Fosc/[16(x+1)]IPEN=1; //开中断优先级RCIP=0; //串口接收使能为低优先级RCIE=1; //串口接收中断使能RCIF=0;TXIE=0; //禁止发送中断GIE=1; //开总中断和外围中断PEIE=1;TXEN=1; //使能串口发送CREN=1; //使能串口接收,注意18F是CREN而不是RCEN,编译器都认为是正确的但是RCEN不管用! Counter=&receive[0];//把数组的首地址给指针Uartsend=0;}//***********************************//AD转换函数//***********************************void ADchange(){ADCON0=ADCON0|0x02; //启动AD转换if(DADflage) //如果AD转换完成,这里采用{DADflage=0;shuchai();display();}}//***********************************//AD 数据拆分//***********************************void shuchai(){unsigned int i;Dat1=Dat; //保存这次的计数值i=Dat;buf[3]=i/1000; //取出千位i=i%1000; //取出百位数buf[2]=i/100; //取出百位数i=i%100; //取出十位数buf[1]=i/10;i=i%10;buf[0]=i;}//***********************************//Uart receive data send//***********************************void Uartrs(){if(Uartsend){unsigned char i;Uartsend=0;for(i=0;i<10;i++){Udatas(*Counter);Counter++;}Counter=&receive[0]; //重新初始化}}//***********************************//Uart 数据发送子程序//***********************************void Udatas(unsigned char dad){TXREG=dad;while(1){if(TXIF==1) break; //等待数据写入}delay(80);}//***********************************//I2C写子程序//***********************************void c64W(){Start();if(I2Cerror==1){I2Cerror=0;return; //返回防止死循环}Senddata(0xa0); //发送寻址地址,以及写操作地址!if(I2Cerror==1){I2Cerror=0;Stop(); //错误处理return; //返回防止死循环}Senddata(0x00); //发送高位地址if(I2Cerror==1){I2Cerror=0;Stop(); //错误处理return; //返回防止死循环}Senddata(0x40); //发送地址低字节if(I2Cerror==1){I2Cerror=0;Stop(); //错误处理return; //返回防止死循环}Senddata(0x55); //发送数据if(I2Cerror==1){I2Cerror=0;Stop(); //错误处理return; //返回防止死循环}Stop();}//***********************************//I2C读数据程序//***********************************void c64R(){Start();if(I2Cerror==1){I2Cerror=0;return; //返回防止死循环}Senddata(0xa0); //发送寻址地址,以及写操作地址!if(I2Cerror==1){I2Cerror=0;Stop(); //错误处理return; //返回防止死循环}Senddata(0x00); //发送高位地址if(I2Cerror==1){I2Cerror=0;Stop(); //错误处理return; //返回防止死循环}Senddata(0x40); //发送地址低字节if(I2Cerror==1){I2Cerror=0;Stop(); //错误处理return; //返回防止死循环}Restart(); //发送重新起始位Senddata(0xa1); //发送读命令if(I2Cerror==1){I2Cerror=0;Stop(); //错误处理return; //返回防止死循环}Datain();Stop();if(save==0x55){RB7=1;}conet++;}//*********************************** //I2C重复启动//*********************************** void Restart(){RSEN=1;while(1){if(SSPIF==1) break;}SSPIF=0;}//*********************************** //I2C数据写等待//*********************************** void WriteWait(){while(1){Start(); //在数据写入时间,如果在给器件发送数据不会有响应Senddata(0xa0);Stop();if(I2Cerror==0) break; //等待数据写入,=0则有应答位产生}}//***********************************//I2C起始位发送函数//***********************************void Start(){unsigned char i=0;SEN=1; //起始位发送while(1){i++;if(SSPIF==1) break;if(i==200) //防止死循环{i=0;I2Cerror=1;break;}}SSPIF=0;}//***********************************//I2C停止位发送//***********************************void Stop(){PEN=1;while(1){if(SSPIF==1) break;}SSPIF=0;}//***********************************//I2C数据发送函数//***********************************void Senddata(unsigned char data){unsigned char i;SSPBUF=data; //发送数据while(1){if(SSPIF==1) break;}SSPIF=0;for(i=0;i<10;i++){}if(ACKSTAT) //如果没有发出应答信号{I2Cerror=1;}else //如果发出应答信号{I2Cerror=0;}}//***********************************//I2C 数据读入函数//***********************************void Datain(){RCEN=1;while(1){if(SSPIF==1) break;}SSPIF=0;save=SSPBUF; //读数ACKDT=1; //发送非应答位ACKEN=1;while(1){if(SSPIF==1) break;}SSPIF=0;}//***********************************//164显示程序//***********************************void display() //164显示程序,用SPI端口发送数据{unsigned char i;unsigned char y,t; //传输完四个字节for(i=0;i<4;i++){y=buf[i];t=table[y];SSPBUF=t;while(1){if(SSPIF) break;}SSPIF=0;}}//***********************************//延时函数//*********************************** void delay(unsigned int rr) //延时函数{unsigned int asd;for(asd=0;asd<rr;asd++){}}//***********************************//主函数//*********************************** void main(){PICint(); //初始化函数//Uartint(); //异步串行口初始化//SPI_Iint();//ADint(); //AD模块初始化//timer1();//display();//i2cint(); //I2C初始化//c64W(); //往C64里写一次数据//WriteWait();//c64R(); //读C64里while(1){//CLRWDT();//delay(20000);CLRWDT();CLRWDT();SLEEP(); //等待看门狗复位RB7=0;delay(20000);CLRWDT();}}关于c语言流水灯程序悬赏分:20|解决时间:2010-4-13 17:04|提问者:chenli6522002流水灯怎么在下面代码中不能点亮,出现什么问题了?#include "reg51.h"char led[]={0x01,0x02,0x04,0x08};char led1[]={0x01,0x04,0x02,0x08,0x08,0x02,0x04,0x01};char led2[]={0x08,0x04,0x02,0x01};void delay(unsigned int time){ unsigned int j;for(;time>0;time++)for(j=0;j<125;j++);}void main(){char i;while(1){if(P0==0x0e)while(1){for(i=0;i<=3;i++){P2=led[i];delay(200);}if(P0==0x0d||P0==0x0d)break;}else if(P0==0x0d)while(1)for(i=0;i<=3;i++){P2=led1[i];delay(200);}if(P0==0x0b||P0==0x0e) break;}else if(P0==0x0b)while(1){for(i=0;i<=3;i++){P2=led2[i];delay(200);}if(P0==0x0e||P0==0x0d)break;}else P2=0;}}最佳答案如果是流水灯你使用一下程序会更好简单实现的功能是P1 P3口的流水灯循环闪动你可以参照这个写..使用位控制#include "reg51.h"void main(){unsigned int i=10;P1=0xfe;while(1){while(--i){;}P1=(P1<<1) | 0x01;if(P1==0xff) P3 = 0x7f;while(P1==0xff){while(--i){;}P3=(P3>>1) | 0x80;{P1=0xfe;P3=0xff;}}}}音响程序#define uchar unsigned char //定义一下方便使用#define uint unsigned int#define ulong unsigned long#include <reg52.h> //包括一个52标准内核的头文件char code dx516[3] _at_ 0x003b;//这是为了仿真设置的sbit BEEP=P1^7; //喇叭输出脚sbit P10=P1^0;sbit K1= P3^2;sbit K2= P3^5;sbit K3= P2^4;sbit K4= P2^5;uchar th0_f; //在中断中装载的T0的值高8位uchar tl0_f; //在中断中装载的T0的值低8位//T0的值,及输出频率对照表uchar code freq[36*2]={0xA9,0xEF,//00220HZ ,1 //00x93,0xF0,//00233HZ ,1#0x73,0xF1,//00247HZ ,20x49,0xF2,//00262HZ ,2#0x07,0xF3,//00277HZ ,30xC8,0xF3,//00294HZ ,40x73,0xF4,//00311HZ ,4#0x1E,0xF5,//00330HZ ,50xB6,0xF5,//00349HZ ,5#0x4C,0xF6,//00370HZ ,60xD7,0xF6,//00392HZ ,6#0x5A,0xF7,//00415HZ ,70xD8,0xF7,//00440HZ 1 //120x4D,0xF8,//00466HZ 1# //130xBD,0xF8,//00494HZ 2 //140x24,0xF9,//00523HZ 2# //150x87,0xF9,//00554HZ 3 //160xE4,0xF9,//00587HZ 4 //170x3D,0xFA,//00622HZ 4# //180x90,0xFA,//00659HZ 5 //190xDE,0xFA,//00698HZ 5# //200x29,0xFB,//00740HZ 6 //210x6F,0xFB,//00784HZ 6# //220xB1,0xFB,//00831HZ 7 //230xEF,0xFB,//00880HZ `10x2A,0xFC,//00932HZ `1#0x62,0xFC,//00988HZ `20x95,0xFC,//01046HZ `2#0xC7,0xFC,//01109HZ `30xF6,0xFC,//01175HZ `40x22,0xFD,//01244HZ `4#0x4B,0xFD,//01318HZ `50x73,0xFD,//01397HZ `5#0x98,0xFD,//01480HZ `60xBB,0xFD,//01568HZ `6#0xDC,0xFD,//01661HZ `7 //35};//定时中断0,用于产生唱歌频率timer0() interrupt 1{TL0=tl0_f;TH0=th0_f; //调入预定时值BEEP=~BEEP; //取反音乐输出IO}//******************************//音乐符号串解释函数//入口:要解释的音乐符号串,输出的音调串,输出的时长串changedata(uchar *song,uchar *diao,uchar *jie){uchar i,i1,j;char gaodi; //高低+/-12音阶uchar banyin;//有没有半个升音阶uchar yinchang;//音长uchar code jie7[8]={0,12,14,16,17,19,21,23}; //C调的7个值*diao=*song;{gaodi=0; //高低=0banyin=0;//半音=0yinchang=4;//音长1拍if((*(song+i)=='|') || (*(song+i)==' ')) i++; //拍子间隔和一个空格过滤switch(*(song+i)){case ',': gaodi=-12;i++;//低音break;case '`': gaodi=12;i++; //高音break;}if(*(song+i)==0) //遇到0结束{*(diao+i1)=0; //加入结束标志0*(jie+i1)=0;return;}j=*(song+i)-0x30; i++; //取出基准音j=jie7[j]+gaodi; //加上高低音yinc: switch(*(song+i)){case '#': //有半音j加一个音阶i++;j++;goto yinc;case '-': //有一个音节加长yinchang+=4;i++;goto yinc;case '_': //有一个音节缩短yinchang/=2;i++;goto yinc;case '.': //有一个加半拍yinchang=yinchang+yinchang/2;i++;goto yinc;}*(diao+i1)=j; //记录音符*(jie+i1)=yinchang; //记录音长i1++;}}//******************************************//奏乐函数//入口:要演奏的音乐符号串void play(uchar *songdata){uchar i,c,j=0;uint n;uchar xdata diaodata[112]; //音调缓冲uchar xdata jiedata[112]; //音长缓冲changedata(songdata,diaodata,jiedata); //解释音乐符号串TR0=1;for(i=0;diaodata[i]!=0;i++) //逐个符号演奏{tl0_f=freq[diaodata[i]*2]; //取出对应的定时值送给T0th0_f=freq[diaodata[i]*2+1];for(c=0;c<jiedata[i];c++) //按照音长延时{for(n=0;n<32000;n++);if((!K1)||(!K2)||(!K3)||(!K4))//发现按键,立即退出播放{TR0=0;return;}}TR0=0;for(n=0;n<500;n++); //音符间延时TR0=1;}TR0=0;}//仙剑uchar code xianjian[]={"|3_3_3_2_3-|2_3_2_2_,6,6_,7_|12_1_,7,6_,5_|,6---|" "3_3_3_2_3.6_|5_6_5_5_22_3_|45_4_32_1_|3.--3_|" "67_6_55_3_|5--3_5_|26_5_32_3_|3---|""26_6_6-|16_6_66_7_|`17_6_76_7_|3.--3_|""67_6_55_3_|5--3_5_|67_6_76_7_|3---|""26_6_6-|16_6_66_7_|`17_6_7.5_|6---|"};uchar code song3[]={"5-5_3_2_1_|3---|6-6_4_2_1_"",7--,5_|1.3_5.1_|,7.3_5 5_|""6.7_`1.6_|6_5_5-3_2_|1.1_13_2_|""1.1_12_3_|2.1_,62_3_|2-- ,5_|""1.3_5.1_|,7.3_55_|6.7_`1.6_|""6_5_5-3_2_|1.1_13_2_|1.1_12_3_""2.,6_,71_2_|1--"};//世上只有妈妈好uchar code mamahao[]={"6.5_35|`16_5_6-|35_6_53_2_|1_,6_5_3_2-|""2.3_55_6_|321-|5.3_2_1_,6_1_|,5--"};//三个按键选择三首不同的音乐播放,一个键停止播放void main(void) // 主程序{TMOD = 0x01; //使用定时器0的16位工作模式TR0 = 0;ET0 = 1; //定时器0中断EA = 1; //打开总中断while(1){if(!K1){while(!K1);play(xianjian); //播放音乐}if(!K2){while(!K2);play(song3); //播放音乐}if(!K3){while(!K3);play(mamahao); //播放音乐}}}延时程序(包括asm和C程序,都是我在学单片机的过程中用到的),在单片机延时程序中应考虑所使用的晶振的频率,在51系列的单片机中我们常用的是11.0592MHz和12.0000MHz的晶振,而在AVR单片机上常用的有8.000MHz和4.000MH的晶振所以在网上查找程序时如果涉及到精确延时则应该注意晶振的频率是多大。
KF8F204数据手册V1.0
17
I/O
T0CK
INT0
P0.1
AN1
18
I/O
ADVRIN
SPCLK
P0.0
19
I/O AN0
SPDAT
20
P VSS
KF8F204 数据手册 V1.0
双向输入输出端口 ADC 输入通道 8 双向输入输出端口 ADC 输入通道 6 外部中断 1 输入 双向输入输出端口 ADC 输入通道 5 双向输入输出端口 ADC 输入通道 4 PWM1 输出 带上拉和电平变化中断功能的双向输入输出端口 ADC 输入通道 2 T0 时钟输入 外部中断 0 输入 带上拉和电平变化中断功能的双向输入输出端口 ADC 输入通道 1 AD 外部参考电压输入 在线编程时钟输入 带上拉和电平变化中断功能的双向输入输出端口 ADC 输入通道 0 在线编程数据输入 地,0V 参考点
2.2.2 P1 口原理功能框图 .....................................................26 2.3 P2 口 .....................................................................27
2 I/O端口介绍 ............................................................... 17
2.1 P0 口 .....................................................................18 2.1.1 P0 口相关的寄存器 .....................................................19
8位PIC单片机选型手册
Internal Os# of Compar Product Program MemPin countMax. CPU Sp PeripheralRAM (bytes)EEPROM / HEPIC10F2020.7524064No 4 MHz 0PIC10F2060.7524064No 4 MHz 1PIC10F2200.37516068No 4 MHz, 8 MH0PIC10F2220.7523068No 4 MHz, 8 MH0PIC12F5080.7525084No 4 MHz 0PIC12F509 1.541084No 4 MHz 0PIC12F510 1.538088No 4 MHz, 8 MH1PIC12F609 1.75640820No 4 MHz, 8 MH1PIC12F615 1.75640820No 4 MHz, 8 MH1PIC12F617 3.51280 / HEF820No 4 MHz, 8 MH1PIC16F14541410240 / HEF1448No None 0PIC16F14551410240 / HEF1448No None 2PIC16F14591410240 / HEF2048No None 2PIC16F150872560 / HEF2020No16 MHz, 32 2PIC16F1526147680 / HEF6420No16 MHz, 32 0PIC16F152******** / HEF6420No16 MHz, 32 0PIC16F505 1.57201420No 4 MHz 0PIC16F506 1.56701420No 4 MHz, 8 MH2PIC16F540.752501820No No 0PIC16F5737202820No No 0PIC16F59313404020No No 0PIC16F610 1.756401420No 4 MHz, 8 MH2PIC16F616 3.512801420No 4 MHz, 8 MH2PIC16F716 3.512801820No None 0PIC16F72 3.512802820No No 0PIC16F73719202820No None 0PIC16F737736802820No8 MHz 2PIC16F74719204020No No 0PIC16F747736804020No8 MHz 2PIC16F761436802820No None 0PIC16F7671436802820No8 MHz 2PIC16F771436804020No No 0PIC16F7771436804020No8 MHz 2PIC16HV540 1.52501820No No 0PIC16LF190 3.51280 / HEF2820No16 MHz, 32 0PIC16LF19072560 / HEF2820No16 MHz, 32 0PIC16LF19072560 / HEF4020No16 MHz, 32 0PIC16LF190145120 / HEF2820No16 MHz, 32 0PIC16LF190145120 / HEF4020No16 MHz, 32 0PIC18F24101676802840No8 MHz, 32 k2PIC18F2450167680 / HEF2848No32 kHz 0PIC18F24J11610240 / HEF2840No32 kHz 2PIC18F24J11638000 / HEF2848Yes8 MHz, 32 k2PIC18F24J51638000 / HEF2848Yes8 MHz, 32 k2PIC18F251032153602840No8 MHz, 32 k2PIC18F251548396802840No8 MHz, 32 k2PIC18F25J13210240 / HEF2840No32 kHz 2PIC18F25J13238000 / HEF2848Yes8 MHz, 32 k2PIC18F25J53238000 / HEF2848Yes8 MHz, 32 k2PIC18F261064396802840No8 MHz, 32 k2PIC18F26J16438000 / HEF2848Yes8 MHz, 32 k2PIC18F26J16438000 / HEF2848Yes8 MHz, 32 k3PIC18F26J56438000 / HEF2848Yes8 MHz, 32 k2PIC18F26J56438000 / HEF2848No8 MHz, 32 k3 PIC18F27J112838000 / HEF2848Yes8 MHz, 32 k3 PIC18F27J512838000 / HEF2848Yes8 MHz, 32 k3 PIC18F44101676804040No8 MHz, 32 k2 PIC18F4450167680 / HEF4048No32 kHz 0 PIC18F44J11610240 / HEF4040No32 kHz 2 PIC18F44J11638000 / HEF4448Yes8 MHz, 32 k2 PIC18F44J51638000 / HEF4448Yes8 MHz, 32 k2 PIC18F451032153604040No8 MHz, 32 k2 PIC18F451548396804040No8 MHz, 32 k2 PIC18F45J13210240 / HEF4040No32 kHz 2 PIC18F45J13238000 / HEF4448Yes8 MHz, 32 k2 PIC18F45J53238000 / HEF4448Yes8 MHz, 32 k2 PIC18F461064396804040No8 MHz, 32 k2 PIC18F46J16438000 / HEF4448Yes8 MHz, 32 k2 PIC18F46J16438000 / HEF4448Yes8 MHz, 32 k3 PIC18F46J56438000 / HEF4448Yes8 MHz, 32 k2 PIC18F46J56438000 / HEF4448Yes8 MHz, 32 k3 PIC18F47J112838000 / HEF4448Yes8 MHz, 32 k3 PIC18F47J512838000 / HEF4448Yes8 MHz, 32 k3 PIC18F6310876806440No8 MHz, 32 k2 PIC18F6390876806440No8 MHz, 32 k2 PIC18F6393876806440No8 MHz, 32 k2 PIC18F63J1810240 / HEF6440No8 MHz, 32 k2 PIC18F63J9810240 / HEF6440No8 MHz, 32 k2 PIC18F64101676806440No8 MHz, 32 k2 PIC18F64901676806440No8 MHz, 32 k2 PIC18F64931676806432No8 MHz, 32 k2 PIC18F64J11610240 / HEF6440No8 MHz, 32 k2 PIC18F64J91610240 / HEF6440No8 MHz, 32 k2 PIC18F65J13220480 / HEF6440No32 kHz 2 PIC18F65J13220480 / HEF6440No8 MHz, 32 k2 PIC18F65J14820480 / HEF6440No32 kHz 2 PIC18F65J53239040 / HEF6448No8 MHz, 32 k2 PIC18F65J93220480 / HEF6440No8 MHz, 32 k2 PIC18F65J93238620 / HEF6464No8 MHz, 32 k3 PIC18F66J16420480 / HEF6440No32 kHz 2 PIC18F66J16439040 / HEF6448No8 MHz, 32 k2 PIC18F66J19639360 / HEF6440No32 kHz 2 PIC18F66J19639040 / HEF6448No8 MHz, 32 k2 PIC18F66J56439040 / HEF6448No8 MHz, 32 k2 PIC18F66J59639040 / HEF6448No8 MHz, 32 k2 PIC18F66J66438080 / HEF6442No32 kHz 2 PIC18F66J69638080 / HEF6442No32 kHz 2 PIC18F66J96439000 / HEF6448No8 MHz, 32 k2 PIC18F66J96439000 / HEF6448No8 MHz, 32 k2 PIC18F66J96438620 / HEF6464No8 MHz, 32 k3 PIC18F67J112839360 / HEF6440No32 kHz 2 PIC18F67J112839040 / HEF6448No8 MHz, 32 k2 PIC18F67J512839040 / HEF6448No8 MHz, 32 k2 PIC18F67J612838080 / HEF6442No32 kHz 2 PIC18F67J912839000 / HEF6448No8 MHz, 32 k2 PIC18F67J912839000 / HEF6448No8 MHz, 32 k2 PIC18F67J912838620 / HEF6464No8 MHz, 32 k3PIC18F8310876808040No8 MHz, 32 k2 PIC18F8390876808040No8 MHz, 32 k2 PIC18F8393876808040No8 MHz, 32 k2 PIC18F83J1810240 / HEF8040No8 MHz, 32 k2 PIC18F83J9810240 / HEF8040No8 MHz, 32 k2 PIC18F84101676808040No8 MHz, 32 k2 PIC18F84901676808040No8 MHz, 32 k2 PIC18F84931676808032No8 MHz, 32 k2 PIC18F84J11610240 / HEF8040No8 MHz, 32 k2 PIC18F84J91610240 / HEF8040No8 MHz, 32 k2 PIC18F85J13220480 / HEF8040No32 kHz 2 PIC18F85J13220480 / HEF8040No8 MHz, 32 k2 PIC18F85J14820480 / HEF8040No32 kHz 2 PIC18F85J53239040 / HEF8048No8 MHz, 32 k2 PIC18F85J93220480 / HEF8040No8 MHz, 32 k2 PIC18F85J93238620 / HEF8064No8 MHz, 32 k3 PIC18F86J16420480 / HEF8040No32 kHz 2 PIC18F86J16439040 / HEF8048No8 MHz, 32 k2 PIC18F86J19639360 / HEF8040No32 kHz 2 PIC18F86J19639040 / HEF8048No8 MHz, 32 k2 PIC18F86J56439040 / HEF8048No8 MHz, 32 k2 PIC18F86J59639040 / HEF8048No8 MHz, 32 k2 PIC18F86J66438080 / HEF8042No32 kHz 2 PIC18F86J69638080 / HEF8042No32 kHz 2 PIC18F86J76439230 / HEF8048No8 MHz, 32 k2 PIC18F86J96439000 / HEF8048No8 MHz, 32 k2 PIC18F86J96439000 / HEF8048No8 MHz, 32 k2 PIC18F86J96438620 / HEF8064No8 MHz, 32 k3 PIC18F87J112839360 / HEF8040No32 kHz 2 PIC18F87J112839040 / HEF8048No8 MHz, 32 k2 PIC18F87J512839040 / HEF8048No8 MHz, 32 k2 PIC18F87J612838080 / HEF8042No32 kHz 2 PIC18F87J712839230 / HEF8048No8 MHz, 32 k2 PIC18F87J912839000 / HEF8048No8 MHz, 32 k2 PIC18F87J912839000 / HEF8048No8 MHz, 32 k2 PIC18F87J912838620 / HEF8064No8 MHz, 32 k3 PIC18F95J93238620 / HEF10064No8 MHz, 32 k3 PIC18F96J66438080 / HEF10042No32 kHz 2 PIC18F96J69638080 / HEF10042No32 kHz 2 PIC18F96J96438620 / HEF10064No8 MHz, 32 k3 PIC18F97J612838080 / HEF10042No32 kHz 2 PIC18F97J912838620 / HEF10064No8 MHz, 32 k3 PIC10F2000.37516064No 4 MHz 0 PIC10F2040.37516064No 4 MHz 1 PIC12F1501 1.75640 / HEF820No16 MHz, 32 1 PIC12F1571 1.751280 / HEF832No32 MHz, 32 1 PIC12F1572 3.52560 / HEF832No32 MHz, 32 1 PIC12F752 1.8640 / HEF820No8 MHz 2 PIC16F1503 3.51280 / HEF1420No16 MHz 2 PIC16F1507 3.51280 / HEF2020No16 MHz, 32 0 PIC16F1509145120 / HEF2020No16 MHz, 32 2 PIC16F1516145120 / HEF2820No16 MHz, 32 0 PIC16F1517145120 / HEF4020No16 MHz, 32 0 PIC16F151******** / HEF2820No16 MHz, 32 0PIC16F151******** / HEF4020No16 MHz, 32 0 PIC16F157475120 / HEF1432Yes32 MHz, 32 2 PIC16F157******** / HEF1432Yes32 MHz, 32 2 PIC16F157875120 / HEF2032Yes32 MHz, 32 2 PIC16F157******** / HEF2032Yes16 MHz 2 PIC16F707143680 / HEF4020No16 MHz 0 PIC16F720 3.51280 / HEF2016No16 MHz 0 PIC16F72172560 / HEF2016No16 MHz 0 PIC16F722 3.51280 / HEF2820No16 MHz 0 PIC16F722A 3.51280 / HEF2820No16 MHz 0 PIC16F72371920 / HEF2820No16 MHz 0 PIC16F723A71920 / HEF2820No16 MHz 0 PIC16F72471920 / HEF4020No16 MHz 0 PIC16F726143680 / HEF2820No16 MHz 0 PIC16F727143680 / HEF4020No16 MHz 0 PIC16F753 3.51280 / HEF1420No8 MHz 2 PIC16F1703 3.52560 / HEF1432Yes32 MHz, 32 0 PIC16F170475120 / HEF1432Yes32 MHz, 32 2 PIC16F17051410240 / HEF1432Yes32 MHz, 32 2 PIC16F1707 3.752560 / HEF2032Yes32 MHz, 32 0 PIC16F170875120 / HEF2032Yes32 MHz, 32 2 PIC16F17091410240 / HEF2032Yes32 MHz, 32 2 PIC16F171375120 / HEF2832Yes32 MHz, 32 2 PIC16F17161410240 / HEF2832Yes32 MHz, 32 2 PIC16F17171410240 / HEF4032Yes32 MHz, 32 2 PIC16F17182820480 / HEF2832Yes32 MHz, 32 2 PIC16F17192820480 / HEF4032Yes32 MHz, 32 2 PIC16F176475120 / HEF1432Yes32 MHz, 32 2 PIC16F176******** / HEF1432Yes32 MHz, 32 2 PIC16F176875120 / HEF2032Yes32 MHz, 32 4 PIC16F176******** / HEF2032Yes32 MHz, 32 4 PIC16F177375120 / HEF2832Yes32 MHz, 32 6 PIC16F177******** / HEF2832Yes32 MHz, 32 6 PIC16F177******** / HEF4032Yes32 MHz, 32 8 PIC16F177******** / HEF2832Yes32 MHz, 32 6 PIC16F177******** / HEF2832Yes32 MHz, 32 8 PIC18F252548396810242840No8 MHz, 32 k2 PIC18F258548332810242840No8 MHz, 32 k0 PIC18F25K832364810242864No16 MHz, 32 2 PIC18F262064396810242840No8 MHz, 32 k2 PIC18F268064332810242840No8 MHz, 32 k0 PIC18F268280332810242840No8 MHz, 32 k0 PIC18F268596332810242840No8 MHz, 32 k0 PIC18F26K264393610242864No16 MHz, 32 2 PIC18F26K264389610242864No16 MHz, 32 2 PIC18F26K864364810242864No16 MHz, 32 2 PIC18F452548396810244040No8 MHz, 32 k2 PIC18F458548332810244040No8 MHz, 32 k2 PIC18F45K832364810244464No16 MHz, 32 2 PIC18F462064396810244040No8 MHz, 32 k2 PIC18F468064332810244040No8 MHz, 32 k2 PIC18F468280332810244040No8 MHz, 32 k2 PIC18F468596332810244040No8 MHz, 32 k2 PIC18F46K264393610244064No16 MHz, 32 2PIC18F46K264389610244064No16 MHz, 32 2 PIC18F46K864364810244464No16 MHz, 32 2 PIC18F652032************No None 2 PIC18F652748393610246440No8 MHz, 32 k2 PIC18F65K232204810246464No16 MHz, 32 3 PIC18F65K832364810246464No16 MHz, 32 2 PIC18F65K932204810246464No16 MHz, 32 3 PIC18F662264393610246440No8 MHz, 32 k2 PIC18F662796393610246440No8 MHz, 32 k2 PIC18F662896393610246440No8 MHz, 32 k2 PIC18F66K264386210246464No16 MHz, 32 3 PIC18F66K864364810246464No16 MHz, 32 2 PIC18F66K964382810246464No16 MHz, 32 3 PIC18F6722128393610246440No8 MHz, 32 k2 PIC18F6723128393610246440No8 MHz, 32 k2 PIC18F67K2128386210246464No16 MHz, 32 3 PIC18F67K9128382810246464No16 MHz, 32 3 PIC18F852032204810248040No None 2 PIC18F852748393610248040No8 MHz, 32 k2 PIC18F85K232204810248064No16 MHz, 32 3 PIC18F85K932204810248064No16 MHz, 32 3 PIC18F862264393610248040No8 MHz, 32 k2 PIC18F862796393610248040No8 MHz, 32 k2 PIC18F862896393610248040No8 MHz, 32 k2 PIC18F86K264386210248064No16 MHz, 32 3 PIC18F86K964382810248064No16 MHz, 32 3 PIC18F8722128393610248040No8 MHz, 32 k2 PIC18F8723128393610248040No8 MHz, 32 k2 PIC18F87K2128386210248064No16 MHz, 32 3 PIC18F87K9128409610248064No16 MHz, 32 3 PIC12F629 1.7564128820No 4 MHz 1 PIC12F635 1.7564128820No8 MHz, 32 k1 PIC12F675 1.7564128820No 4 MHz 1 PIC16F627A 1.752241281820No 4 MHz 2 PIC16F628A 3.52241281820No 4 MHz 2 PIC16F630 1.75641281420No 4 MHz 1 PIC16F631 1.75641282020No8 MHz, 32 k2 PIC16F676 1.75641281420No 4 MHz 1 PIC16F818 1.75128128 / HEF1820No No 0 PIC16F882 3.5128128 / HEF2820No8 MHz, 32 k2 PIC18F12304256128 / HEF1840No8 MHz, 32 k3 PIC18F133******** / HEF1840No8 MHz, 32 k3 PIC10F3200.44864128 / HEF616No16 MHz, 32 0 PIC10F3220.89664128 / HEF616No16 MHz, 32 0 PIC16F570364132 / HEF2820No8 MHz 2 PIC12F683 3.5128256820No8 MHz, 32 k1 PIC16F1782 3.5256256 / HEF2832No32 MHz, 32 3 PIC16F178******** / HEF2832No32 MHz, 32 3 PIC16F178******** / HEF4032No32 MHz, 32 4 PIC16F1786141024256 / HEF2832No32 MHz, 32 4 PIC16F1787141024256 / HEF4032No32 MHz, 32 4 PIC16F1788282048256 / HEF2832No32 MHz, 32 4 PIC16F1789282048256 / HEF4032No32 MHz, 32 4 PIC16F1829141024256 / HEF2032No32 MHz, 32 2PIC16F19347256256 / HEF4032No32 MHz, 32 2 PIC16F193614512256 / HEF2832No32 MHz, 32 2 PIC16F193714512256 / HEF4032No32 MHz, 32 2 PIC16F1938281024256 / HEF2832No32 MHz, 32 2 PIC16F1939281024256 / HEF4032No32 MHz, 32 2 PIC16F194614512256 / HEF6432No32 MHz, 32 3 PIC16F1947281024256 / HEF6432No32 MHz, 32 3 PIC16F636 3.51282561420No8 MHz, 32 k2 PIC16F639 3.51282562020No8 MHz, 32 k2 PIC16F648A72562561820No 4 MHz 2 PIC16F677 3.51282562020No8 MHz, 32 k2 PIC16F684 3.51282561420No8 MHz, 32 k2 PIC16F68572562562020No8 MHz, 32 k2 PIC16F687 3.51282562020No8 MHz, 32 k2 PIC16F68872562561420No8 MHz, 32 k2 PIC16F68972562562020No8 MHz, 32 k2 PIC16F69072562562020No8 MHz, 32 k2 PIC16F785 3.51282562020No8 MHz, 32 k2 PIC16F819 3.5256256 / HEF1820No No 0 PIC16F877368256 / HEF1820No8 MHz 2 PIC16F887368256 / HEF1820No8MHz 2 PIC16F8837256256 / HEF2820No8 MHz, 32 k2 PIC16F8847256256 / HEF4020No8 MHz, 32 k2 PIC16F88614368256 / HEF2820No8 MHz, 32 k2 PIC16F88714368256 / HEF4020No8 MHz, 32 k2 PIC16F91372562562820No8 MHz, 32 k2 PIC16F91472562564020No8 MHz, 32 k2 PIC16F916143522562820No8 MHz, 32 k2 PIC16F917143522564020No8 MHz, 32 k2 PIC16F946143362566420No8 MHz, 32 k2 PIC18F12204256256 / HEF1840No8 MHz, 32 k0 PIC18F132******** / HEF1840No8 MHz, 32 k0 PIC18F13K28256256 / HEF2064No16 MHz, 32 2 PIC18F13K58512256 / HEF2048No16 MHz, 32 2 PIC18F14K216512256 / HEF2064No16 MHz, 32 2 PIC18F14K516768256 / HEF2048No16 MHz, 32 2 PIC18F22204512256 / HEF2840No8 MHz, 32 k2 PIC18F22214512256 / HEF2840No8 MHz, 32 k2 PIC18F23208512256 / HEF2840No8 MHz, 32 k2 PIC18F23218512256 / HEF2840No8 MHz, 32 k2 PIC18F23318768256 / HEF2840No8 MHz, 32 k0 PIC18F23K28512256 / HEF2864No16 MHz, 32 2 PIC18F23K28512256 / HEF2864No16 MHz, 32 2 PIC18F242016768256 / HEF2840No8 MHz, 32 k2 PIC18F242316768256 / HEF2840No8 MHz, 32 k2 PIC18F243116768256 / HEF2840No8 MHz, 32 k0 PIC18F2455242048256 / HEF2848No8 MHz, 32 k2 PIC18F2458242048256 / HEF2848No8 MHz, 32 k2 PIC18F248016768256 / HEF2840No8 MHz, 32 k0 PIC18F24K216768256 / HEF2864No16 MHz, 32 2 PIC18F24K216768256 / HEF2864No16 MHz, 32 2 PIC18F24K5162048256 / HEF2848No16 MHz, 32 2 PIC18F2520321536256 / HEF2840No8 MHz, 32 k2 PIC18F2523321536256 / HEF2840No8 MHz, 32 k2PIC18F2550322048256 / HEF2848No8 MHz, 32 k2 PIC18F2553322048256 / HEF2848No8 MHz, 32 k2 PIC18F2580321536256 / HEF2840No8 MHz, 32 k0 PIC18F25K2321536256 / HEF2864No16 MHz, 32 2 PIC18F25K2321536256 / HEF2864No16 MHz, 32 2 PIC18F25K5322048256 / HEF2848No16 MHz 2 PIC18F42204512256 / HEF4040No8 MHz, 32 k2 PIC18F42214512256 / HEF4040No8 MHz, 32 k2 PIC18F43208512256 / HEF4040No8 MHz, 32 k2 PIC18F43218512256 / HEF4040No8 MHz, 32 k2 PIC18F43318768256 / HEF4040No8 MHz, 32 k0 PIC18F43K28512256 / HEF4064No16 MHz, 32 2 PIC18F43K28512256 / HEF4064No16 MHz, 32 2 PIC18F442016768256 / HEF4040No8 MHz, 32 k2 PIC18F442316768256 / HEF4040No8 MHz, 32 k2 PIC18F443116768256 / HEF4040No8 MHz, 32 k0 PIC18F4455242048256 / HEF4048No8 MHz, 32 k2 PIC18F4458242048256 / HEF4048No8 MHz, 32 k2 PIC18F448016768256 / HEF4040No8 MHz, 32 k2 PIC18F44K216768256 / HEF4064No16 MHz, 32 2 PIC18F44K216768256 / HEF4064No16 MHz, 32 2 PIC18F4520321536256 / HEF4040No8 MHz, 32 k2 PIC18F4523321536256 / HEF4040No8 MHz, 32 k2 PIC18F4550322048256 / HEF4048No8 MHz, 32 k2 PIC18F4553322048256 / HEF4048No8 MHz, 32 k2 PIC18F4580321536256 / HEF4040No8 MHz, 32 k2 PIC18F45K2321536256 / HEF4064No16 MHz, 32 2 PIC18F45K2321536256 / HEF4064No16 MHz, 32 2 PIC18F45K53220482564048No16 MHz 2 PIC12F1822 3.5128256 / HEF832No32 MHz, 32 1 PIC12F184******** / HEF832No32 MHz, 32 1 PIC16F1823 3.5128256 / HEF1432No32 MHz, 32 2 PIC16F182******** / HEF1432No32 MHz, 32 2 PIC16F1825141024256 / HEF1432No32 MHz, 32 2 PIC16F1826 3.5256256 / HEF1832No32 MHz, 32 2 PIC16F182******** / HEF1832No32 MHz, 32 2 PIC16F182******** / HEF2032No32 MHz, 32 2 PIC16F1829141024256 / HEF2032No32 MHz, 32 2 PIC16F1831 3.5256256832Yes32 MHz, 32 1 PIC16F1832 3.52562561432Yes32 MHz, 32 2 PIC16F183275122561432Yes32 MHz, 32 2 PIC16F18321410242561432Yes32 MHz, 32 2 PIC16F18321410242561432Yes32 MHz, 32 2 PIC16F183475122562032Yes32 MHz, 32 2 PIC16F18341410242562032Yes32 MHz, 32 2 PIC16F18341410242562032Yes32 MHz, 32 2 PIC16F1847141024256 / HEF1832No32 MHz, 32 2 PIC16F19337256256 / HEF2832No32 MHz, 32 2 PIC12F519 1.5416488No 4 MHz, 8 MH0 PIC12F529T 2.32016488No8 MHz 0 PIC16F526 1.567641420No 4 MHz, 8 MH2 PIC16F527 1.56864 / HEF2020No 4 MHz, 8 MH2 PIC16F84A 1.7568641820No No 0 PIC12LF155 3.52560 / HEF832No16 MHz, 32 0PIC16F1512 3.51280 / HEF2820No16 MHz, 32 0 PIC16F151372560 / HEF2820No16 MHz, 32 0 PIC16LF15572560 / HEF1432No32 MHz, 32 0 PIC16LF1551451202032No16 MHz 0 PIC16LF15614102402832No16 MHz 0 PIC16LF15614102404032No16 MHz 0 PIC12F1612 3.52560 / HEF832No32 MHz, 32 1 PIC16F1613 3.52560 / HEF1432No32 MHz, 32 2 PIC16F161475120 / HEF1432Yes32 MHz, 32 2 PIC16F16151410240 / HEF1432Yes32 MHz, 32 2 PIC16F161875120 / HEF2032Yes32 MHz, 32 2 PIC16F16191410240 / HEF2032Yes32 MHz, 32 2 PIC16F188575122562832Yes32 kHz 2 PIC16F18851410242562832Yes32 kHz 2 PIC16F18852820482562832Yes32 kHz 2 PIC16F18855640962562832Yes32 kHz 2 PIC16F18871410242564032Yes32 kHz 2 PIC16F18872820482564032Yes32 MHz, 32 2 PIC16F18875640962564032Yes32 MHz, 32 2 PIC18F26K464409610242864Yes64MHZ, 64KH2 PIC18F27K4128409610242864Yes64MHZ, 64KH2 PIC18F46K464409610244064Yes64MHZ, 64KH2 PIC18F47K4128409610244064Yes64MHZ, 64KH2 PIC18F24K41610242562864Yes64MHZ, 64KH2 PIC18F25K43220482562864Yes64MHZ, 64KH2 PIC18F45K43220482564064Yes64MHZ, 64KH2Slope Compe Data SignalInternal Vo Zero CrossMax D/A ResOperational Total # ofMax A/D Res Number of D00000No No00000Yes No02800Yes No02800Yes No00000No No00000No No03800Yes No00000Yes No041000Yes No041000Yes No000000No No0051015Yes No0091015Yes No00121015Yes No00301000Yes No00301000Yes No000000No No03800Yes No00000No No00000No No00000No No00000Yes No081000Yes No04800No No05800No No05800No No00111000No No08800No No0141000No No05800No No00111000No No08800No No0141000No No00000No No0111000No No0111000No No0141000No No0111000No No0141000No No0101000No No0101000No No0101000No No0101000No No0101000No No0101000No No0101000No No0101000No No0101000No No0101000No No0101000No No0101000No No0101200No No0101000No No0131200No No0101200No No0101200No No0131000No No0131000No No0131000No No0131000No No0131000No No0131000No No0131000No No0131000No No0131000No No0131000No No0 0131000No No0131000No No0131200No No0131000No No0131200No No0131200No No0131200No No0121000No No0121000No No0121200No No0121000No No0121000No No0121000No No0121000No No0121200No No0121000No No0121000No No0111000No No0121000No No0111000No No081000No No0121000No No0161200Yes No0 0111000No No0111000No No0111000No No0111000No No081000No No081000No No0111000No No0111000No No0121000No No0121200No No0161200Yes No0 0111000No No0111000No No081000No No0111000No No0121000No No0121200No No0161200Yes No00121000No No0121000No No0121200No No0121000No No0121000No No0121000No No0121000No No0121200No No0121000No No0121000No No0151000No No0121000No No0151000No No0121000No No0121000No No0241200Yes No0151000No No0121000No No0151000No No0121000No No0121000No No0121000No No0151000No No0151000No No021600No No0121000No No0121200No No0241200Yes No0151000No No0121000No No0121000No No0151000No No021600No No0121000No No0121200No No0241200Yes No0241200No No0161000No No0161000No No0241200Yes No0161000No No0241200Yes No00000No No00 00000Yes No0 041015Yes No00 041015Yes No00 041015Yes No00 041015Yes No00 081015Yes No00 0121015Yes No00 0121015Yes No00171000Yes No00281000Yes No0081015Yes No00 081015Yes No00 0121015Yes No00 0121015Yes No00 014800Yes No0 012800Yes No0 012800Yes No0 011800Yes No0 011800Yes No0 011800Yes No0 011800Yes No0 014800Yes No0 011800Yes No0 014800Yes No0 181019Yes No SC0 281000No Yes00 281018No Yes00 281018No Yes00 281000No Yes00 2121018No Yes00 2121018No Yes00 2171028No Yes00 2171028No Yes00 2281028No Yes00 2171028No Yes00 2281028No Yes00 1810110No Yes10 1810110No Yes10 2121020No Yes10 2121020No Yes10 31710210Yes Yes3 31710210Yes Yes3 42810210Yes Yes4 31710210Yes Yes3 42810210Yes Yes40101000No No0 081000No No0 081200No No0 0101000No No0 081000No No0 081000No No0 081000No No0 0101000Yes No0 0171015Yes No0 081200No No0 0131000No No0 0111000No No0 0111200No No0 0131000No No0 0111000No No0 0111000No No00281015Yes No0 0111200No No0 0121000No No0 0121000No No0 0161200Yes No0 0111200No No0 0161200Yes No0 0121000No No0 0121000No No0 0121200No No0 0161200Yes No0 0111200No No0 0161200Yes No0 0121000No No0 0121200No No0 0161200Yes No0 0161200Yes No0 0161000No No0 0161000No No0 0241200Yes No0 0241200Yes No0 0161000No No0 0161000No No0 0161200No No0 0241200Yes No0 0241200Yes No0 0161000No No0 0161200No No0 0241200Yes No0 0241200Yes No0 00000No No00000No No041000No No00000No No00000No No00000No No00000Yes No081000No No051000No No0111000Yes No041000No No041000No No03800Yes No00 03800Yes No00 28800Yes No041000No No2111218Yes No02111218Yes No03141218Yes No02111218Yes No03141218Yes No02111228Yes No00141015Yes No0111015Yes No0141015Yes No0111015Yes No0141015Yes No0171015Yes No0171015Yes No00000No No00000No No00000No No0121000Yes No081000No No0121000Yes No0121000Yes No081000No No0121000Yes No0121000Yes No2121000Yes No051000No No00000No No071000No No0111000Yes No0141000Yes No0111000Yes No0141000Yes No051000No No081000No No051000No No081000No No081000No No071000No No071000No No0121000Yes No091000Yes No0121000Yes No091000Yes No0101000No No0101000No No0101000No No0101000No No051000No No0101000Yes No0171015Yes No0101000No No0101200No No051000No No0101000No No0101200No No081000No No0101000Yes No0171015Yes No0141015Yes No00101000No No0101200No No081000No No0101000Yes No0171015Yes No0141015Yes No00131000No No0131000No No0131000No No0131000No No091000No No0131000Yes No0281015No No0131000No No0131200No No091000No No0131000No No0131200No No0111000No No0131000Yes No0281015Yes No0131000No No0131200No No0131000No No0131200No No0111000No No0131000Yes No0281015Yes No0251015Yes No041015Yes No0041015Yes No0081015Yes No0081015Yes No0081015Yes No00121015Yes No00121015Yes No00121015Yes No00121015Yes No0051015Yes No00 0111015Yes No00 0111015Yes No00 0111015Yes No00 0111015Yes No00 0171015Yes No00 0171015Yes No00 0171015Yes No00 0121015Yes No00111015Yes No0 00000No No00000No No03800Yes No28800Yes No0171000Yes No00171000Yes No00111000No No00 0171000No No00 0231000No No00 0231000No No00 041000No Yes0081000No Yes00 081000No Yes00 081000No Yes00 0121000No Yes00 0121000No Yes00 0241015Yes Yes00241015Yes Yes00241015Yes Yes00241015Yes Yes00 0351015Yes Yes00 0351015Yes Yes00 0351015Yes Yes00 0241015Yes Yes00 0241015Yes Yes00 0351015Yes Yes00 0351015Yes Yes00 0241015Yes Yes00 0241015Yes Yes00 0351015Yes Yes00Math Accele ADC Math PaMax PWM Res Angular TimMax # PWM oMax 8 Bit D Max 16 BitSignal Meas Hardware Li1000100010001000100010001000110021010210101120213102131021510630063001000100010001000100011002101021010210102100010210102101021010210001021010210102101010001100110011001100110013010120101201023010230101301013010120102301023010130102301013010 12010 12010 23010 23010 13010 13010 12010 23010 23010 13010 23010 44010 23010 44010 44010 44010 13010 13010 13010 13010 13010 13010 13010 13010 13010 13010 23010 13010 23010 23010 13010 040000 23010 23010 23010 23010 23010 23010 23010 23010 13010 13010 040000 23010 23010 23010 23010 13010130101301023010130101301013010130102301013010230102301013010040023010230102301023010230102301023010230103101013010130100400230102301023010230103101013010130100400040023010230100400230100400100000No No No 100000No No No 2100510No No No 2400416No No No 2400416No No No 210120No No No 2100510No No No 2100510No No No 2100510No No No 210000No No No210000No No No 2500616No No No 2500616No No No 2500616No No No 2500616No No No 3100010No No No 2100010No No No 2100010No No No 2100010No No No 2100010No No No 2100010No No No 2100010No No No 2100010No No No 2100010No No No 2100010No No No 310200No No No 210000No No No 4100010No No No 4100010No No No 210000No No No 4100010No No No 4100010No No No 4100010No No No 4100010No No No 4100010No No No 4100010No No No 4100010No No No 4303016No No No 4303016No No No 4303016No No No 4303016No No No 53042016No No No 53042016No No No 53042816No No No 53042016No No No 53042816No No No 1300010No No No 1300010No No No 2300010No No No 1300010No No No 1300010No No No 1300010No No No 1300010No No No 1300010No No No 340000No No No 2300010No No No 1300010No No No 1300010No No No 2300010No No No 1300010No No No 1300010No No No 1300010No No No340000No No No 2300010No No No 2300010No No No 2300010No No No 440000No No No 2300010No No No 440000No No No 2300010No No No 2300010No No No 2300010No No No 650000No No No 2300010No No No 650000No No No 2300010No No No 2300010No No No 650000No No No 650000No No No 2300010No No No 2300010No No No 440000No No No 440000No No No 2300010No No No 2300010No No No 2300010No No No 650000No No No 650000No No No 2300010No No No 2300010No No No 650000No No No 650000No No No 11001100110021010210101100110011002101021010020002002000410No No No 2000410No No No 10002101021001016210010162100171621001116210017162100171641010 41010 41010 41010 1100 1100 21010 1100 21010 21010 1100 1100 1100 21010 21010 21010 21010 21010 21010 21010 21010 21010 21010 21010 21010 21010 21010 13010 13010 13010 13010 13010 13010 13010 13010 13010 13010 13010 13010 1300 13010 13010 13010 13010 13010 13010 13010 1300 22010130103401022010130101301013010130101301013010130013010130101301013010130101301013010130013010130101301013010130101301034010220102100210No No No 2100210No No No 210040No No No 410080No No No 4100810No No No 2100410No No No 4100810No No No 4100810No No No 4100810No No No 2100510No No No 2100510No No No 4300510No No No 4300510No No No 4300510No No No 4300510No No No 4300510No No No 4300510No No No 4100810No No No 4100010No No No 1000100010001000210000No No No 210000No No No 210000No No No 210000No No No 210000No No No 210000No No No 412300No No No 412300No No No 432300Yes Yes No 432300Yes Yes No 432300Yes Yes No 432300Yes Yes No 1423010No No No 1423010No No No 1423010No No No 1423010No No No 1423010No No No 1423010No No No 1423010No No No 4301010No No No 4301010No No No 4301010No No No 4301010No No No 4301010No No No 4301010No No No 4301010No No NoNumerically Programmabl UART SPI鈩?,I2C"CRC/Scan Configurabl ComplementaNumber of U Windowed Wa0000No NO0000000No NO0000000No NO0000000No NO0000000No NO0000000No NO0000000No NO0000000No NO0000000No NO0000000No No0001111No No0001111No No0101111No No0101110No No4112220No No0002220No No0000000No No0000000No NO0000000No NO0000000No NO0000000No NO0000000No NO0000000No NO0000000No No0000000No No0001110No No0001110No NO0001110No No0001110No NO0001110No No0001110No NO0001110No No0001110No NO0001110No No0000000No NO0000000No NO0001000No NO0001000No NO0001000No NO0001110No NO0001001No NO0001110No NO0002220No NO0002221No NO0001110No NO0001110No NO0001110No NO0002220No NO0002221No NO0001110No No0002220No NO0002221No NO000 2220No NO000 2221No NO000 1110No NO000 1001No NO000 1220No NO000 2220No NO000 2221No NO000 1110No No000 1110No NO000 1220No No000 2220No NO000 2221No No000 1110No NO000 2220No NO000 2220No NO000 2221No NO000 2221No NO000 2220No NO000 2221No NO000 2110No No000 2110No NO000 2110No NO000 2110No NO000 2110No NO000 2110No NO000 2110No NO000 2110No NO000 2110No NO000 2110No NO000 2220No NO000 2110No NO000 2220No NO000 2221No NO000 2110No NO000 4221No No000 2220No No000 2220No NO000 2220No No000 2220No NO000 2221No NO000 2221No NO000 1110No NO000 1110No NO000 2110No NO000 2110No NO000 4221No No000 2220No No000 2220No NO000 2221No NO000 1110No NO000 2110No NO000。
PIC18F2420252044204520配置位详细说明
详细可以参考datasheet的23.0 CPU 的特殊功能PIC18F2420/2520/4420/4520 器件具有几项特殊的功能旨在最大限度地提高系统可靠性,并通过减少外部元件把成本降到最低。
这些功能包括:• 振荡器选择• 复位:- 上电复位(POR)- 上电延时定时器(PWRT)- 振荡器起振定时器(OST)- 欠压复位(BOR)• 中断• 看门狗定时器(WDT)• 故障保护时钟监视器(FSCM)• 双速启动• 代码保护• ID 单元• 在线串行编程选择振荡器时,要根据具体应用对频率、功耗、精度和成本的要求。
在第2.0 节“振荡器配置”中详细讨论了所有的选项。
在本数据手册的前面几章中已经完整地讨论了器件的复位和中断。
除了为复位提供了上电延迟定时器和振荡器起振定时器之外,PIC18F2420/2520/4420/4520 器件还提供了一个看门狗定时器,该定时器可配置成永久使能或用软件控制(如果使能位被禁止的话)。
器件自带的RC 振荡器还提供了故障保护时钟监视器(FSCM)和双速启动这两个额外的功能。
FSCM 对外设时钟进行后台监视,并在外设时钟发生故障时自动切换时钟源。
双速启动使得几乎可在起振发生时立即执行代码,而此时主时钟源正在完成起振延时。
通过设置相应的配置寄存器位可以使能和配置所有这些功能。
23.1 配置位可以通过对配置位编程(读为0)或不编程(读为1)来选择不同的器件配置。
这些配置位被映射到程序存储器从300000h 开始的单元中。
用户会注意到地址300000h 超出了用户程序存储空间的范围。
事实上,它属于配置存储空间(300000h-3FFFFFh),该空间仅能通过表读和表写进行访问。
对配置寄存器编程类似于对闪存存储器编程。
EECON1寄存器中的WR 位可启动对配置寄存器的自定时写操作。
在正常工作模式下,采用TBLPTR 指向配置寄存器的TBLWT 指令设置要用于写操作的地址和数据。
ft8725产品手册
FT8725产品手册一、产品概述FT8725是一款高性能的电机驱动控制芯片,专为无刷直流电机(BLDC)和有刷直流电机(DC电机)控制而设计。
该芯片具有高度集成、高可靠性、低功耗等优点,广泛应用于各种电机驱动控制领域,如电动工具、电动自行车、无人机等。
二、引脚定义FT8725采用QFN56封装,共有56个引脚。
以下是引脚定义:1.VCC:电源正极,接36V输入电压。
2.GND:电源负极,接地。
3.PWM1-PWM2:PWM信号输入引脚,用于调节电机速度和方向。
4.ENA:使能信号输入引脚,控制电机驱动的开关状态。
5.IN1-IN2、IN3-IN4:电机相线输入引脚,用于控制电机的旋转方向和速度。
6.HO1-HO2、LO1-LO2:高侧和低侧驱动输出引脚,用于驱动电机的半桥或全桥电路。
7.VB1-VB2:电机相电压检测引脚,用于检测电机的相电压状态。
8.TEMP:芯片温度检测引脚,用于监测芯片温度。
9.AREF、GREF:模拟和数字参考电压引脚,用于提供模拟和数字电路的参考电压。
三、功能描述FT8725主要具有以下功能:1.电机驱动控制:支持无刷直流电机和有刷直流电机的高效驱动。
2.PWM调节:通过PWM信号输入引脚,可实现电机速度和方向的调节。
3.开关状态控制:通过使能信号输入引脚,可控制电机的开关状态。
4.温度监测:具有温度检测功能,可在高温条件下保护芯片和电机。
5.参考电压输出:提供模拟和数字参考电压,便于系统中的其他电路使用。
6.保护功能:内置过流保护、过压保护和欠压保护等保护功能,提高系统稳定性。
四、寄存器映射FT8725内部设有多个寄存器,用于配置和控制电机驱动的各项参数。
以下是寄存器的映射关系:1.寄存器0:系统控制寄存器,用于控制芯片的使能、中断等操作。
2.寄存器1:PWM控制寄存器,用于设置PWM信号的频率、占空比等参数。
3.寄存器2:电机方向控制寄存器,用于设置电机的旋转方向。
PIC18F2420252044204520配置位详细说明
详细可以参考datasheet的23.0 CPU 的特殊功能PIC18F2420/2520/4420/4520 器件具有几项特殊的功能旨在最大限度地提高系统可靠性,并通过减少外部元件把成本降到最低。
这些功能包括:• 振荡器选择• 复位:- 上电复位(POR)- 上电延时定时器(PWRT)- 振荡器起振定时器(OST)- 欠压复位(BOR)• 中断• 看门狗定时器(WDT)• 故障保护时钟监视器(FSCM)• 双速启动• 代码保护• ID 单元• 在线串行编程选择振荡器时,要根据具体应用对频率、功耗、精度和成本的要求。
在第2.0 节“振荡器配置”中详细讨论了所有的选项。
在本数据手册的前面几章中已经完整地讨论了器件的复位和中断。
除了为复位提供了上电延迟定时器和振荡器起振定时器之外,PIC18F2420/2520/4420/4520 器件还提供了一个看门狗定时器,该定时器可配置成永久使能或用软件控制(如果使能位被禁止的话)。
器件自带的RC 振荡器还提供了故障保护时钟监视器(FSCM)和双速启动这两个额外的功能。
FSCM 对外设时钟进行后台监视,并在外设时钟发生故障时自动切换时钟源。
双速启动使得几乎可在起振发生时立即执行代码,而此时主时钟源正在完成起振延时。
通过设置相应的配置寄存器位可以使能和配置所有这些功能。
23.1 配置位可以通过对配置位编程(读为0)或不编程(读为1)来选择不同的器件配置。
这些配置位被映射到程序存储器从300000h 开始的单元中。
用户会注意到地址300000h 超出了用户程序存储空间的范围。
事实上,它属于配置存储空间(300000h-3FFFFFh),该空间仅能通过表读和表写进行访问。
对配置寄存器编程类似于对闪存存储器编程。
EECON1寄存器中的WR 位可启动对配置寄存器的自定时写操作。
在正常工作模式下,采用TBLPTR 指向配置寄存器的TBLWT 指令设置要用于写操作的地址和数据。
nanoWatt XLP PIC18F1XK22 闪存微控制器说明书
nanoWatt XLP™ PIC18F1XK22 Flash MCUM i c r o ch i p T e c h n o l o g y I n c o r p o r a t e dFlexible Oscillator Structure■Precision 16 MHz internal oscillator block:– Factory calibrated to ± 1%– Software selectable frequencies range of 31 kHzto 16 MHz– 64 MHz performance available using PLL– No external components required■Four crystal modes up to 64 MHz■Fail-Safe Clock Monitor – Allows for safe shutdown ifperipheral clock stops■Two-Speed Oscillator Start-upSpecial Microcontroller Features■Operating voltage 1.8V- 5.5V (with low voltage option1.8V-3.6V)■Self-reprogrammable under software control■Power-on Reset (POR), Power-up Timer (PWRT) andOscillator Start-up Timer (OST)■Programmable Brown-out Reset (BOR)■Extended Watchdog Timer (WDT) with on-chip oscillatorand software enable■In-Circuit Serial Programming™ (ICSP™) via two pins■In-Circuit Debug via two pinsSummaryIntroducing the nanoWatt XLP PIC18F1XK22 Flash microcontroller: not too big, not too small… just right! This new family of devices offer all of the advantages of the well recognized PIC18F High Performance MCUs; 8-bit,C compiler optimized architecture and an industry leading peripheral set now available in a low pin-count option. These new 20-pin products include a 16 MHz precision Internal Oscillator which can be used with the standard 4X PLL to produce 16 MIPS of performance (64 MHz @ 3V). Standard analog peripherals include 12 channels of10-bit A/D, Dual Rail-Rail Comparators with improvedinput/output multiplexing and an on-chip selectable Fixed Voltage Reference. Digital peripherals include an Enhanced Capture/Compare/PWM (ECCP+) module with PWM steering and a Master Synchronous Serial Port (MI2C,SPI) module with software controllable address masking. These devices also feature the SR Latch mode which supports capacitive sensing applications.In addition to these peripherals, the devices feature several microcontroller monitors that provide for reliable operation including BOR (Brown Out Reset) with software enable, POR (Power On Reset) and an Extended WDT. The addition of nanoWatt XLP technology make these devices ideally suited for battery powered applications or designs where power consumption is constrained.Features■ C Compiler optimized architecture■256 bytes data EEPROM■Linear program memory addressing to 16 Kbytes■Linear data memory addressing to 512 bytesExtreme Low-Power ManagementPIC18LF1XK22 with nanoWatt XLP™ Technology■Sleep mode: 50 nA, typical■Watchdog Timer: 600 nA, typical■Timer1 Oscillator: 800 nA @ 32 kHz, typicalInformation subject to change. The Microchip name and logo, the Microchip logo, MPLAB and PIC are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. In-Circuit Serial Programming, ICSP , MPASM, MPLIB, MPLINK, mTouch and nanoWatt XLP are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. All other trademarks mentioned herein are property of their respective companies. © 2009, Microchip Technology Incorporated. All Rights Reserved. Printed in the U.S.A. 6/09 DS41387B*DS41387B*Visit our web site for additional product information and to locate your local sales office.Microchip Technology Inc. • 2355 W. Chandler Blvd. • Chandler, AZ 85224-6199/PIC18K /XLPPart Number Development ToolDescriptionSW007002MPLAB® IDE – includes: MPASM™ Assembler, MPLINK™Linker/MPLIB™ Librarian and MPLAB SIM Software Simulator Integrated Development Environment (download free of charge at )DM183032PIC18 Explorer Low-cost Development Board for PIC18 MCUs DM24000116-bit ExplorerLow-cost Development Board for 16-bit PIC MCUs DV164131PICkit™ 3 Debug ExpressIn-Circuit Debugger/Programmer DV164035MPLAB ICD 3 In-Circuit Debugger Kit In-Circuit Debugger/Programmer DV007004MPLAB PM3 Universal Device Programmer Full-featured Modular Device Programmer DV244005MPLAB REAL ICE™ In-Circuit EmulatorHigh Speed Emulation SystemPeripheral Highlights■ 12 Ch. 10-bit Analog-to-Digital (A/D) Converter module:■ 2 rail-to-rail Analog Comparators module with:■ Voltage Reference module with:– Programmable on-chip voltage reference (CV REF ) module (% of V DD )– Selectable Fixed voltage reference (FVR) with multiple reference voltages■ 17 I/O pins and 1 input only pin:– High current sink/source 25 mA/25 mA – Three external interrupt pins ■ Four Timer modules:– 3 16-bit timers/counters with prescaler– 1 8-bit timer/counter with 8-bit period register, prescaler and postscaler■ Enhanced Capture/Compare/PWM (ECCP) module with PWM output steering:– Programmable dead time– Auto-shutdown and Auto-restart■ Master Synchronous Serial Port (MSSP) module with t wo modes of operation:– 3-wire SPI (supports all 4 SPI modes) – I 2C™ Master and Slave modes (Slave mode with address masking)■ Enhanced Universal Synchronous Asynchronous Receiver Transmitter module (EUSART)– Supports RS-232, RS-485 and LIN 2.0 – Auto-Baud Detect■ SR Latch (555 Timer) module with: – Confi gurable inputs and outputs– Supports mTouch™ capacitive sensing applicationsAdditional Information■ 8-bit PIC® Microcontroller Solutions Brochure , DS39630■ Low-Cost Development Tools Guide , DS51560■ Corporate Product Line Card, DS00890Sample/Purchasing Information■ On-line Sampling: ■ On-line Purchasing: Product Program Memory (Bytes)Data EEPROM (Bytes)DataRAM(Bytes)I/O Pins(Total)ADC ComparatorsECCP/CCP Communication Timers/WDT SR Latch Standard Operating Voltage Packages PIC18F14K2216K 2565121812 x 10b 21/0MI 2C, SPI, EUSART 3-16b, 1-8b, EWDT Yes 1.8V-5.5V PDIP , SSOP , SOIC, QFN PIC18LF14K2216K 2565121812 x 10b 21/0MI 2C, SPI, EUSART 3-16b, 1-8b, EWDT Yes 1.8V-3.6V PDIP , SSOP , SOIC, QFN PIC18F13K228K 2562561812 x 10b 21/0MI 2C, SPI, EUSART 3-16b, 1-8b, EWDT Yes 1.8V-5.5V PDIP , SSOP , SOIC, QFN PIC18LF13K228K2562561812 x 10b21/0MI 2C, SPI, EUSART3-16b, 1-8b, EWDTYes1.8V-3.6VPDIP , SSOP , SOIC, QFN。
PIC18F的配置
#pragma config XINST=OFF //不使用扩展指令集
// CONFIG1H
#pragma config FOSC=INTIO1 //内置晶振,振荡器4-16MHZ;INTIO1 振荡器(内部振荡器从FOSC2口输出),电路板上没晶振时选择INTIO1 振荡器
#pragma config EBTR1=OFF //允许表读02000-03FFF(禁用)/Table Read Protect 02000-03FFF (Disabled)
#pragma config EBTR2=OFF //允许表读04000-05fff(禁用)/Table Read Protect 04000-05FFF (Disabled)
// PIC18F25K80 Configuration Bit Settings
// 'C' source line config statements
#include <xc.h>
// #pragma config statements should precede project file includes./编译配置报表应先于项目文件包括。
// CONFIG5L//看门狗关闭 上电延时定时器打开 低电压复位禁止 没有代码保护
#pragma config CP0=OFF //代码保护关闭/代码保护00800-01fff(禁用)
#pragma config CP1=OFF //代码保护关闭/代码保护02000-01fff(禁用)
void main()
{
uint i;
pic16f877中文资料[1]
PIC16F877原理简介1.1 PIC16F877特性:PIC16F877是由Microchip公司所生产开发的新产品,属于PICmicro系列单片微机,具有Flash program程序内存功能,可以重复烧录程序,适合教学、开发新产品等用途;而其内建ICD(In Circuit Debug)功能,可以让使用者直接在单片机电路或产品上,进行如暂停微处理器执行、观看缓存器内容等,让使用者能快速地进行程序除错与开发。
如图1为PIC16F877的40根接脚图,PDIP是指一般最常见的DIP(Dual In Line Package)包装,而PIC单片机也有PLCC(Plastic Leaded Chip Carrier)与QFP(Quad Flat Package)两种形式的包装,依照不同的需求,寻找不同的包装形式。
如图所示,每根接脚都有其特定功能,例如Pin11与Pin32(VDD)为正电源接脚,Pin12与Pin31(VSS)为地线接脚;而有些接脚有两种甚至三种以上功能,例如Pin2(RA0/AN0)代表PORTA的第一支接脚,在系统重置(Reset)后,可自动成为模拟输入接脚,接收模拟讯号,也可经由程序规划为数字输出输入接脚。
图1. PDIP40引脚PIC16F877接脚说明图2. PDIP28和SOIC28引脚PIC16F877接脚图说明图3. PLCC44引脚PIC16F877脚位图说明图4. QFP44引脚PIC16F877引脚图说明PIC16F877属于闪控式(Flash)单片机,可以重复烧录,其ROM的容量总共是8K words,以2K为一个page,区分为4个pages;内部RAM总共有512个字节(00f~1FFh),以128个字节为一个Bank,共区分为4个Bank,如图5所示,每个Bank的前半段都有其特殊用途,分别连接到其特殊功能模块,例如I/O、CCP、Timer、USART、MSSP等。
PIC18F8723 数据手册
RF1/AN6/C2OUT RF0/AN5 AVDD AVSS
RA3/AN3/VREF+ RA2/AN2/VREF-
RA1/AN1 RA0/AN0
VSS VDD RA5/AN4/HLVDIN RA4/T0CKI RC1/T1OSI/ECCP2(1)/P2A(1) RC0/T1OSO/T13CKI RC6/TX1/CK1 RC7/RX1/DT1
AmpLab、 FilterLab、 Linear Active Thermistor、 Migratable Memory、 MXDEV、 MXLAB、 SEEVAL、 SmartSensor 和 The Embedded Control Solutions Company 均为 Microchip Technology Inc. 在美国的注册商标。
• 通过两个引脚进行在线调试 (In-Circuit Debug, ICD)
• 宽工作电压范围:2.0V 至 5.5V • 故障保护时钟监视器 • 双速振荡器启动 • 纳瓦技术
注:
“PIC18F8722 Family Data Sheet” (DS39646B)对本文档进行了补充。 请参 见第 1.0 节 “器件概述”。
功耗管理模式:
• 运行:CPU 工作,外设打开 • 空闲:CPU 不工作,外设打开 • 休眠:CPU 不工作,外设关闭 • 处于空闲模式时电流降至 15 µA (典型值) • 处于休眠模式时电流降至 0.2 µA (典型值) • Timer1 振荡器:1.8 µA, 32 kHz, 2V • 看门狗定时器:2.1 µA
• 可在软件控制下自行编程 • 中断优先级 • 8 x 8 单周期硬件乘法器 • 扩展的看门狗定时器 (Watchdog Timer,
从PIC18F 移植至PIC24F:概述
引言PIC24F架构是在Microchip现有的 RISC单片机系列架构的基础上发展起来的一种功能强大的架构。
通过向用户提供更强的计算功能和更加丰富的外设集,此架构使用户能够升级他们的应用。
与此同时,此架构还被严格设计为与现有PIC® MCU功能集和指令助记符尽可能一致,从而简化了应用的升级工作。
本移植文档重点介绍PIC18F和PIC24F系列器件之间的相同点和不同点,并介绍了从PIC18F移植至PIC24F 器件的一般原则。
本文档通篇假设要被移植的应用基于某种较新的PIC18F系列器件,如常用的PIC18F8722系列,这类器件带有所有PIC18F器件所具备的完整功能集和最新的纳瓦技术。
假设目标器件属于PIC24FJ128GA 通用系列,这一系列是第一代的PIC24F通用器件。
但本文所述的通用原则适用于将基于任何PIC18F器件的应用移植到PIC24F平台上。
为能全面地进行概述,特意将本文档分成两大部分,每一部分的概述方式有微小区别。
第一部分比对了两种内核架构之间的差异,并重点介绍了主要的差异。
由于这些差异会显著地改变应用的整体结构,因此阐述的重点并不在执行特定任务的方式上,而是在移植中需要考虑哪些较大的变化。
具体需作哪些修改留给用户根据应用自主决定。
第二部分讨论PIC18F和PIC24F架构所共有的外设。
同样会比较模块的功能,本文还将比较使每个模块运行的步骤,并给出针对于特定任务的信息。
该部分仅介绍两种架构均支持的外设功能。
鼓励用户查看PIC24F器件的数据手册了解新模块的相关信息,以及如何将这些模块用于即将被移植的应用中。
目录PIC24F内核架构 (2)CPU内核 (2)指令集 (4)存储器映射和程序存储器 (7)数据存储空间 (11)复位和启动时序 (13)中断控制器 (17)振荡器 (19)节能特性 (23)看门狗定时器(WDT) (25)器件的集成功能 (26)PIC24F外设集 (27)I/O端口 (27)定时器(Timer1、Timer2/3和Timer4/5) (29)捕捉/比较/PWM(CCP和ECCP) (31)串行外设接口(SPI) (34)I2C™ (36)通用异步接收器/发送器( UART) (38)10位A/D转换器 (41)比较器和比较器参考电压模块 (43)小结 (45)参考书目 (45)将PIC18F指令映射到 PIC24F (47)注1:器件被设计为按照其数据手册中的参数运行。
PIC18串口课件
bit 5 SSPEN:同步串行口使能位
1= 使能串行口,并配置SCK、SDO、SDI和SS作为串行口 引脚 0= 禁止串行口,并配置这些引脚为I/O 口引脚
bit 4 CKP:时钟极性选择位
1= 高电平为时钟空闲状态 0= 低电平为时钟空闲状态
bit 3-0 SSPM3:SSPM0:同步串行口模式选择位
I2C 的库函数
10
I2C 的应用实例
APP001 开发板上配置了一个 I2C 接口 的EPPROM存储器24LC024和一个数字温 度传感器 TC74 ,采用单片机读取 TC74 的 测量温度。
11
I2C 的应用实例
12
#define TC74_Addr 0b10011110 //定义宏 #define TC74_RWCR 0x01 #define TC74_RTR 0x00 unsigned Read_TC74_Temperature(void) { TC_74.Word = 0 ; TC_74.Word=EERandomRead(TC74_Addr,TC74_RWCR); // 从TC74-A7读寄存器状态 if ( TC_74.BitD6 ) // b6 =1 , 开始读取温度 { TC_74.Word=EERandomRead(TC74_Addr,TC74_RTR); if ( TC_74.Word >= 0 ) return TC_74.Word; else return -1;// 读失败,返回(-1) } else return -2;// b6=0, 返回(-2) }
PIC18F单片机CAN通信程序及AD采样
一、程序流程图二、功能描述:AD数据采集,AD采集20组数据,每组数据50个采样值,然后将采样值经过计算平均值并转换为十进制数据后发送到CAN,在PC机上用CANTools软件调试主函数流程图中断函数流程图三、程序源码/* **************************************************************** *************************************************************** */#include "pic18f4680.h" /* PIC18系列的头文件*/char CAN_TX_Adress_H,CAN_TX_Adress_L; /* CAN 发送邮箱标识符高低字节*/ char CAN_RX_Adress_H,CAN_RX_Adress_L; /* CAN 接收邮箱标识符高低字节*/ #define CHANNEL7 0X1D //选择模拟通道7采集正输出电压#define CHANNEL6 0X19//选择模拟通道6采集正输出电流#define CHANNEL3 0X0D//选择模拟通道3采集正输出电压#define CHANNEL2 0X09//选择模拟通道2采集正输出电流#define CHANNEL1 0X05//选择模拟通道1采集负输出电流#define CHANNEL0 0X01//选择模拟通道0采集负输出电压#define LN 50 //采集50次进行平均#define LAN 20 //采集20个平均值bank2 uint AD[LN];//存放50次采样值uint RES[LAN]; //存放20个平均值uint RESVP=0x0000; //存放正输出电压采样值,供CAN上传数据uint RESIP=0X0000;//存放正输出电流电压采样值,供CAN上传数据uint RESVN=0X0000;//存放负输出电压采样值,供CAN上传数据uint RESIN=0X0000;//存放负输出电流正电压采样值,供CAN上传数据uchar WAIT_FLAG; //等待中断标志位uint count; //100次计数/* ****************************************************************** 函数名: initial()** 功能描述: 系统初始化子程序,放在程序首部*************************************************************** */void initial(){count=0;INTCON=0x00; /* bit7-bit0:关总中断*/PIE1=0; /* PIE1 的中断不使能*/PIE2=0; /* PIE2 的中断不使能*/PIE3=0; /* PIE3 的中断不使能*/}/* ****************************************************************** 函数名: initcan()** 功能描述: CAN初始化子程序,采用标准标识符,正常工作模式*************************************************************** */void initcan(){// 设置发送邮箱0标识符:10011001010=0x04CACAN_TX_Adress_L=0x55; //CAN低地址标识符CAN_TX_Adress_L=CAN_TX_Adress_L&0xe0;CAN_TX_Adress_H=0x99; //CAN高地址标识符,应与发送方标识符相同// 设置接收邮箱0标识符:00110011111=0x019FCAN_RX_Adress_H=0x33; //CAN高地址标识符CAN_RX_Adress_L=0xe0; //CAN低地址标识符,应与发送方标识符相同CAN_RX_Adress_L=CAN_RX_Adress_L&0xe0;// ************设置对CAN进行配置***************TRISB=TRISB & 0XFB; // 设置CANRX/RB3输入,CANTX/RB2输出CANCON=0X80; //CANCON,bit7-5:1XX请求配置while((CANSTAT & 0X80)==0) // CAN状态寄存器。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
• 2 个带输入复用的模拟比较器 • 高灌 / 拉电流:25 mA/25 mA • 4 个可编程外部中断 • 4 个输入电平变化中断
外部存储器接口:
• 寻址能力最高可达 2 MB • 8 位或 16 位接口 • 8 位、 12 位、 16 位和 20 位地址模式
注 1: ECCP2/P2A 引脚位置取决于 CCP2MX 配置位的设置。
DS39894A_CN 第2 页
初稿
2007 Microchip Technology Inc.
引脚图 (续)
80 引脚 TQFP
PIC18F8723
RH1/A17 RH0/A16 RE2/AD10/CS/P2B RE3/AD11/P3C(2) RE4/AD12/P3B(2) RE5/AD13/P1C(2) RE6/AD14/P1B(2) RE7/AD15/ECCP2(1)/P2A(1) RD0/AD0/PSP0 VDD VSS RD1/AD1/PSP1 RD2/AD2/PSP2 RD3/AD3/PSP3 RD4/AD4/PSP4/SDO2 RD5/AD5/PSP5/SDI2/SDA2 RD6/AD6/PSP6/SCK2/SCL2 RD7/AD7/PSP7/SS2 RJ0/ALE RJ1/OE
RE1/WR/P2C RE0/RD/P2D RG0/ECCP3/P3A RG1/TX2/CK2 RG2/RX2/DT2 RG3/CCP4/P3D RG5/MCLR/VPP RG4/CCP5/P1D
VSS VDD RF7/SS1 RF6/AN11 RF5/AN10/CVREF RF4/AN9 RF3/AN8 RF2/AN7/C1OUT
提供本文档的中文版本仅为了便于理解。请勿忽视文档中包含
的英文部分,因为其中提供了有关 Microchip 产品性能和使用 情况的有用信息。Microchip Technology Inc. 及其分公司和相 关公司、各级主管与员工及事务代理机构对译文中可能存在的 任何差错不承担任何责任。建议参考 Microchip Technology Inc. 的英文原版文档。
本出版物中所述的器件应用信息及其他类似内容仅为您提供便
利,它们可能由更新之信息所替代。确保应用符合技术规范, 是您自身应负的责任。Microchip 对这些信息不作任何明示或 暗示、书面或口头、法定或其他形式的声明或担保,包括但不 限于针对其使用情况、质量、性能、适销性或特定用途的适用 性的声明或担保。 Microchip 对因这些信息及使用这些信息而 引起的后果不承担任何责任。如果将 Microchip 器件用于生命 维持和 / 或生命安全应用,一切风险由买方自负。买方同意在 由此引发任何一切伤害、索赔、诉讼或费用时,会维护和保障 Microchip 免于承担法律责任,并加以赔偿。在 Microchip 知识 产权保护下,不得暗中或以其他方式转让任何许可证。
功耗管理模式:
• 运行:CPU 工作,外设打开 • 空闲:CPU 不工作,外设打开 • 休眠:CPU 不工作,外设关闭 • 处于空闲模式时电流降至 15 µA (典型值) • 处于休眠模式时电流降至 0.2 µA (典型值) • Timer1 振荡器:1.8 µA, 32 kHz, 2V • 看门狗定时器:2.1 µA
商标
Microchip 的名称和徽标组合、 Microchip 徽标、 Accuron、 dsPIC、 KEELOQ、 KEELOQ 徽标、 microID、 MPLAB、 PIC、 PICmicro、 PICSTART、 PRO MATE、 rfPIC 和 SmartShunt 均为 Microchip Technology Inc. 在美国和其他国家或地区的 注册商标。
RF1/AN6/C2OUT RF0/AN5 AVDD AVSS
RA3/AN3/VREF+ RA2/AN2/VREF-
RA1/AN1 RA0/AN0
VSS VDD RA5/AN4/HLVDIN RA4/T0CKI RC1/T1OSI/ECCP2(1)/P2A(1) RC0/T1OSO/T13CKI RC6/TX1/CK1 RC7/RX1/DT1
• 可在软件控制下自行编程 • 中断优先级 • 8 x 8 单周期硬件乘法器 • 扩展的看门狗定时器 (Watchdog Timer,
WDT):
- 可编程周期从 4 ms 到 131s
• 通过两个引脚进行单电源供电的在线串行编程 (In-Circuit Serial Programming™, ICSP™)
EUSART 比较器 8/16 位 定时器 外部总线
器件
程序存储器
数据存储器
12 位
CCP/
闪存 单字节 SRAM EEPROM I/O
A/D
ECCP
(字节) 指令条数 (字节) (字节)
(通道数) (PWM)
MSSP
SPI
主 I2C™
PIC18F6628 96K 49152 3936 1024 54
ቤተ መጻሕፍቲ ባይዱ
64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49
1
48
2
47
3
46
4
45
5
44
6
43
7 8
PIC18F6628
42 41
9
PIC18F6723
40
10
39
11
38
12
37
13
36
14
35
15
34
16
33
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
• Microchip 愿与那些注重代码完整性的客户合作。
• Microchip 或任何其他半导体厂商均无法保证其代码的安全性。代码保护并不意味着我们保证产品是 “牢不可破”的。
代码保护功能处于持续发展中。 Microchip 承诺将不断改进产品的代码保护功能。任何试图破坏 Microchip 代码保护功能的行为均可视 为违反了 《数字器件千年版权法案 (Digital Millennium Copyright Act)》。如果这种行为导致他人在未经授权的情况下,能访问您的 软件或其他受版权保护的成果,您有权依据该法案提起诉讼,从而制止这种行为。
12
PIC18F6723 128K 65536 3936 1024 54
12
PIC18F8628 96K 49152 3936 1024 70
16
PIC18F8723 128K 65536 3936 1024 70
16
2/3
2有 有
2
2 2/3 无
2/3
2有 有
2
2 2/3 无
2/3
2有 有
2
2 2/3 有
PIC18F8723 系列 数据手册
带有 12 位 A/D 并采用纳瓦技术的 64/80 引脚增强型 1MB 闪存单片机
2007 Microchip Technology Inc.
初稿
DS39894A_CN
请注意以下有关 Microchip 器件代码保护功能的要点: • Microchip 的产品均达到 Microchip 数据手册中所述的技术指标。
• 2 个主同步串行端口(Master Synchronous Serial Port, MSSP)模块,支持 2/3/4 线 SPI (总共 4 种模式)和 I2C™ 主从模式
• 2 个捕捉 / 比较 /PWM (Capture/Compare/ PWM , CCP)模块
• 3 个增强型捕捉 / 比较 /PWM (Enhanced Capture/ Compare/PWM, ECCP)模块: - 1、 2 或 4 个 PWM 输出 - 可选择的极性 - 可编程的死区时间 - 自动关闭和自动重启
初稿
2007 Microchip Technology Inc.
PIC18F8723 系列
带有 12 位 A/D 并采用纳瓦技术的 64/80 引脚增强型 1 MB 闪存单片机
外设特点:
• 最多 16 路通道的 12 位模 / 数转换器模块 (A/D): - 自动采集功能 - 休眠模式下可进行转换
单片机的特殊功能:
• 优化的 C 编译器架构:
- 可选的扩展指令集,可用于优化重入代码
• 增强型闪存程序存储器:可耐受 100,000 次擦 / 写 (典型值)
• 数据 EEPROM 存储器:可耐受 1,000,000 次擦 / 写 (典型值)
• 闪存 / 数据 EEPROM 的数据保存时间:100 年 (典型值)
• Microchip 确信:在正常使用的情况下, Microchip 系列产品是当今市场上同类产品中最安全的产品之一。
• 目前,仍存在着恶意、甚至是非法破坏代码保护功能的行为。就我们所知,所有这些行为都不是以 Microchip 数据手册中规定的 操作规范来使用 Microchip 产品的。这样做的人极可能侵犯了知识产权。
• 通过两个引脚进行在线调试 (In-Circuit Debug, ICD)
• 宽工作电压范围:2.0V 至 5.5V • 故障保护时钟监视器 • 双速振荡器启动 • 纳瓦技术
注:
“PIC18F8722 Family Data Sheet” (DS39646B)对本文档进行了补充。 请参 见第 1.0 节 “器件概述”。
RB0/INT0 RB1/INT1 RB2/INT2 RB3/INT3 RB4/KBI0 RB5/KBI1/PGM RB6/KBI2/PGC VSS OSC2/CLKO/RA6 OSC1/CLKI/RA7 VDD RB7/KBI3/PGD RC5/SDO1 RC4/SDI1/SDA1 RC3/SCK1/SCL1 RC2/ECCP1/P1A