C8051Fxx单片机开发工具及调试技术
操作指南
U-EC5操作指南简介C8051F单片机的低价位开发套件是为您提供快速开发应用系统的工具。
该套件包含了开发所需的软件和硬件,性能优于传统的仿真器。
U-EC5具有:完全的USB2.0接口、免安装驱动程序、硬件加强型保护功能(减少使用不当造成的硬件损坏率)。
该工具可实现单步、连续单步、断点、停止/运行,支持寄存器/存储器的观察和修改,下载程序到Flash存储器等功能。
另一特点为可使用专用软件(U-EC5中文编程软件)快速将程序代码烧录到C8051F MCU中。
一、U-EC5调试适配器操作说明1. 说明: 1.1 U-EC5调试适配器适用于C8051FXXX系列的所有芯片。
1.2 软件运行环境:Microsoft Winodows 98/2000/NT/XP。
2. 硬件安装操作2.1 按图1进行硬件连接(PC机会自动识别,用户继续下一步操作)。
图13. 使用操作*若用户在IDE中使用U-EC5,则按以下步骤操作:3.1 打开集成开发环境“Silicon Laboratories IDE.exe”3.2 在菜单栏中点击“Options”选项,在其下拉子菜单中点击“Connection Options …”选项,出现如图2的对话框,进行如下设置:3.2.1 在“Serial Adapter”栏选择“USB Debug Adatper”。
3.2.2 在“Debug Interface”栏中选择调试接口类型。
●当MCU为:C8051F00X/01X/02X/04X/06X/12X/2XX系列时,选择JTAG;●当MCU为C8051F3XX系列时,选择C2。
图24、在菜单栏中点击“Debug”选项,在其下拉子菜单中点击“Connect”选项,进行连接。
成功则会激活“Debug”菜单下的其它操作,如图3。
图35、点击工程栏中的“New Project”选项,再点击鼠标右键,在出现的对话框中点击“Save ProjectNew_Project”选项,在出现的“Save Workspace”对话框中为要建的工程起个新名并保存起来,工程栏中会出现新的工程名,例新的工程名为Project1,如图4。
C8051F单片机常见问题及解决方案
C8051F单片机常见问题及解决方案1000字C8051F单片机常见问题及解决方案C8051F系列单片机是一款常用的32位微型控制器。
在使用中,常常会遇到各种问题,以下列出了一些常见问题及解决方案,供大家参考。
1.如何选择晶振?C8051F单片机的内部时钟频率有两种选择:内部振荡器(24MHz)和外部晶振(最高可达25MHz,具体要看选用的晶振规格)。
选择晶振时,可以考虑系统时钟的需求量,以及对系统稳定性的要求。
2.如何处理硬件复位?硬件复位是指在单片机系统上电时,自动执行初始化操作的过程。
C8051F单片机实现硬件复位的方法有两种:使用复位电路(RST#复位)、通过预编程的复位向量(从C2寄存器获取程序计数器初始值)。
通常情况下,我们可以使用预编程的复位向量,以方便地重新启动程序。
3.如何处理软件复位?软件复位是指通过程序代码实现的复位。
在C8051F单片机中,软件复位可以通过配置系统管理单元(SMU)来实现。
这个过程通常包括设置复位源、配置访问时间窗口、启用复位源、复位等操作。
在进行软件复位之前,我们需要仔细查看数据手册中的相关章节,并根据实际需求进行配置。
4.如何配置GPIO口?GPIO(通用输入输出)口是单片机系统中的基本输入输出接口,用于实现I/O操作和外设控制等功能。
在C8051F单片机中,GPIO口的配置可以通过专用寄存器(P0、P1、P2、P3等)来实现。
具体的配置包括:指定口线方向、设置上下拉电阻、确定端口中断引脚等。
5.如何编写中断服务程序?中断服务程序是用于响应中断请求、处理相应事件的程序代码实现。
在C8051F单片机中,编写中断服务程序包括两个步骤,一是将中断请求源打开(或禁止),二是编写相应的中断处理程序。
具体的实现方法会有一些细微的差别,需要仔细查看数据手册中的相关章节。
6.如何使用定时器?定时器是单片机中常用的计时器件,用于实现时间处理、调度和控制等功能。
在C8051F单片机中,使用定时器需要涉及一些内容,包括:设置定时器的工作模式、配置计数器时钟源和初始化计数器等。
C8051F310开发板调试
以31kou27g.c(附)为例,介绍一下有关c8051f310开发板的调试流程,软件配置等相关的一些经验。
(1)硬件电路连接好后,首先建立一个工程,取名31kou27g保存,然后添加该C文件到新建的工程中。
注意事项:当建立工程时,会出现一个选择芯片型号的窗口,这是要选择芯片类型为c8051f310:(2)进行调试前的相关配置:点击Target1右边第一个图标,出现下面的窗口第一项Device因为前面已经选好了,就不用再管了。
点击Output将打勾选中。
下面点击Debug:这里我们因为连接了硬件,所以选择,注意下拉列表中选择C8051Fxxx Driver。
并且在右边的Setting中选择(3)所有这些配置好以后,点OK,进行DEBUG调试,出现下面的界面,点击单步运行,或者按F10(F11),随着不断运行,可以看到两个小灯不断亮灭。
点击全速运行,然后可以看到小灯自己不断闪烁。
另外点解Load可以将Hex文件烧写进芯片,就不用其他烧写工具了,很方便。
如果直接下载,不经过DEBUG,还需要进行一些设置:选择最右边的这个选项,如下载设置附:keil4的安装破解(1)首先,下载keil4安装(2)打开出现如下界面需要填写CID号,打开keil4,选择License Management将CID号复制,粘贴到上面,点击generate,将产生的序列号复制到New License ID Code,点击Add LIC,设置好以后点击Close.这样就设置好了,可以放心使用。
另外还有很重要的一个步骤,就是安装调试器驱动驱动安装位置要选择在keil软件的安装位置下!正确安装软件及驱动后,就可找到的。
C8051F41x开发套件用户指南说明书
Rev. 0.3 2/14Copyright © 2014 by Silicon LaboratoriesC8051F41xX EVELOPMENT IT SER S UIDE1. Kit ContentsThe C8051F41x Development Kit contains the following items:•C8051F410 Target Board•C8051Fxxx Development Kit Quick-Start Guide •AC to DC Power Adapter•USB Debug Adapter (USB to Debug Interface)•USB Cable •CD-ROM2. Hardware Setup Using a USB Debug AdapterThe target board is connected to a PC running the Silicon Laboratories IDE via the USB Debug Adapter as shown in Figure 1.1.Connect the USB Debug Adapter to the DEBUG connector on the target board with the 10-pin ribbon cable.2.Connect one end of the USB cable to the USB connector on the USB Debug Adapter.3.Connect the other end of the USB cable to a USB Port on the PC.4.Connect the ac/dc power adapter to power jack P1 on the target board.Notes:•Use the Reset button in the IDE to reset the target when connected using a USB Debug Adapter.•Remove power from the target board and the USB Debug Adapter before connecting or disconnecting the ribbon cable from the target board. Connecting or disconnecting the cable when the devices have power can damage the device and/or the USB Debug Adapter.Figure 1.Hardware Setup Using a USB Debug AdapterPWRP1.6C8051F41x3. Software SetupSimplicity Studio greatly reduces development time and complexity with Silicon Labs EFM32 and 8051 MCU products by providing a high-powered IDE, tools for hardware configuration, and links to helpful resources, all in one place.Once Simplicity Studio is installed, the application itself can be used to install additional software and documentation components to aid in the development and evaluation process.Figure2.Simplicity StudioThe following Simplicity Studio components are required for the C8051F410 Development Kit:⏹ 8051 Products Part Support ⏹ Simplicity Developer PlatformDownload and install Simplicity Studio from /8bit-software or /simplicity-studio .Once installed, run Simplicity Studio by selecting Start →Silicon Labs →Simplicity Studio →Simplicity Studio from the start menu or clicking the Simplicity Studio shortcut on the desktop. Follow the instructions to install the software and click Simplicity IDE to launch the IDE.The first time the project creation wizard runs, the Setup Environment wizard will guide the user through the process of configuring the build tools and SDK selection.In the Part Selection step of the wizard, select from the list of installed parts only the parts to use during development. Choosing parts and families in this step affects the displayed or filtered parts in the later device selection menus. Choose the C8051F41x family by checking the C8051F41x check box. Modify the part selection at any time by accessing the Part Management dialog from the Window →Preferences →Simplicity Studio →Part Management menu item.Simplicity Studio can detect if certain toolchains are not activated. If the Licensing Helper is displayed after completing the Setup Environment wizard, follow the instructions to activate the toolchain.C8051F41x3.1. Running BlinkyEach project has its own source files, target configuration, SDK configuration, and build configurations such as the Debug and Release build configurations. The IDE can be used to manage multiple projects in a collection called a workspace. Workspace settings are applied globally to all projects within the workspace. This can include settings such as key bindings, window preferences, and code style and formatting options. Project actions, such as build and debug are context sensitive. For example, the user must select a project in the Project Explorer view in order to build that project.To create a project based on the Blinky example:1. Click the Simplicity IDE tile from the Simplicity Studio home screen.2. Click the Create new project link from the welcome screen or go to File →New →Silicon Labs MCU Project .3. In the Kit drop-down, select C8051F410 Development Kit , in the Part drop-down, select C8051F410, and in the SDK drop-down, select the desired SDK. Click Next .4. Select Example and click Next .5. Under C8051F410 Development Kit in the Blinky folder, select F41x Blinky and click Finish .6. Click on the project in the Project Explorer and click Build , the hammer icon in the top bar. Alternatively, go to Project →Build Project .7. Click Debug to download the project to the hardware and start a debug session.8. Press the Resumebutton to start the code running. The LED should blink.9. Press the Suspend button to stop the code.10. Press the Reset the devicebutton to reset the target MCU.11. Press the Disconnectbutton to return to the development perspective.3.2. Simplicity Studio HelpSimplicity Studio includes detailed help information and device documentation within the tool. The help containsdescriptions for each dialog window. To view the documentation for a dialog, click the question mark icon in the window:This will open a pane specific to the dialog with additional details.The documentation within the tool can also be viewed by going to Help →Help Contents or Help →Search .C8051F41x3.3. Legacy 8-bit IDENote:Using the Simplicity Studio tools with the C8051F410 Development Kit is recommended. See section 3. "SoftwareSetup‚" on page 2 for more information.Download the 8-bit software from the website (/8bit-software ) or use the provided installer on the CD-ROM to install the software tools for the C8051F41x devices. After installation, examples can be found in ...\Examples\C8051F41x in the installation directory. At a minimum, the C8051F410 DK requires:⏹ Silicon Labs IDE —Software enabling initial evaluation, development, and debugging.⏹ Configuration Wizard 2—Initialization code generation software for the C8051F41x devices.⏹ Keil C51 Tools —Keil 8051 Compiler/Assembler/Linker toolchain.Other software available includes:⏹ Keil µVision Driver —Driver for the Keil µVision IDE that enables development and debugging onC8051Fxxx MCUs.⏹ Flash Programming Utilities and MCU Production Programmer —Programming utilities for the production line. More information on the available programming options can be found on the website:/products/mcu/Pages/ProgrammingOptions.aspx .⏹ ToolStick Development Tools —Software and examples for the ToolStick development platform. More information on this platform can be found at /toolstick .The development kit includes the latest version of the C51 Keil 8051 toolset. This toolset is initially limited to a code size of 2kB and programs start at code address 0x0800. After registration, the code size limit is removed entirely and programs will start at code address 0x0000.To register the Keil toolset:1. Find the Product Serial Number printed on the CD-ROM. If you no longer have this serial number, register on the Silicon Labs website (/8bit-software ) to obtain the serial number.2. Open the Keil µVision4 IDE from the installation directory with administrative privileges.3. Select FileLicense Management to open the License Management window.Figure 3.Keil µVision4 IDE License Management Window4. Click on the Get LIC via Internet... button to open the Obtaining a License IDE Code (LIC) window.5. Press OK to open a browser window to the Keil website. If the window doesn’t open, navigate to /license/install.htm .6. Enter the Silicon Labs Product Serial Number printed on the CD-ROM, along with any additional requiredC8051F41xinformation.7. Once the form is complete, click the Submit button. An email will be sent to the provided email addresswith the license activation code.8. Copy the License ID Code (LIC) from the email.9. Paste the LIC into the New License ID Code (LIC) text box at the bottom of the License Managementwindow in µVision4.10. Press the Add LIC button. The window should now list the PK51 Prof. Developers Kit for Silabs as alicensed product.11. Click the Close button.C8051F41x4. Target BoardThe C8051F41x Development Kit includes a target board with a C8051F410 device pre-installed for evaluation and preliminary software development. Numerous input/output (I/O) connections are provided to facilitate prototyping using the target board. Refer to Figure4 for the locations of the various I/O connectors.P1Power connector (accepts input from 7 to 15 VDC unregulated power adapter)J1 22-pin Expansion I/O connectorJ3 Port I/O Configuration Jumper BlockJ4 DEBUG connector for Debug Adapter interfaceJ5 DB-9 connector for UART0 RS232 interfaceJ6 Analog I/O terminal blockJ7 Connector for IDAC0 voltage circuitJ8 USB Debug Adapter target board power connectorJ9, J10 External crystal enable connectorsJ11 Connector for IDAC1 voltage circuitJ12 Connector block for Thermistor circuitryJ13, J14ADC external voltage reference connectorsFigure4.C8051F410 Target BoardC8051F41x4.1. System Clock SourcesThe C8051F410 device installed on the target board features a calibrated programmable internal oscillator which is enabled as the system clock source on reset. After reset, the internal oscillator operates at a frequency of 191.4kHz (±2%) by default but may be configured by software to operate at other frequencies. Therefore, in many applications an external oscillator is not required. However, if you wish to operate the C8051F410 device at a frequency not available with the internal oscillator, an external crystal may be used. Refer to the C8051F41x data sheet for more information on configuring the system clock source.The target board is designed to facilitate the installation of an external crystal. Remove shorting blocks at headers J9 and J18 and install the crystal at the pads marked Y2. Install a 10M resistor at R4 and install capacitors at C44 and C43 using values appropriate for the crystal you select. Refer to the C8051F41x data sheet for more information on the use of external oscillators. The target board also has a 32.768kHz watch crystal installed to provide a timebase for the smaRTClock. Jumper J26 may be used to short the XTAL3 and XTAL4 pins if internal clock mode is desired.4.2. Power OptionsThe C8051F41x Target Board has many power options. This allows the user to exercise the different operating modes of the C8051F410. The board has 2 voltage regulators. A 3.3V LDO and a 1.2–5.25V variable regulator. To use the 3.3V regulator, pin 2–3 of J9 should be shorted and a jumper installed in J10.To use the variable regulator, pin 1–2 of J19 should be shorted and an output voltage should be selected using J21. After selecting the appropriate voltage, pin 1–2 of J21 should be shorted to enable the output of the variable regulator. If the voltage "VAR" is selected, the potentiometer R23 should be adjusted until the desired voltage is reached. The input to the variable regulator can be obtained from the unregulated 9V supply or from the 5V USB VBUS supply available when using a USB debug adapter.Note: Before enabling either voltage regulator, the user should check the 4 supply rail selection headers (J29+J30, J17, J12, J31+32) to ensure the correct voltage is being routed to the correct power pin. An incorrect jumper setting may permanently damage the board. Note that VDD cannot exceed 2.5V and is typically derived from the on-chip regulator. Do not connect the 5.25 or 3.3V output directly to VDD.The three power LEDs for VIO, VREG, and VDD indicate if the appropriate supply rail is connected to a power supply. Check to make sure all supply rails (with exception of VREG if not using the on-chip regulator) are powered.For the VIO voltage rail, the user may choose from the 3V regulator (+3VD), the variable regulator, or the on-chip regulator. The selections are marked on the target board silkscreen.For the VREG on-chip voltage regulator input, the user may choose from the 3V regulator (+3VD), the 5V USB VBUS source obtained from the USB debug adapter (5VEC3), or from the variable regulator (VREG). The selections are marked on the target board silkscreen.For VDD, the user may choose the output of the on-chip regulator (VDD_) or the output of the variable regulator (VREG).4.3. Switches and LEDsThree switches are provided on the target board. Switch SW1 is connected to the RESET pin of the C8051F410. Pressing SW1 puts the device into its hardware-reset state. Switch SW2 and SW3 are connected to the C8051F410’s general purpose I/O (GPIO) pins through headers. Pressing SW2 or SW3 generates a logic low signal on the port pin. Remove the shorting block from the jumper J5 to disconnect SW2 and/or SW3 from their associated port pins. The port pin signals are also routed to pins on the J11 I/O connector. See Table1 for the port pins and headers corresponding to each switch.Three LEDs are also provided on the target board. The red LED labeled PWR is used to indicate a power connection to the target board. The green LEDs labeled with port pin names are connected to the C8051F410’s GPIO pins through headers. Remove the shorting blocks from the headers to disconnect the LEDs from the port pins. The port pin signals are also routed to pins on the J1 I/O connector. See Table1 for the port pins and headers corresponding to each LED.C8051F41xTable 1. Target Board I/O DescriptionsDescription I/O JumperSW1Reset noneSW2P1.4J5[3–4]SW3P1.5J5[7–8]Green LED D3P2.1J5[1–2]Green LED D5P2.3J5[5–6]Red LED D1VREGIN J24Red LED D2VDD J23Red LED D12VIO J334.4. Expansion I/O Connector (J1)The 24-pin Expansion I/O connector J11 provides access to all signal pins of the C8051F410 device. A small through-hole prototyping area is also provided. All I/O signals routed to connector J1 are also routed to through-hole connection points between J11 and the prototyping area (see Figure4 on page6). Each connection point is labeled indicating the signal available at the connection point. See Table2 for a list of pin descriptions for J1.Table 2. J1 Pin DescriptionsPin #Description Pin #Description1P0.013P1.42P0.114P1.53P0.215P1.64P0.316P1.75P0.417P2.06P0.518P2.17P0.619P2.28P0.720P2.39P1.021P2.410P1.122P2.511P1.223P2.612P1.324P2.7C8051F41x4.5. Target Board DEBUG Interface (J4)The DEBUG connector (J4) provides access to the DEBUG (C2) pins of the C8051F410. It is used to connect the Serial Adapter or the USB Debug Adapter to the target board for in-circuit debugging and Flash programming. Table3 shows the DEBUG pin definitions.Table 3. DEBUG Connector Pin DescriptionsPin #Description1+3VD(+3.3VDC)2, 3, 9GND (Ground)4C2D5/RST(Reset)6P3.07C2CK8Not Connected10USB Power4.6. Serial Interface (J5)A RS232 transceiver circuit and DB-9 (J5) connector are provided on the target board to facilitate serial connections to UART0 of the C8051F410. The TX, RX, RTS and CTS signals of UART0 may be connected to the DB-9 connector and transceiver by installing shorting blocks on header J3.J27[1–2]- Install shorting block to connect UART0 TX (P0.4) to transceiver.J27[3–4]- Install shorting block to connect UART0 RX (P0.5) to transceiver.J27[5–6]- Install shorting block to connect UART0 RTS (P1.4) to transceiver.J27[7–8]- Install shorting block to connect UART0 CTS (P1.5) to transceiver.4.7. Analog I/O (J6)Many of the C8051F410 target device’s port pins are connected to the J2 terminal block. Connections for VDDA, AGND, ADC external voltage references, IDAC outputs and ADC inputs are available. Refer to Table4 for the J6 terminal block connections.Table 4. J6 Terminal Block Pin DescriptionsPin #Description1P0.0/IDAC02P0.1/IDAC13VREFIN4GND5AIN06AIN1C8051F41x4.8. IDAC Connectors (J7, J11)The C8051F410 target board also features two Current-to-Voltage 750 load resistors that may be connected to the 2-bit current-mode Digital-to-Analog Converters (IDACs) on port pins P1.0 and P1.1. Install a shorting block on J13 to connect the IDAC0/P1.0 pin of the target device to a load resistor. Install a second shorting block on J14 to connect the IDAC1/P1.1 pin of the target device to a load resistor. The IDAC signals are then routed to the J1 and J13 and J14 connectors.4.9. USB Debug Adapter Target Board Power Connector (J8)The USB Debug Adapter includes a connection to provide power to the target board. This connection is routed from J4[10] to J8[1]. Place a shorting block at header J8[2–3] to power the board directly from an ac/dc power adapter. Place a shorting block at header J8[1-2] to power the board from the USB Debug Adapter. The second option is not supported with either the EC1 or EC2 Serial Adapters.4.10. smaRTClock (Real Time Clock)The C8051F41x Target Board is designed for developing system using the on-chip smaRTClock. A 32kHz watch crystal is installed in Y1 and a battery holder (BH1) is installed for use as a backup power source. To connect the battery to the VBAT input on the MCU, connect pin 1 and 2 of J30 and short J29. The variable voltage regulator with potentiometer (R23) may also be used to generate the battery voltage and simulate a battery in its various charge conditions. See the C8051F41x data sheet for more details about the smaRTClock.C8051F41x 5. SchematicsC8051F41xF i g u r e 6.C 8051F 410 T a r g e t B o a r d S c h e m a t i c (P a g e 2 o f 3)C8051F41xF i g u r e 7.C 8051F 410 T a r g e t B o a r d S c h e m a t i c (P a g e 3 o f 3)C8051F41xD OCUMENT C HANGE L ISTRevision 0.2 to Revision 0.3⏹ Removed Section 9. USB Debug Adapter. See USB Debug Adapter User's Guide. Revision 0.3 to Revision 0.4⏹ Updated 3. "Software Setup‚" on page 2.DisclaimerSilicon Laboratories intends to provide customers with the latest, accurate, and in-depth documentation of all peripherals and modules available for system and software implementers using or intending to use the Silicon Laboratories products. Characterization data, available modules and peripherals, memory sizes and memory addresses refer to each specific device, and "Typical" parameters provided can and do vary in different applications. Application examples described herein are for illustrative purposes only. Silicon Laboratories reserves the right to make changes without further notice and limitation to product information, specifications, and descriptions herein, and does not give warranties as to the accuracy or completeness of the included information. Silicon Laboratories shall have no liability for the consequences of use of the information supplied herein. This document does not imply or express copyright licenses granted hereunder to design or fabricate any integrated circuits. The products must not be used within any Life Support System without the specific written consent of Silicon Laboratories. A "Life Support System" is any product or system intended to support or sustain life and/or health, which, if it fails, can be reasonably expected to result in significant personal injury or death. Silicon Laboratories products are generally not intended for military applications. Silicon Laboratories products shall under no circumstances be used in weapons of mass destruction including (but not limited to) nuclear, biological or chemical weapons, or missiles capable of delivering such weapons.Trademark InformationSilicon Laboratories Inc., Silicon Laboratories, Silicon Labs, SiLabs and the Silicon Labs logo, CMEMS®, EFM, EFM32, EFR, Energy Micro, Energy Micro logo and combinations thereof, "the world’s most energy friendly microcontrollers", Ember®, EZLink®, EZMac®, EZRadio®, EZRadioPRO®, DSPLL®, ISOmodem ®, Precision32®, ProSLIC®, SiPHY®, USBXpress® and others are trademarks or registered trademarks of Silicon Laboratories Inc. ARM, CORTEX, Cortex-M3 and THUMB are trademarks or registered trademarks of ARM Holdings. Keil is a registered trademark of ARM Limited. All other products or brand names mentioned herein are trademarks of their respective holders.Silicon Laboratories Inc.400 West Cesar Chavez Austin, TX 78701USAIoT Portfolio /IoTSW/HW/simplicityQuality/qualitySupport and Community。
一C8051F开发环境之Keil
一.C8051F开发环境之K eil C51
C8051F单片机开发环境主要的有两个,第一个为著名的Keil C51,第二个为Silabs IDE.
我们从Keil C51 开始。
下图是开发环境界面。
开发环境都比较容易使用。
使用Keil C51的话,则需要安装C8051F系列单片机的调试驱动程序。
这个程序可以在Silabs的官方网上下载。
SiC8051F_uVision_v3.21.zip或者更新的版本。
在安装这个程序前需要先安装Keil C51. 然后把上述文件安装到Keil C51所在的目录。
安装完毕后,任意打开C51的一个工程(如开发板工程Source Code\LED_Flow\project),先进行一系列的设置。
如下所示:
第一步:在Project 菜单下面选择Option for Target “xxxxxx”
第二步:点击后打开选项对话框,在Debug选项卡上,选择如下图所示。
第三步:选择FLASH烧写工具,在同一个对话框中选择Utilities
最好选择OK确认,Keil C51 调试和烧写环境就配置好了。
我们以开发板的Source Code\LED_Flow\project为例,打开后
第一步:按Rebuild all target files重新编译整个工程。
第二步:用C2调试器连接开发板,上电,点击Keil C51的Start/Stop Debug Session.
如果没有问题的话,将弹出烧写FLASH的窗口:
第三步:烧写完毕后,单片机将停在main函数的入口处等待调试命令:
接下来就可以进行单步和其他各种调试了。
C8051F00x 01x开发套件用户指南说明书
Rev. 0.6 9/06Copyright © 2006 by Silicon LaboratoriesC8051F00x/01x-DKX X E VE LO P M E N T I T S E R S UI D E1. Kit ContentsThe C8051F00x/01x Development Kit contains the following items:•C8051F005 Target Board•C8051Fxxx Development Kit Quick-Start Guide•Silicon Laboratories IDE and Product Information CD-ROM. CD content includes:•Silicon Laboratories Integrated Development Environment (IDE)•Keil Software 8051 Development Tools (macro assembler, linker, evaluation ‘C’ compiler)•Source code examples and register definition files •Documentation•C8051F00x/01x Development Kit User’s Guide (this document)•AC to DC Power Adapter•USB Debug Adapter (USB to Debug Interface)•USB Cable2. Hardware Setup using a USB Debug AdapterThe target board is connected to a PC running the Silicon Laboratories IDE via the USB Debug Adapter as shown in Figure 1.1.Connect the USB Debug Adapter to the JTAG connector on the target board with the 10-pin ribbon cable.2.Connect one end of the USB cable to the USB connector on the USB Debug Adapter.3.Connect the other end of the USB cable to a USB Port on the PC.4.Connect the ac/dc power adapter to power jack P1 on the target board.Notes:•Use the Reset button in the IDE to reset the target when connected using a USB Debug Adapter.•Remove power from the target board and the USB Debug Adapter before connecting or disconnecting the ribbon cable from the target board. Connecting or disconnecting the cable when the devices have power can damage the device and/or the USB Debug Adapter.Figure 1. Hardware Setup using a USB Debug AdapterPWRP1.6No tR nd edf or N e wDe si g n sC8051F00x/01x-DK3. Software SetupThe included CD-ROM contains the Silicon Laboratories Integrated Development Environment (IDE), Keil software 8051 tools and additional documentation. Insert the CD-ROM into your PC’s CD-ROM drive. An installer will auto-matically launch, allowing you to install the IDE software or read documentation by clicking buttons on the Installa-tion Panel. If the installer does not automatically start when you insert the CD-ROM, run autorun.exe found in the root directory of the CD-ROM. Refer to the readme.txt file on the CD-ROM for the latest information regarding known IDE problems and restrictions.4. Silicon Laboratories Integrated Development EnvironmentThe Silicon Laboratories IDE integrates a source-code editor, source-level debugger and in-system Flash program-mer. The use of third-party compilers and assemblers is also supported. This development kit includes the Keil Software A51 macro assembler, BL51 linker and evaluation version C51 ‘C’ compiler. These tools can be used from within the Silicon Laboratories IDE.4.1. System RequirementsThe Silicon Laboratories IDE requirements:•Pentium-class host PC running Microsoft Windows 98SE or later.•One available COM or USB port.•64 MB RAM and 40MB free HD space recommended.4.2. Assembler and LinkerA full-version Keil A51 macro assembler and BL51 banking linker are included with the development kit and are installed during IDE installation. The complete assembler and linker reference manual can be found under the Help menu in the IDE or in the “SiLabs\MCU\hlp ” directory (A51.pdf).4.3. Evaluation C51 ‘C’ CompilerAn evaluation version of the Keil C51 ‘C’ compiler is included with the development kit and is installed during IDE installation. The evaluation version of the C51 compiler is the same as the full professional version except code size is limited to 4kB and the floating point library is not included. The C51 compiler reference manual can be found under the Help menu in the IDE or in the “SiLabs\MCU\hlp ” directory (C51.pdf).4.4. Using the Keil Software 8051 Tools with the Silicon Laboratories IDETo perform source-level debugging with the IDE, you must configure the Keil 8051 tools to generate an absolute object file in the OMF-51 format with object extensions and debug records enabled. You may build the OMF-51absolute object file by calling the Keil 8051 tools at the command line (e.g. batch file or make file) or by using the project manager built into the IDE. The default configuration when using the Silicon Laboratories IDE project manager enables object extension and debug record generation. Refer to Applications Note AN104 - Integrating Keil 8051 Tools Into the Silicon Labs IDE in the “SiLabs\MCU\Documentation\Appnotes ” directory on the CD-ROM for additional information on using the Keil 8051 tools with the Silicon Laboratories IDE.To build an absolute object file using the Silicon Laboratories IDE project manager, you must first create a project. A project consists of a set of files, IDE configuration, debug views, and a target build configuration (list of files and tool configurations used as input to the assembler, compiler, and linker when building an output object file).The following sections illustrate the steps necessary to manually create a project with one or more source files, build a program and download the program to the target in preparation for debugging. (The IDE will automatically create a single-file project using the currently open and active source file if you select Build/Make Project before a project is defined.)No tR e co mme nd edf or N e wDe si g n sC8051F00x/01x-DK4.4.1. Creating a New Project1.Select Project →New Project to open a new project and reset all configuration settings to default.2.Select File →New File to open an editor window. Create your source file(s) and save the file(s) with a rec-ognized extension, such as .c, .h, or .asm, to enable color syntax highlighting.3.Right-click on “New Project” in the Project Window . Select Add files to project . Select files in the filebrowser and click Open. Continue adding files until all project files have been added.4.For each of the files in the Project Window that you want assembled, compiled and linked into the targetbuild, right-click on the file name and select Add file to build . Each file will be assembled or compiled as appropriate (based on file extension) and linked into the build of the absolute object file.Note: If a project contains a large number of files, the “Group” feature of the IDE can be used to organize. Right-click on “New Project” in the Project Window . Select Add Groups to project . Add pre-definedgroups or add customized groups. Right-click on the group name and choose Add file to group . Select files to be added. Continue adding files until all project files have been added.4.4.2. Building and Downloading the Program for Debugging1.Once all source files have been added to the target build, build the project by clicking on the Build/MakeProject button in the toolbar or selecting Project →Build/Make Project from the menu.Note: After the project has been built the first time, the Build/Make Project command will only build the files that have been changed since the previous build. To rebuild all files and project dependencies, click on the Rebuild All button in the toolbar or select Project →Rebuild All from the menu.2.Before connecting to the target device, several connection options may need to be set. Open theConnection Options window by selecting Options →Connection Options... in the IDE menu. First, select the appropriate adapter in the “Serial Adapter” section. Next, the correct “Debug Interface” must be selected.C8051F00x/01x family devices use the JTAG debug interface. Once all the selections are made, click the OK button to close the window. 3.Click the Connect button in the toolbar or select Debug →Connect from the menu to connect to the device.4.Download the project to the target by clicking the Download Code button in the toolbar.Note: To enable automatic downloading if the program build is successful select Enable automatic con-nect/download after build in the Project →Target Build Configuration dialog. If errors occur during the build process, the IDE will not attempt the download.5.Save the project when finished with the debug session to preserve the current target build configuration,editor settings and the location of all open debug views. To save the project, select Project->Save Project As... from the menu. Create a new name for the project and click on Save .No tR e co mme nd edf or N e wDe si g n sC8051F00x/01x-DK5. Example Source CodeExample source code and register definition files are provided in the “SiLabs\MCU\Examples\C8051F0xx ” directory during IDE installation. These files may be used as a template for code development. Example applications include a blinking LED example which configures the green LED on the target board to blink at a fixed rate.5.1. Register Definition FilesRegister definition files C8051F000.inc and C8051F000.h define all SFR registers and bit-addressable control/status bits for the C8051F00x/01x device family. They are installed into the “SiLabs\MCU\Examples\C8051F0xx ” directory during IDE installation. The register and bit names are identical to those used in the C8051F00x/01x data sheet. Both register definition files are also installed in the default search path used by the Keil Software 8051 tools. Therefore, when using the Keil 8051 tools included with the development kit (A51, C51), it is not necessary to copy a register definition file to each project’s file directory.5.2. Blinking LED ExampleThe example source files blink.asm and blinky.c show examples of several basic C8051F00x/01x functions. These include; disabling the watchdog timer (WDT), configuring the Port I/O crossbar, configuring a timer for an interrupt routine, initializing the system clock, and configuring a GPIO port. When compiled/assembled and linked this pro-gram flashes the green LED on the target board about five times a second using the interrupt handler with a timer.No tR e co mme nd edf or N e wDe si g n sC8051F00x/01x-DK6. Target BoardThe C8051F00x/01x Development Kit includes a target board with a C8051F005 device pre-installed for evaluation and preliminary software development. Numerous input/output (I/O) connections are provided to facilitate prototyp-ing using the target board. Refer to Figure 2 for the locations of the various I/O connectors.P1Power connector (accepts input from 7 to 15 VDC unregulated power adapter)J1Connects SW2 to port pin P1.7J264-pin I/O connector providing access to all I/O signals J3Connects LED D3 to port pin P1.6J4JTAG connector for Debug Adapter interface J6Analog I/O configuration connector X1Analog I/O terminal blockFigure 2. C8051F005 Target BoardNo tR e si g n sC8051F00x/01x-DK6.1. System Clock SourcesThe C8051F005 device installed on the target board features a internal oscillator which is enabled as the system clock source on reset. After reset, the internal oscillator operates at a frequency of 2MHz (±2%) by default but may be configured by software to operate at other frequencies. Therefore, in many applications an external oscillator is not required. However, an external crystal may be installed on the target board for additional applications. The tar-get board is designed to facilitate the installation of an external crystal at the pads marked Q1. Refer to the C8051F005 datasheet for more information on configuring the system clock source. Following are a few part num-bers of suitable crystals:Freq (MHz)Digikey P/N ECS P/N18.432X146-ND ECS-184-20-1 (20pF loading capacitance)11.0592X089-ND ECS-110.5-20-1(20pF loading capacitance)6.2. Switches and LEDsTwo switches are provided on the target board. Switch SW1 is connected to the RESET pin of the C8051F005device on the target board. Pressing SW1 puts the device into its hardware-reset state. The device will leave the reset state after SW1 is released. Switch SW2 is connected to the device’s general purpose I/O (GPIO) pin through headers. Pressing SW2 generates a logic low signal on the port pin. Remove the shorting block from the header to disconnect SW2 from the port pins. The port pin signal is also routed to a pin on the J2 I/O connector. See Table 1 for the port pins and headers corresponding to each switch.Two LEDs are also provided on the target board. The red LED labeled PWR is used to indicate a power connection to the target board. The green LED labeled with a port pin name is connected to the device’s GPIO pin through a header. Remove the shorting block from the header to disconnect the LED from the port pin. The port pin signal is also routed to a pin on the J2 I/O connector. See Table 1 for the port pins and headers corresponding to each LED.6.3. Target Board JTAG Interface (J4)The JTAG connector (J4) provides access to the JTAG pins of the C8051F005. It is used to connect the Serial Adapter or the USB Debug Adapter to the target board for in-circuit debugging and Flash programming. Table 2 shows the JTAG pin definitions.Table 1. Target Board I/O DescriptionsDescriptionI/OHeaderSW1Reset none SW2P3.7J1Green LED P1.6J3Red LEDPWRnoneTable 2. JTAG Connector Pin DescriptionsPin #Description1+3VD (+3.3VDC)2, 3, 9GND (Ground)4TCK 5TMS 6TDO 7TDI8, 10Not ConnectedNo tR e co mme nd edf or N e wDe si gn sC8051F00x/01x-DK6.4. Analog I/O (J6, Terminal Block)An Analog I/O Configuration connector (J6) provides the ability to route analog I/O signals from the C8051F005device to a terminal block by installing two shorting blocks on J6. It also allows the DAC outputs to be connected to Comparator 0 inputs or to two ADC inputs. Analog signals may be routed to the AIO 0 and AI01 posts of the termi-nal block by installing a shorting block between two adjacent pins on J6. Refer to Figure 3 to determine the shorting block installation positions required to connect the desired analog signal to the terminal block. Refer to Table 3 for terminal block connections and Table 4 for J6 pin definitions.Figure 3. J6 Analog I/O Configuration ConnectorTable 3. Terminal Block Pin DescriptionsPin #Description1AIO12AIO07AGND (Analog Ground)8VREFTable 4. J6 Connector Pin DescriptionsPin #Description1CP0+2CP0-3, 9, 15AIO14, 10, 16AIO05DAC06DAC17AIN08AIN111AIN212AIN313AIN414AIN517AIN618AIN7No tR e co mme nd edf or N De si g n sC8051F00x/01x-DK6.5. Expansion I/O Connector (J2)The 64-pin expansion I/O connector J1 provides access to most signal pins of the C8051F005 device on the target board. A small through-hole prototyping area is also provided. All I/O signals routed to connector J2 are also routed to through-hole connection points between J2 and the prototyping area (see Figure 4 on page 9). The signal layout pat-tern of these connection points is identical to the adjacent J2 connector pins . See Table 5 for a list of pin descrip-tions for J2.Table 5: J2 Pin DescriptionsPin DescriptionPin Description 1+VD (digital voltage supply)28P3.72XTAL129P3.43P1.630P3.54P1.731P3.25P1.432P3.36P1.533P3.07P1.234P3.18P1.336/RST9P1.039,41,42GND (digital ground)10P1.145,47,63GNDA (analog ground)11P0.646,64+VA (analog voltage supply)12P0.748DAC013P0.449CP1-14P0.550DAC115P0.251CP1+16P0.352CP0-17P0.053VREF 18P0.154CP0+19P2.655AIN020P2.756AIN121P2.457AIN222P2.558AIN323P2.259AIN424P2.360AIN525P2.061AIN626P2.162AIN727P3.6No tR e co mme nd edf or N e wDe si g n sC8051F00x/01x-DKC8051F00x/01x-DKD OCUMENT C HANGE L ISTRevision 0.4 to Revision 0.5⏹Section 1, added USB Debug Adapter and USB Cable.⏹Section 2, changed name from "Hardware Setup" to "Hardware Setup using an EC2 Serial Adapter".⏹Section 2, added 2 Notes bullets.⏹Section 2, removed Note from bottom of page.⏹Added Section 3, "Hardware Setup using a USB Debug Adapter".⏹Section 5.4.2, changed step 2 to include new instructions.⏹Section 7, J4, changed "Serial Adapter" to "Debug Adapter".⏹Target Board DEBUG Interface Section, added USB Debug Adapter.⏹DEBUG Connector Pin Descriptions Table, changed pin 4 to C2D.⏹Changed "jumper" to "header".⏹EC2 Serial Adapter section, added EC2 to the section title, table title and figure title.⏹EC2 Serial Adapter section, changed "JTAG" to "DEBUG".⏹Added "USB Debug Adapter" section.Revision 0.5 to Revision 0.6⏹Removed EC2 Serial Adapter from Kit Contents.⏹Removed Section 2. Hardware Setup using an EC2 Serial Adapter. See RS232 Serial Adapter (EC2) User's Guide.⏹Removed Section 8. EC2 Serial Adapter. See RS232 Serial Adapter (EC2) User's Guide.⏹Removed Section 9. USB Debug Adapter. See USB Debug Adapter User's Guide.No tR e co mme nd edf or N e wDe si g n sDisclaimer Silicon Laboratories intends to provide customers with the latest, accurate, and in-depth documentation of all peripherals and modules available for system and software implementers using or intending to use the Silicon Laboratories products. Characterization data, available modules and peripherals, memory sizes and memory addresses refer to each specific device, and "Typical" parameters provided can and do vary in different applications. Application examples described herein are for illustrative purposes only. Silicon Laboratories reserves the right to make changes without further notice and limitation to product information, specifications, and descriptions herein, and does not give warranties as to the accuracy or completeness of the included information. Silicon Laboratories shall have no liability for the consequences of use of the information supplied herein. This document does not imply or express copyright licenses granted hereunder to design or fabricate any integrated circuits. The products must not be used within any Life Support System without the specific written consent of Silicon Laboratories. A "Life Support System" is any product or system intended to support or sustain life and/or health, which, if it fails, can be reasonably expected to result in significant personal injury or death. Silicon Laboratories products are generally not intended for military applications. Silicon Laboratories products shall under no circumstances be used in weapons of mass destruction including (but not limited to) nuclear, biological or chemical weapons, or missiles capable of delivering such weapons.Trademark InformationSilicon Laboratories Inc., Silicon Laboratories, Silicon Labs, SiLabs and the Silicon Labs logo, CMEMS®, EFM, EFM32, EFR, Energy Micro, Energy Micro logo and combinations thereof, "the world’s most energy friendly microcontrollers", Ember®, EZLink®, EZMac®, EZRadio®, EZRadioPRO®, DSPLL®, ISOmodem ®, Precision32®, ProSLIC®, SiPHY®, USBXpress® and others are trademarks or registered trademarks of Silicon Laboratories Inc. ARM, CORTEX, Cortex-M3 and THUMB are trademarks or registered trademarks of ARM Holdings. Keil is a registered trademark of ARM Limited. All other products or brand names mentioned herein are trademarks of their respective holders. Silicon Laboratories Inc.400 West Cesar ChavezAustin, TX 78701USAIoT Portfolio /IoT SW/HW /simplicity Quality /quality Support and Community N o t R e co m m e nd e d f o r N e w D e s i g n s。
品诺电子C8051F仿真器产品说明书
品诺电子C8051F仿真器产品说明书目录目录 (2)一、产品概述 (3)1.1 C8051F调试工具简介 (3)1.2 产品性能 (4)1.3 仿真器接口定义 (4)二、在KEIL下使用USB Debug Adapter (5)三、使用批量下载工具 (7)3.1 U-EC5中文下载程序 (7)3.2 Silicon Laboratories Flash Utility (8)3.3 Silicon Labs MCU Production Programmer (9)四、EC6固件更新 (10)一、产品概述1.1 C8051F调试工具简介C8051F系列单片机是Silabs公司推出的一系列增强型51单片机,其指令集兼容传统MCS-51。
内核采用增强型CIP-51,其最大指令速率达到100MIPS,丰富的外设以及灵活的交叉开关,形成一个SOC,为目前绝大多数8位单片机所不能比拟。
C8051F单片机目前正在高速增长,由于具有兼容传统51的先天优势,已经被越来越多的爱好者和设计者所青睐,C8051F单片机已经进入大学课堂,成为大学单片机教材。
C8051F单片机开发工具经过多个版本发展,经历了并口、串口、USB-串、USB。
目前,以及发展到真正的USB通信,不再使用串并口或者虚拟串口。
C8051F开发工具还包括U-PDC等,但是使用最方便、最普遍的仍然是U-EC6。
品诺电子U-EC6仿真器采用国外原装电路改进而来,可实现支持单步、连续单步、断点、观察点、堆栈监视器, 可以观察/修改存储器和寄存器, 下载程序到Flash存储器等功能,兼容国内任何一家的C8051F调试工具。
多次得到高校的批量订单,使用效果反馈良好。
请定期去官方网站件,以达到更好的使用效果。
也可以在国内代理商下载。
1.2 产品性能 - 可与Keil 、silabs 官方推出的各种软件,如Silicon Laboratories IDE ,FLASH UtilityProgrammer ,Product Programmer ,新华龙U-EC5中文下载程序软件等软件实现无缝连接调试。
C8051Fxxx软件配置说明
C8051Fxxx配置调试本文主要介绍在怎样在Keil μVision2环境下对C8051Fxxx进行调试。
结合一个工程介绍安装配置,以及说明怎么使用Keil μVision2进行调试。
一、安装配置用户在使用Keil μVision2 对C8051Fxxx单片机进行编程时,需要进行一定的安装配置,因为Keil μVision2本身没有这样的调试驱动。
首先安装Keil μVision2下的C8051F的驱动SiC8051F_uv2.exe(可以在压缩包里SiC8051F_uv2(2).zip压缩吧包里面找到)。
然后对Keil μVision2进行软件配置:1、新建一个工程,选择Silicon Laboratories下面的C8051F021为CPU,如下图(如果是加载好的工程同样可以更改CPU和下面的设置):2、单击Project\Options for Target ‘Target 1’选项,在出来的对话框中选择Target 选项,设置对应板卡上的晶振,这里是22.1184Mhz,如图如果需要下载Hex文件,则在Output选项中在Creat Hex File前面打对勾,否则去掉。
点击Debug选项,选择应用use Silicon Labs C8051Fxxx Drivers,选择Go till main。
如图:如果需要则在Setting中设置相应的端口和波特率。
由于使用是调试适配器用的是USB 口,且驱动是人体学输入设备,所以不用选择。
3、至此安装设置完成,可以使用Keil μVision2对C8051Fxxx系列单片机进行编写、编译、下载和运行程序。
二、相关操作1、编写程序在工程里面编写并添加程序,首先是新建一个C文件或者ASM文件:点击菜单栏中的file\new…打开编写程序的对话框,点击保存,弹出对话框进行保存,要编写成C文件后缀名为.C,如果是汇编语言则后缀名为.ASM,然后保存。
如下图:这就可以在文本对话框中进行程序编写了。
c8051f单片机教程
内容:西安科技大学科技创新实验班C8051F单片机教程之一作者:苗瑞日期:2009-12-8网站:/bbs一、认识C8051F并与51比较本节主要是让初学C8051F单片机的学员有个感性的认识,着重强调理论方面的知识,并通过与51单片机的比较,让大家能有更深刻的体会。
1、C8051F单片机简介C8051Fxxx 系列单片机是完全集成的混合信号系统级芯片,具有与8051 兼容的微控制器内核,与MCS-51 指令集完全兼容。
除了具有标准8052 的数字外设部件之外,片内还集成了数据采集和控制系统中常用的模拟部件和其它数字外设及功能部件MCU 中的外设或功能部件包括模拟多路选择器、可编程增益放大器、ADC、DAC、电压比较器、电压基准、温度传感器、SMBus/ I2C、UART、SPI、可编程计数器/定时器阵列(PCA)、定时器、数字I/O 端口、电源监视器、看门狗定时器(WDT)和时钟振荡器等。
所有器件都有内置的FLASH 程序存储器和256 字节的内部RAM,有些器件内部还有位于外部数据存储器空间的RAM,即XRAM。
C8051Fxxx 单片机采用流水线结构,机器周期由标准的12 个系统时钟周期降为1 个系统时钟周期,处理能力大大提高,峰值性能可达25MIPS。
C8051Fxxx 单片机是真正能独立工作的片上系统(SOC)。
每个MCU 都能有效地管理模拟和数字外设,可以关闭单个或全部外设以节省功耗。
FLASH 存储器还具有在系统重新编程能力,可用于非易失性数据存储,并允许现场更新8051 固件。
应用程序可以使用MOVC 和MOVX 指令对FLASH 进行读或改写,每次读或写一个字节。
这一特性允许将程序存储器用于非易失性数据存储以及在软件控制下更新程序代码。
片内 JTAG 调试支持功能允许使用安装在最终应用系统上的产品MCU 进行非侵入式(不占用片内资源)、全速、在系统调试。
该调试系统支持观察和修改存储器和寄存器,支持断点、单步、运行和停机命令。
C8051F040开发系统板使用说明书
第一章 C8051F040开发系统板简介1.1 开发系统的组成Cygnal C8051F040单片机开发系统主要由Cygnal 片上系统单片机开发工具、C8051F040片上系统单片机和系统实验板三部分组成,应用该系统可进行片上系统单片机较典型应用的实验,请参见以下介绍。
1.2 Cygnal C8051F单片机开发工具简介1.2.1 开发工具概述Cygnal 的开发工具实质上就是计算机IDE 调试环境软件及计算机RS-232到C8051F单片机JTAG口的协议转换器(EC2-N1)的组合。
Cygnal C8051F系列所有的单片机片内均设计有调试电路该调试电路通过边界扫描方式获取单片机片内信息,通过10线的JTAG接口与开发工具连接以便于进行对单片机在片编程调试。
该开发系统板中的核心部分是Cygnal C8051F040单片机。
适配器(EC2-N1)一端与计算机相连,另一端与C8051F单片机的JTAG口相连,应用Cygnal 提供的IDE调试环境就可以进行非侵入式、全速的在系统编程(ISP)和调试。
Cygnal 开发工具支持观察和修改存储器和寄存器支持断点、观察点、堆栈指示器、单步、运行和停止命令。
调试时不需要额外的目标RAM、程序存储器、定时器或通信通道,并且所有的模拟和数字外设都正常工作。
1.2.2 开发工具主要技术指标●支持的目标系统:所有C8051Fxxx 系列单片机;●系统时钟:最大可达25MHz;●通过RS232接口与PC机连接;●支持汇编语言和C51源代码级调试;●第三方工具支持Keil C。
1.2.3 IDE 软件运行环境要求PC机能够运行开发工具软件并能与串行适配器通信。
对PC机有如下系统要求:●Windows 95/98/Me/NT/2000/XP 操作系统;●32MB RAM;●40MB 自由硬盘空间;●空闲的COM 口。
1.2.4 开发工具与PC 机硬件连接硬件连接及软件安装:●将JTAG 扁平电缆与串行示配器EC2 连接●将JTAG 扁平电缆的另一端与目标系统连接●将RS232 串行电缆的一端与EC2 连接●连接RS232 串行电缆的另一端到PC●给目标系统上电●插入CD 并运行SETUP.EXE 将IDE 软件安装到您的PC 机●在PC 机的开始菜单的程序项中选择Cygnal IDE 点击Cygnal 图标运行IDE软件。
HL-C8051F嵌入式实验开发系统、单片机实验箱
HL-C8051F嵌入式实验开发系统/单片机实验箱一、概述HL-C8051F嵌入式实验/开发系统是针对C8051F单片机(SOC)而开发的。
C8051F单片机完全兼容MCS-51指令系统,利用此平台,不仅可以开展传统的MCS-51单片机教学,如指令系统、中断系统、I/0口接口实验、外围逻辑和通信实验,也可以讲授片上系统(SOC)的概念、体系结构、设计方法、系统应用。
该实验系统实现了C8051F单片机片上的全部资源,并集成了USB主从通信,TCP/IP以太网通信,UCOS-II嵌入式系统移植源码。
我们编写了所有功能和模块的测试程序,提供了大量的实例,使学生在学会C8051F系列片上系统单片机开发方法的同时,感受到片上系统单片机在设计方法上的革新和解决的高效。
二、实验系统组成:(1)CPU板:CPU核心模块采用C8051F020芯片,该芯片是C8051F系列单片机中功能最为其全的一款;集成开发环境支持Silicon Labs IDE和KEIL C软件。
(2)片内:64K FLASH,4K XRAM片外扩展:256K FLASH,32K XRAM(3)CPU板C8051F020芯片I/0引脚全部引出,可以和用户外部电路连接;(4)实验系统带有JTAG接口,并配有HL-EC5型USB高速通讯专业仿真器,通过4脚的JTAG接口可以进行非侵入式、全速的在线系统调试、仿真;(5)4*4阵列式键盘;(6)8位逻辑电平开关输出、8位LED逻辑电平显示;(7)6位动态八段LED数码管;(8)2路单脉冲信号发生电路和1路8MHZ时钟发生电路;(9)时钟分频电路;(10)模拟量发生器电路和逻辑笔电路;(11)8*8LED点阵及驱动电路;(12)128*64LCD液晶显示屏;(13)蜂鸣器电路;(14)直流电机测速电路;(15)四相步进电机及驱动电路;(16)继电器电路及接口;(17)双通道RS-232接口;(18)SPI接口,LED数码管显示;(19)IIC接口,接24C01串行EEPROM;(20)IIC接口,PCF8563日历时钟;(21)8路12位AD,2路12位DA接口;(22)D12USB从机通信;(23)SL811USB主机通信;(24)TL801910M以太网通信;三、C8051F020单片机主要特点:1、模拟外设:(1)逐次逼近型(SAR)12位ADC(ADC0)●可编程转换速率,最大100ksps●可多达8个外部输入;可编程为单端输入或差分输入●可编程放大器增益:16、8、4、2、1、0.5●数据相关窗口中断发生器●内置温度传感器(±3°C)(2)8位ADC(ADC1)●可编程转换速率,最大500ksps●8个外部输入●可编程放大器增益:4、2、1、0.5(3)两个12位DAC●可以同步输出,用于产生无抖动波形(4)两个模拟比较器●16个可编程回差电压值●可用于产生中断或复位(5)电压基准●内部基准(2.4V)(6)精确的VDD监视器和欠压检测器●可通过MONEN引脚允许或禁止。
用于X光机参数检测的C8051F单片机功能开发
1开发所用语言的简单介绍8051单片机,现有四种语言支持,即汇编、PL/M 、C 和BASIC 语言,这里选用C 语言作为8051单片机的开发语言,是因为C 语言是一种结构化语言,可产生紧凑代码。
C 语言结构是以括号{}而不是以字和特殊符号表示的语言。
下面结合8051介绍单片机C 语言的优越性。
不懂单片机的指令集,也能够编写完美的单片机程序;无须懂得单片机的具体硬件,也能够编出符合硬件实际的专业水平的程序;不同函数的数据实行覆盖,有效利用片上有限的RAM 空间;程序具有坚固性,数据被破坏是导致程序运行异常的重要因素。
C 语言对数据进行了许多专业性的处理,避免了运行中间非异步的破坏;C 语言提供复杂的数据类型(数组、结构、联合、枚举、指针等),极大地增强了程序处理能力和灵活性;提供auto 、static 、const 等存储类型和专门针对8051单片机的data 、idata 、pdata 、xdata 、code 等存储类型,自动为变量合理地分配地址;提供small 、compact 、large 等编译模式,以适应片上存储器的大小;中断服务程序的现场保护和恢复,中断向量表的填写,是直接与单片机相关的,都由C 编译器代办;提供常用的标准函数库,以供用户直接使用;头文件中定义宏、说明复杂数据类型和函数原型,有利于程序的移植和支持单片机的系列化产品的开发;有严格的句法检查,错误很少,可容易地在高级语言的水平上迅速地被排掉;可方便地接受多种实用程序的服务:如片上资源的初始化,有专门的实用程序自动生成。
再如,有实时多任务操作系统可调度多道任务,简化用户编程,提高运行的安全性等等。
所以C 语言是一种编译型程序设计语言,它兼顾了多种高级语言的特点,并具备汇编语言的功能。
C 语言功能十分强大,可以塑造一种良好的开发环境,在一种单片上编制的程序比较容易移植到另一种单片机上。
所以这里用C 语言作为开发语言。
2C51语言数据及运算C51是特殊的C 编译器,C51提供的数据结构是以数据类型的形式出现的,C51的数据类型如图1所示:图1数据类型C 语言中的数据有常量和变量之分,同样,在C51语言中也是如此。
C8051F021单片机实验指导
提要:实验项目1、单片机的IO编程实验1 IO开关量输入实验实验2 IO输出驱动继电器(或光电隔离器)实验实验3 IO输入/输出------半导体温度传感器DS18B20实验2、单片机的中断系统实验1 外部外部中断----脉冲计数实验3、单片机的定时器/计数器实验1 计数器实验实验2 秒时钟发生器实验4、单片机的串口特点和编程实验1 P C机串口通讯实验实验2 R S485通讯实验5、存储器实验1 RAM存储器读写实验6、PWM发生器实验1 PWM发生器(模拟)实验实验1 PWM发生器(内部)实验7、WDG看门狗实验1 外扩WDG(MAX813)实验实验2 WDG(内部)实验8、SPI总线实验1 SPI(模拟)实验-----TLC2543 AD转换实验实验2 SPI(模拟)实验-----TLV5616 DA转换实验9、I2C总线实验1 I2C(模拟)实验-----AT24C01读写实验实验2 I2C(内部)实验-----AT24C01读写实验10、综合实验实验1 HD7279LED数码管显示实验实验2 HD7279键盘实验实验3 外部中断---电机转速显示实验11、步进电机正反转实验12、TFT液晶显示彩色条纹实验13、16X16LED点阵显示汉字实验一、单片机的IO编程实验1 IO开关量输入实验目的:学习单片机读取IO引脚状态的的方法。
内容:编程读取IO引脚状态。
设备:EL-EMCU-I试验箱、EXP-C8051F021 CPU板。
编程:首先要把相关的引脚设置在IO的输入状态,然后写一个循环,不停地检测引脚的状态。
步骤:1、将CPU板正确安放在CPU接口插座上,2、连线:用导线将试验箱上MCU部分的IO1--- IO8分别连接到SWITCH 的8个拨码开关的K1---K8的输出端子K1---K8上,连接好仿真器。
3、试验箱上电,在PC机上打开Keil C环境,打开试验程序文件夹IO_INPUT 下的工程文件IO_INPUT.Uv2编译程序,上电,在函数main()的最后一句设置断点,进入调试状态,打开窗口Peripherals-->IO-Port-->P3,改变开关状态,运行程序到断点处,观察窗口的数值与开关的对应关系。
单片机经验总结—c8051f单片机使用技巧
单片机经验总结—c8051f单片机使用技巧
c8051f单片机是在MCS51单片机基础上发展起来的,既有继承,又有很大的创新。
按照功能可分为专用型和通用型。
专用型:100MHz高速型的如f120芯片;24位高分辨率AD的如f350芯片;带usb功能的芯片如f320和f340;超低功耗的芯片如f410;还有带CAN总线的芯片如f040和f060。
通用型:f020,f330d等,内部带有AD,DA,SPI,I2C,WDT,PWM,uart,片内温度传感器等,有的还可以扩展外部数据总线。
以下是我自己应用c8051f单片机总结出来的经验:
1. c8051f单片机速度快,时钟频率可达到25,50甚至100Mhz!内部资源丰富!学习时推荐用c8051f330d 芯片,价格便宜,20pin dip封装,上手快!
2. 电源用计算机的usb接口5伏电源,然后串接3个1N4007或1N4148二极管可以得到3伏左右的电压!!!如果
要使用片内ad功能,电源电压需要更好些,可以使用三极管、稳压管等构成串联稳压电路,效果还是很好
的!!!重要提示,f320,f340芯片内部集成了5伏转3.3伏电路,就不需要这些电路了!!!老外把低压差稳压芯片集成在单片机内部(如何散热?),真不可思议呀!。
C8051F单片机入门学习流程
C8051F单片机入门学习流程一. 准备硬件及软件1.C8051F任意一款开发板(以C8051F330ST为例)。
2.EC3仿真器。
3.Keil C51开发软件到下载二. 开发者具备基本知识1.对MCS51架构单片机有基本了解。
2.有基本C语言及汇编语言编程经验。
3.对单片机开发过程有基本了解。
三. 学习过程如下1.安装Keil C51软件。
(1)找到Keil uv3 (版本 V8.02)软件目录,并点击C51v802.exe安装(2)点击Next(3)选I agree…, 点击Next(4)默认目录(千万不要选择其它目录),点击Next(5)填写用户名等,点击Next(6)开始安装,等待….(7)安装完成,点击Finish(8)打开Keil C软件,选择File/License Management…(9)显示如下:(10)打开Keil_lic_v2.exe,并按如下设置,点击Generate(11)拷贝LIC0内的序列号:(12)粘贴序列号到Keil C软件的New License ID Code下,(13)点击Add LIC,添加序列号成功。
如果添加失败,请重启电脑并进入安全模式,重新安装序列号。
Keil C 软件安装完毕2.安装C8051F单片机针对Keil C51驱动程序。
(1)找到Keil C51驱动程序软件目录,并点击SiC8051F_uv3_v2.31.exe安装(如果前面安装的是Keil uv2, V7.02或V7.50,请点击SiC8051F_uv2_v2.31.exe安装驱动)(2)点击Next(3)点击Next(4)点击Next(5)选择I accept…, 点击Next(6)点击Next(7)点击Next(不要更改目录)(8)开始安装(9)点击Finish安装完成!3. EC3仿真器、开发板连接及开发软件Keil C软件配置(1)将EC3仿真器与开发板连接好,按1.2.3.4步连接(2) 将EC3仿真器与电脑连接好, 仿真器指示灯亮(3) 上述连接确认无误,将开发板电源线(USB接口)与电脑连接好,再连接到开发板上(4)打开Keil Vision3软件,新建一工程ML-Test(或者将学习板光盘上的测试程序拷贝到电脑硬盘上,用Keil Vision3打开,注意将文件属性更改为可读写):(5)选择C8051F330作为CPU:(6)选择配置如下图:(7)显示如下图:(8)选择Debug项,配置如下图:(9)选择Settings项,配置如下图:(10)点击确定,完成设置;(11)编译并下载程序即可调试了;4. 用Keil C51打开软件例程,编译下载程序并运行。
C8051F单片机开发工具使用及常见故障排除
C8051F单片机开发工具使用及常见故障排除V1.02010/8/16目 录1.相关基本知识介绍及正确操作流程1.1.调试器的作用与种类1.2.调试器接口1.3.软件的种类与特色1.4.不同软件的不同设方法1.4.1.IDE1.4.2.KEIL1.4.3.U‐EC5中文下载程序1.5.目标板接口1.6.连接流程2.常见问题问答2.1.软件问题2.1.1.软件版本问题2.1.2.软件设置2.2.调试器问题2.3.目标板问题B连接线问题2.5.10芯扁平线问题2.6.操作流程问题3.使用特例4.附件4.1.调试器图片4.2.软件下载及查找路径4.2.1.IDE4.2.2.KEIL环境下驱动4.2.3.Flash Programming4.2.4.Production Programmer4.2.5.U‐EC5中文下载程序B Reset4.3.调试器接口描述B接口4.3.2.C2接口4.3.3.JTAG接口5.其他:版本更新说明调试器的正常使用,会涉及诸多因素,比如,上位机软件的设置恰当与否,调试器本身的状态良好与否,目标板接口电路正确与否,甚至包括USB连线、10芯扁平线是否良好连接等,都会直接影响调试或下载工作是否能够正常进行。
图 1‐1 调试器连接示意图本文以调试器为中心,详细介绍其使用及在使用过程中、与其相关的软件、目标板等,并以问答形式,重点列举了在使用过程中可能出现的故障以及故障的排除方法。
1相关基本知识介绍及正确操作流程1.1.调试器的作用与种类应用于C8051Fxxx MCU的调试器,区别传统的仿真器,其可执行在线调试、在线编程、在线擦除代码等动作,除用于开发调试,也可用于生产下载。
作为资深代理商,新华龙电子有限公司前后共推出多种型号:U‐PDC,U‐EC3,U‐EC5,以及最近新推出的U‐EC6等。
鉴于目前在市场主要使用后两者,因此本文重点介绍U‐EC5及U‐EC6。
1.2.调试器接口对于U‐EC5及U‐EC6调试器,都存在两个接口,即同上位机电脑连接的USB接口,以及同目标板连接的10芯下载接口,其中,USB接口均符合标准USB接口定义(详细如附件图5.3.1 USB接口),U‐EC5(附件图5.3.2 U‐EC5 10芯接口)及U‐EC6(附件图5.3.2 U‐EC610芯接口)接口为专用。
在KEIL4环境下开发C8051F系列的单片机
在KEIL4环境下开发C8051F系列的单⽚机在KEIL4环境下开发C8051F系列的单⽚机:在安装完KIEL4以后还需要安装C8051F_uVision.exe(由Silicon laboratory公司提供的AGDI,在其官⽹上下载);此AGDI提供以下三个⽅⾯的功能:1:提供最新的C8051F系列单⽚机的器件数据库2:提供通过ECX系列或其他兼容在线调试器提供调试接⼝3:提供对C8051F系列单⽚机的FLASH接⼝安装Sic8051F_uVision.exe⽂件需在Keil安装⽬录中有TOOLS.INI⽂件,其内容主要如下:[UV4]ORGANIZATION="sdstar"NAME="Hua_ming", "Yu"EMAIL="sy.m@/doc/3b52b0379b6648d7c1c746d3.html "BOOK0=UV4\RELEASE_NOTES.HTM("uVision Release Notes",GEN)[C51]PATH="C:\Program Files\keil\C51\"VERSION=V9.01TDRV0=BIN\MON51.DLL ("Keil Monitor-51 Driver")TDRV1=BIN\ISD51.DLL ("Keil ISD51 In-System Debugger")TDRV2=BIN\SIC8051F.DLL ("SILICON LABS C8051Fxxx Driver")RTOS0=Dummy.DLL("Dummy")RTOS1=RTXTINY.DLL ("RTX-51 Tiny")RTOS2=RTX51.DLL ("RTX-51 Full")LIC0=UJ512-98S0H-ZGW7Q-NWPHT-8IHFH-6658M其中TDRV0~2 为8051的驱动程序,在安装好Sic8051F_uVision.exe⽂件后就会在Keil安装⽬录下⽣成SIC8051F.DLL⽂件,安装完毕后,任意打开C51的⼀个⼯程(如LED开发⼯程开Source Code\LED_Flow\project),先进⾏⼀系列的设置。
c8051f340单片机简介
2.1 设备连接与软硬件开发平台
一个完整的C8051F开发环境,需具备“软件开发平台”和“硬件开发平台”
软件开发平台:
1、编译软件
程序的编写最常见的两种语言是C语言和汇编语言,而编写语言就需要使用编译软件。
工程师通过编译软件把编写完成的源代码(C或汇编语言)编译为可以直接烧录到单片机内的"hex"文件。
目前适用于C 的常用编译软件有Silabs IDE、Keil和SDCC,我们所有开发板的示例程序都是基于Silabs IDE和Keil这两款编译软件进行编写的。
2、烧写和仿真软件
烧写和仿真软件目前在市面使用上主要为Silabs IDE和Keil两款软件,但我们推荐使用Silabs IDE,因为这款IDE软件是由C8051F单片机的厂家"silabs"公司出的官方软件,其兼容性与实时性都是比较好硬件开发平台:
硬件开发平台需具备3样最基本的硬件,分别是PC机(电脑)、编程器或仿真器、带有单片机的目标板。
1、PC机(电脑)上需要安装编程器、仿真器的驱动和软件开发环境;
2、编程器、仿真器需要用户了解其支持的芯片型号及编程接口,以便用户对希望编程烧写的芯片进行正常操作;
3、目标板必须是一款可以正常运行的C8051F单片机系统,目标板可独立供电,编程器、仿真器可对目标板进行供电。
C8051F020实验指导书
盛年不重来,一日难再晨。
及时宜自勉,岁月不待人。
单片机实验指导书目录第一章:实验设备简介 (1)1.1 系统实验设备的组成 (1)1.2 Silicon Labs C8051F 单片机开发工具简介 (1)1.3 DICE-C8051F嵌入式实验/开发系统简介 (3)第二章集成开发环境KEIL C软件使用指南 (7)2.1 KEIL C软件具体使用说明 (7)第三章实验指导 (20)3.1 C8051F 单片机I/O 口交叉开关设置 (20)3.2 数字I/O端口实验 (22)3.3 定时器实验 (24)3.4 外部中断实验 (27)3.5 键盘显示实验 (29)3.6 六位动态LED数码管显示实验 (31)3.7 RS3232串口通讯实验 (33)3.8 综合设计 (35)使用特别说明:(1) 每次实验前,请仔细阅读实验指导,连线完毕,检查无误后,方可打开电源。
即连线时必须在断电状态下。
(2) 程序运行过程中,不要关闭电源,如果要断电,必须停止运行程序,并且退出程序调试状态,否则会引起KEIL C软件非正常退出,甚至引起DICE-EC5仿真器工作异常。
(3) 如出现上述(2)的的误操作,引起DICE-EC5仿真器工作异常,可对DICE-EC5仿真器进行复位。
(在光盘中找到文件夹“USB Reset”中的“USB Debug Adapter Firmware Reset”文件,双击运行,在弹出的对话框中点击“Update firmware”按钮,在提示成功后,点击“OK”按钮,退出复位程序。
DICE-EC5仿真器即可正常工作。
在下一次调试、下载程序时会提示“Do you want to update serial adapter now? ”,点击“确定”即可。
第一章:实验设备简介1.1 系统实验设备的组成DICE-C8051F嵌入式实验/开发系统由C8051F020 CPU 板、DICE-EC5仿真器和系统实验板三部分组成,应用该设备可进行片上系统单片机较典型应用的实验,请参见以下介绍。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
关于开发工具及调试的技术问答
1、问:C8051FXX系列单片机的开发工具是不是串行适配器(PC机串口和JTAG协议转换适配)相同而目标版不同?
答:开发套件中串行适配器(核心部件)是通用的,只是目标版不同。
只要您购买一套开发套件,就可以开发全系列单片机,只要将集成开发环境软件升级就可以了。
为了加快您的开发进程,您只要购买带有相关型号单片机的目标板就可以了。
2、问:C8051F单片机是怎样调试用户系统的?
答:C8051F单片机是用开发套件来调试用户系统的。
单片机开发套件包括开发软件IDE(集成开发环境),ML-EC3至PC机USB口和单片机JTAG接口的协议转换模块和一个目标板(板上有
C8051FMCU)。
IDE中集成编译器,汇编器和连接器,支持汇编语言和C语言(第三方支持);ML-EC3是从USB口到JTAG协议的转换模块。
目标板上带有一块相应的C8051FMCU和一些简单的外围电路构成一个最小单片机系统,并将所有引脚连接到插座。
C8051F单片机内集成了一个以JTAG协议为基础的调试电路,这样在调试您的系统时,不需要专用仿真芯片、目标仿真头及目标RAM等。
您在IDE上编译生成程序代码后,通过ML-EC3(连接到计算机USB口和JTAG接口)将代码下载到用户系统板的C8051FMCU的Flash存储器中,然后您就可以调试您的目标系了。
3、问:可以用KeiluVision2IDE调试全系列C8051F单片机应用系统吗?
答:可以。
但必须安装动态链接库。
该驱动程序可以在我公司的网站上下载。
4、问:如何将绝对目标代码转换成hex格式文件?
答:第一,可以使用KEILC,在编译时直接生成。
第二,使用OH51(DOS命令)将目标文件转换成hex格式的文件。
Oh5Linputfile〔hexfile〕
第三,在IDE环境中生成HEX文件
﹙1﹚.在TOOL菜单中选择ADDREMOVEUSERTOOL
﹙2﹚.点击ADD按钮,增加一个MENUTEXT(名称可以任何输入)
﹙3﹚.在TOOLS里选择OH51.EXE文件(此文件在KEIL的BIN目录中有,必须将此文件放在项目所在目录)
﹙4﹚.在ARGUMENTS里输入文件名或项目名
﹙5﹚.在DIROF里输入HEX文件的保存目录
5、问:Silabs IDE中带有4K代码限制版的KeilC51,那么如何将无限制版的KeilC51嵌入到Silabs IDE中呢?
答:先将您完全版的KeilC51安装到您的PC机中;然后进入Silabs IDE界面,选择Project-﹥TOOLChainIntegration弹出对话框,单击Browse按钮,更换A51.EXE和BL51.EXE的路径(换成“Keil安装目录”/c51/bin)即可。
6、问:程序代码加密后,IDE不能与目标系统连接怎么办?
答:进入IDE界面,选择Tools→EraseSpace来擦除FLASH后,自动与目标系统连接。