mc8051用户手册中文版

合集下载

8051微控制器硬件手册及应用注释说明书

8051微控制器硬件手册及应用注释说明书

1API Program ExamplesReferences•Atmel 8051 Microcontrollers Hardware Manual1. IntroductionThis Application Note provides to customers C program examples for Api usages.24365A–80C51–07/0434365A–80C51–07/042. API for Standard C512.1 flash_eeprom_api.c/*C************************************************************************ NAME: flash_eeprom_api.c*-------------------------------------------------------------------------* Copyright (c) 2004 Atmel.*-------------------------------------------------------------------------* RELEASE:* REVISION: 1.0*-------------------------------------------------------------------------* PURPOSE:* Read/Write flash* CAUTTION : add #define ONCHIP_EEPROM for on-chip eeprom products* (defined by default in the standard delivery)**************************************************************************//*_____ I N C L U D E - F I L E S _______________________________________*/#include "reg_C51.h"/*_____ D E C L A R A T I O N ___________________________________________*/#define ONCHIP_EEPROM //define it only for on-chip eeprom products/*---- API for FLASH access --------------------------------------------*//*************************************************************************/#define __api_rd_code_byte(address) (*((unsigned char code*) (address)))unsigned char__api_wr_code_byte(int , unsigned char)small;unsigned char__api_wr_code_page(int , int, unsigned char)small;/*---- API for EEPROM access -------------------------------------------*//*************************************************************************/#ifdef ONCHIP_EEPROMvoid __api_wr_eeprom_byte(unsigned int adr, unsigned char value);unsigned char __api_rd_eeprom_byte(unsigned int adr);#endif/*_____ G L O B A L S ___________________________________________________*/sfr16 DPTR = 0x82;/*_____ L O C A L S _____________________________________________________*/#define MSK_AUXR1_ENBOOT0x20#define MSK_AUXR_M00x20#define MAP_BOOT AUXR1 |= MSK_AUXR1_ENBOOT;#define UNMAP_BOOTAUXR1 &= ~MSK_AUXR1_ENBOOT;/*_____ EXTERNAL - F U N C T I O N S - D E C L A R A T I O N ____________*/extern void ASM_MOV_R1_A(void);extern void __API_FLASH_ENTRY_POINT(void);/*F************************************************************************ NAME: __api_wr_code_byte*-------------------------------------------------------------------------* PARAMS:* int address : address to program* unsigned char value : data to write* unsigned char return :* return = 0x00 -> pass* return != 0x00 -> fail*-------------------------------------------------------------------------* PURPOSE:* Program data byte in Flash memory**************************************************************************/unsigned char __api_wr_code_byte (int address, unsigned char value) small{bit ea_save;ea_save = EA;EA = 0;DPTR = address;ACC = 0x02;ASM_MOV_R1_A();ACC = value;MAP_BOOT;__API_FLASH_ENTRY_POINT();UNMAP_BOOT;EA = ea_save; // restore interrupt statereturn (ACC);}/*F************************************************************************ NAME: __api_wr_code_page*-------------------------------------------------------------------------* PARAMS:* int add_flash : address of the first byte to program in the Flash* int add_xram : address in XRAM of the first data to program* unsigned char nb_data : number of bytes to program*unsigned char return :* return = 0x00 -> pass* return != 0x00 -> fail*-------------------------------------------------------------------------* PURPOSE:* Program until 128 Datas in Flash memory.* Number of bytes to program is limited such as the Flash write remains in a* single 128 bytes page.**************************************************************************/unsigned char __api_wr_code_page (int add_flash, int add_xram, unsigned charnb_data) small{unsigned char save_auxr1;bit ea_save;44365A–80C51–07/0454365A–80C51–07/04ea_save = EA;EA = 0;save_auxr1 = AUXR1;AUXR1 &= ~0x01; // Set DPTR=DPTR0DPTR = add_flash;AUXR1++; // DPTR = DPTR1DPTR = add_xram;ACC = 0x09;ASM_MOV_R1_A();ACC = nb_data;AUXR1 &= ~0x01; // Set DPTR = DPTR0MAP_BOOT__API_FLASH_ENTRY_POINT();UNMAP_BOOT;AUXR1 = save_auxr1;EA = ea_save; // restore interrupt statereturn (ACC);}/*F************************************************************************ NAME: __api_rd_eeprom_byte*-------------------------------------------------------------------------* PARAMS:* unsigned int adr: The EEDATA memory location to read* return: value*-------------------------------------------------------------------------* PURPOSE:* This function reads one byte in the on-chip EEPROM data.*-------------------------------------------------------------------------* EXAMPLE:* val=__api_rd_eeprom_byte(128);*-------------------------------------------------------------------------* NOTE:*-------------------------------------------------------------------------* REQUIREMENTS:**************************************************************************/unsigned char __api_rd_eeprom_byte(unsigned int adr){unsigned char val;bit ea_save;while (EECON&1);//Eeprom_busy()ea_save=EA;EA=0;EECON |= 0x02;//Enable eeprom data;val=*(unsigned char xdata*)adr;EECON &= ~0x02;//Disable eeprom data;EA=ea_save;return val;}/*F************************************************************************ NAME: __api_wr_eeprom_byte*-------------------------------------------------------------------------* PARAMS:* unsigned int adr: The EEDATA memory location to read* unsigned char value: The data byte to write* return: none*-------------------------------------------------------------------------* PURPOSE:* This function writes one byte in the on-chip EEPROM data.*-------------------------------------------------------------------------* EXAMPLE:*-------------------------------------------------------------------------* NOTE:*-------------------------------------------------------------------------* REQUIREMENTS:**************************************************************************/void __api_wr_eeprom_byte(unsigned int adr, unsigned char value){bit ea_save;while(EECON & 0x01);// wait bit busyea_save=EA;EA=0;EECON |= 0x02;//Enable eeprom data*(unsigned char xdata*)adr=value;EECON &= ~0x02;//Disable eeprom dataEA=ea_save;}64365A–80C51–07/0474365A–80C51–07/042.2 flash_lib.a51NAME FLASH_LIB;;*A51********************************************************************; FILE_NAME : FLASH_LIB.a51 ;------------------------------------------------------------------------ ;------------------------------------------------------------------------; FILE_PURPOSE: low level function for API;************************************************************************USING 0PUBLIC ASM_MOV_R1_APUBLIC __API_FLASH_ENTRY_POINTAUXR1 EQU0A2hSTART SEGMENT CODERSEG START;************************************************************************; FUNCTION_NAME: ASM_MOV_A_R1;************************************************************************ASM_MOV_R1_A:Mov R1, ARet;************************************************************************; FUNCTION_NAME: __API_FLASH_ENTRY_POINT;************************************************************************__API_FLASH_ENTRY_POINT:PUSHAR2PUSHAR4PUSHAR6LCALL 0FFF0hPOPAR6POPAR4POPAR2RetEND3. API for USB products3.1 flash_eeprom_api.c/*C************************************************************************ NAME: flash_eeprom_api.c*-------------------------------------------------------------------------* Copyright (c) 2004 Atmel.*-------------------------------------------------------------------------* RELEASE:* REVISION:*-------------------------------------------------------------------------* PURPOSE:* This file contains whole of functions to access AT89C5131 Flash and* EEPROM and AT89C51SND1.* CAUTTION : add #define ONCHIP_EEPROM for on-chip eeprom products* (defined by default in the standard delivery)**************************************************************************//*_____ I N C L U D E S _________________________________________________*/#include "reg_C51.h"/*_____ D E F I N I T I O N _____________________________________________*/#define ONCHIP_EEPROM //define it only for build-in eeprom chipsunsigned char data api_command _at_ 0x1C;unsigned char data api_value _at_ 0x1D;#define MSK_AUXR1_ENBOOT 0x20#define MAP_BOOT AUXR1 |= MSK_AUXR1_ENBOOT;#define UNMAP_BOOT AUXR1 &= ~MSK_AUXR1_ENBOOT;#define __API_FLASH_ENTRY_POINT (*((const void(code*)(void)) 0xFFC0 ))/*_____ D E C L A R A T I O N ___________________________________________*//*---- API for FLASH access --------------------------------------------*//*************************************************************************/unsigned char __api_rd_code_byte (unsigned char code * pt_address);unsigned char __api_wr_code_byte (unsigned char xdata* , unsigned char);unsigned char __api_wr_code_page (unsigned char xdata* pt_code,unsigned char xdata* pt_xram,unsigned char nb_data);/*---- API for EEPROM access -------------------------------------------*//*************************************************************************/#ifdef ONCHIP_EEPROMunsigned char __api_rd_eeprom_byte(unsigned char xdata *);unsigned char __api_wr_eeprom_byte(unsigned char xdata *, unsigned char);#endif84365A–80C51–07/0494365A–80C51–07/04/*F************************************************************************ NAME: __api_rd_code_byte*-------------------------------------------------------------------------* PARAMS:* unsigned int address : address in flash memory to read* return:* unsigned char device : read value*-------------------------------------------------------------------------* PURPOSE:* This function allows to read a flash memory byte.*-------------------------------------------------------------------------* EXAMPLE:*-------------------------------------------------------------------------* NOTE:*-------------------------------------------------------------------------* REQUIREMENTS:**************************************************************************/unsigned char __api_rd_code_byte (unsigned char code * pt_address){return(*pt_address);}/*F************************************************************************ NAME: __api_wr_code_byte*-------------------------------------------------------------------------* PARAMS:* unsigned int address : address to program* unsigned char value : data to write* return:* unsigned char return :* return = 0x00 -> pass* return != 0x00 -> fail*-------------------------------------------------------------------------* PURPOSE:* This function allows to program data byte in Flash memory.*-------------------------------------------------------------------------* EXAMPLE:*-------------------------------------------------------------------------* NOTE:*-------------------------------------------------------------------------* REQUIREMENTS:**************************************************************************/unsigned char __api_wr_code_byte (unsigned char xdata * pt_address, unsigned char value){bit ea_save;ea_save = EA;EA = 0;api_command = 0x0D; //_COMMAND_WR_CODE_BYTE;FCON = 0x08;*pt_address = value;MAP_BOOT;__API_FLASH_ENTRY_POINT();UNMAP_BOOT;EA = ea_save; // restore interrupt statereturn(api_value);}/*F************************************************************************ NAME: __api_wr_code_page*-------------------------------------------------------------------------* PARAMS:* unsigned int add_flash : address of the first byte to program* in the Flash* unsigned int add_xram : address in XRAM of the first data to program* unsigned char nb_data : number of bytes to program* return:* unsigned char return :* return = 0x00 -> pass* return != 0x00 -> fail*-------------------------------------------------------------------------* PURPOSE:* This function allows to program until 128 Datas in Flash memory.* Number of bytes to program is limited such as the Flash write remains* in a single 128 bytes page.*-------------------------------------------------------------------------* EXAMPLE:*-------------------------------------------------------------------------* NOTE:* This function used Dual Data Pointer DPTR0&1. At the end of this* function.* DPTR = DPTR0.*-------------------------------------------------------------------------* REQUIREMENTS:**************************************************************************/unsigned char __api_wr_code_page (unsigned char xdata * pt_code,unsigned char xdata * pt_xram,unsigned char nb_data){unsigned char data i, temp, temp_nb_data;bit ea_save;unsigned int data add_pt_code, add_pt_xram;add_pt_xram = pt_xram;add_pt_code = pt_code;temp_nb_data = nb_data;104365A–80C51–07/04114365A–80C51–07/04ea_save = EA;EA = 0;api_command = 0x0D;for (i=0 ; i< temp_nb_data; i++,add_pt_xram++,add_pt_code++){temp = *(unsigned char xdata *)add_pt_xram;FCON = 0x08;*(unsigned char xdata *)add_pt_code = temp;FCON = 0x00;}MAP_BOOT;__API_FLASH_ENTRY_POINT();UNMAP_BOOT;EA = ea_save; // restore interrupt statereturn(api_value);}#ifdef ONCHIP_EEPROM/*F************************************************************************ NAME: api_rd_eeprom*-------------------------------------------------------------------------* PARAMS:* unsigned char xdata *address : address to read* return:*-------------------------------------------------------------------------* PURPOSE:* This function allows to read a byte in Eeprom.*-------------------------------------------------------------------------* EXAMPLE:*-------------------------------------------------------------------------* NOTE:*-------------------------------------------------------------------------* REQUIREMENTS: The EEPROM mustn't be busy to perform the read access.* eeprom status :(EECON & 0x01)=1 busy, =0 free**************************************************************************/unsigned char __api_rd_eeprom_byte(unsigned char xdata *address){unsigned char val;bit ea_save;ea_save = EA;EA = 0;EECON = 0x02;val = *address;EECON = 0x00;EA = ea_save;return (val);}/*F************************************************************************ NAME: api_wr_eeprom_byte*-------------------------------------------------------------------------* PARAMS:* unsigned char xdata* address : address to read* unsigned char value : data to write* return:*-------------------------------------------------------------------------* PURPOSE:* This function allows to program a byte in Eeprom.*-------------------------------------------------------------------------* EXAMPLE:*-------------------------------------------------------------------------* NOTE:*-------------------------------------------------------------------------* REQUIREMENTS: The EEPROM mustn't be busy to perform the read access.* eeprom status :(EECON & 0x01)=1 busy, =0 free**************************************************************************/unsigned char __api_wr_eeprom_byte (unsigned char xdata *address,unsigned char value){bit ea_save;while(EECON & 0x01);// wait bit busyea_save = EA;EA = 0;EECON = 0x02;*address = value;/* addr is a pointer to external data mem */EECON = 0x50;EECON = 0xA0;EA = ea_save;return (1);}#endif124365A–80C51–07/04134365A–80C51–07/044. Example4.1 test_api.c/*C*********************************************************************** NAME: test_api.c*------------------------------------------------------------------------* Copyright (c) 2004 Atmel.*------------------------------------------------------------------------* RELEASE:* REVISION: 1.0*------------------------------------------------------------------------* PURPOSE: usage example of flash_eeprom_api.c*************************************************************************//*_____ I N C L U D E S ________________________________________________*/#include "flash_eeprom_api.c"/*F************************************************************************ NAME: main*-------------------------------------------------------------------------* PARAMS:*-------------------------------------------------------------------------* PURPOSE: usage example of flash_eeprom_api.c*-------------------------------------------------------------------------* EXAMPLE:*-------------------------------------------------------------------------* NOTE:*-------------------------------------------------------------------------* REQUIREMENTS:*************************************************************************/void main (void){int adress;char i=0;char data_tmp;/* write code page example */for(adress=0x0000;adress<0x007F;adress++){/* write 0x55 between 0x0000 and 0x007F of xram */*((unsigned char xdata*) adress)=0x55;}/* copy xram page to flash at 0x1100 */__api_wr_code_page(0x1100,0x0000,0x7F);/* write code byte example */i=0;for(adress=0x1000;adress<0x1006;adress++){/* write "ABCDEF" at 0x1000 */__api_wr_code_byte(adress,0x41+i++);}/* read and write code byte example */for(adress=0x1000;adress<0x1006;adress++){/* copy 0x1000-0x1006 to 0x1010-0x1016 in flash memory */data_tmp = __api_rd_code_byte(adress);__api_wr_code_byte(adress+0x0010,data_tmp);}#ifdef ONCHIP_EEPROM/* write eeprom byte example */i=0;for (adress=0x000;adress<0x400;adress++) /* write 1Ko of eeprom */{/* write a byte, write time = 10ms to 20ms */__api_wr_eeprom_byte(adress,i++);}/* read eeprom byte example */for (adress=0x000;adress<0x400;adress++){/* copy previous writed data from eeprom to flash at 0x1200 */data_tmp=__api_rd_eeprom_byte(adress);__api_wr_code_byte(0x1200+adress,data_tmp);}#endifwhile(1); /* endless */}144365A–80C51–07/04154365A–80C51–07/044.2 SFR Register Definition/*H**************************************************************************** NAME: AT89C51XD2.h*----------------------------------------------------------------------------* PURPOSE: SFR Description file for AT89C51xD2 products* ON KEIL compiler*****************************************************************************/#define Sfr(x, y) sfr x = y#define Sbit(x, y, z) sbit x = y^z#define Sfr16(x,y) sfr16 x = y/*----------------------------------------*//* Include file for 8051 SFR Definitions *//*----------------------------------------*//* BYTE Register */Sfr (P0 , 0x80);Sbit (P0_7 , 0x80, 7);Sbit (P0_6 , 0x80, 6);Sbit (P0_5 , 0x80, 5);Sbit (P0_4 , 0x80, 4);Sbit (P0_3 , 0x80, 3);Sbit (P0_2 , 0x80, 2);Sbit (P0_1 , 0x80, 1);Sbit (P0_0 , 0x80, 0);Sfr (P1 , 0x90);Sbit (P1_7 , 0x90, 7);Sbit (P1_6 , 0x90, 6);Sbit (P1_5 , 0x90, 5);Sbit (P1_4 , 0x90, 4);Sbit (P1_3 , 0x90, 3);Sbit (P1_2 , 0x90, 2);Sbit (P1_1 , 0x90, 1);Sbit (P1_0 , 0x90, 0);Sfr (P2 , 0xA0);Sbit (P2_7 , 0xA0, 7);Sbit (P2_6 , 0xA0, 6);Sbit (P2_5 , 0xA0, 5);Sbit (P2_4 , 0xA0, 4);Sbit (P2_3 , 0xA0, 3);Sbit (P2_1 , 0xA0, 1);Sbit (P2_0 , 0xA0, 0);Sfr (P3 , 0xB0);Sbit (P3_7 , 0xB0, 7);Sbit (P3_6 , 0xB0, 6);Sbit (P3_5 , 0xB0, 5);Sbit (P3_4 , 0xB0, 4);Sbit (P3_3 , 0xB0, 3);Sbit (P3_2 , 0xB0, 2);Sbit (P3_1 , 0xB0, 1);Sbit (P3_0 , 0xB0, 0);Sbit (RD , 0xB0, 7);Sbit (WR , 0xB0, 6);Sbit (T1 , 0xB0, 5);Sbit (T0 , 0xB0, 4);Sbit (INT1 , 0xB0, 3);Sbit (INT0 , 0xB0, 2);Sbit (TXD , 0xB0, 1);Sbit (RXD , 0xB0, 0);Sfr (P4 , 0xC0);Sbit (P4_7 , 0xC0, 7);Sbit (P4_6 , 0xC0, 6);Sbit (P4_5 , 0xC0, 5);Sbit (P4_4 , 0xC0, 4);Sbit (P4_3 , 0xC0, 3);Sbit (P4_2 , 0xC0, 2);Sbit (P4_1 , 0xC0, 1);Sbit (P4_0 , 0xC0, 0);Sfr (P5 , 0xE8);Sbit (P5_7 , 0xE8, 7);Sbit (P5_6 , 0xE8, 6);Sbit (P5_5 , 0xE8, 5);Sbit (P5_4 , 0xE8, 4);Sbit (P5_3 , 0xE8, 3);Sbit (P5_2 , 0xE8, 2);Sbit (P5_1 , 0xE8, 1);Sbit (P5_0 , 0xE8, 0);Sfr (PSW , 0xD0);Sbit (CY , 0xD0 , 7);Sbit (AC , 0xD0 , 6);164365A–80C51–07/04174365A–80C51–07/04Sbit (RS1 , 0xD0 , 4);Sbit (RS0 , 0xD0 , 3);Sbit (OV , 0xD0 , 2);Sbit (UD , 0xD0 , 1);Sbit (P , 0xD0 , 0);Sfr (ACC , 0xE0);Sfr (B , 0xF0);Sfr (SP , 0x81);Sfr (DPL , 0x82);Sfr (DPH , 0x83);Sfr (PCON , 0x87);Sfr (CKCON0 , 0x8F);Sfr (CKCON1 , 0xAF);/*------------------ TIMERS registers ---------------------*/Sfr (TCON , 0x88);Sbit (TF1 , 0x88, 7);Sbit (TR1 , 0x88, 6);Sbit (TF0 , 0x88, 5);Sbit (TR0 , 0x88, 4);Sbit (IE1 , 0x88, 3);Sbit (IT1 , 0x88, 2);Sbit (IE0 , 0x88, 1);Sbit (IT0 , 0x88, 0);Sfr (TMOD , 0x89);Sfr (T2CON , 0xC8);Sbit (TF2 , 0xC8, 7);Sbit (EXF2 , 0xC8, 6);Sbit (RCLK , 0xC8, 5);Sbit (TCLK , 0xC8, 4);Sbit (EXEN2 , 0xC8, 3);Sbit (TR2 , 0xC8, 2);Sbit (C_T2 , 0xC8, 1);Sbit (CP_RL2, 0xC8, 0);Sfr (T2MOD , 0xC9);Sfr (TL0 , 0x8A);Sfr (TL1 , 0x8B);Sfr (TL2 , 0xCC);Sfr (TH0 , 0x8C);Sfr (TH1 , 0x8D);Sfr (TH2 , 0xCD);Sfr (RCAP2L , 0xCA);Sfr (RCAP2H , 0xCB);Sfr (WDTRST , 0xA6);/*------------------- UART registers ------------------------*/Sfr (SCON , 0x98);Sbit (SM0 , 0x98, 7);Sbit (FE , 0x98, 7);Sbit (SM1 , 0x98, 6);Sbit (SM2 , 0x98, 5);Sbit (REN , 0x98, 4);Sbit (TB8 , 0x98, 3);Sbit (RB8 , 0x98, 2);Sbit (TI , 0x98, 1);Sbit (RI , 0x98, 0);Sfr (SBUF , 0x99);Sfr (SADEN , 0xB9);Sfr (SADDR , 0xA9);/*-------------------- Internal Baud Rate Generator --------*/Sfr (BRL , 0x9A);Sfr (BDRCON , 0x9B);/*-------------------- IT registers -----------------------*/Sfr (IEN0 , 0xA8);Sfr (IEN1 , 0xB1);Sfr (IPH0 , 0xB7);Sfr (IPH1 , 0xB3);Sfr (IPL0 , 0xB8);Sfr (IPL1 , 0xB2);/* IEN0 */Sbit (EA , 0xA8, 7);Sbit (EC , 0xA8, 6);Sbit (ET2 , 0xA8, 5);Sbit (ES , 0xA8, 4);Sbit (ET1 , 0xA8, 3);Sbit (EX1 , 0xA8, 2);Sbit (ET0 , 0xA8, 1);Sbit (EX0 , 0xA8, 0);/*--------------------- PCA registers -----------------------------*/Sfr (CCON , 0xD8);Sfr (CMOD , 0xD9);Sfr (CH , 0xF9);184365A–80C51–07/04194365A–80C51–07/04Sfr (CCAP0H , 0xFA);Sfr (CCAP0L , 0xEA);Sfr (CCAPM0 , 0xDA);Sfr (CCAP1H , 0xFB);Sfr (CCAP1L , 0xEB);Sfr (CCAPM1 , 0xDB);Sfr (CCAP2H , 0xFC);Sfr (CCAP2L , 0xEC);Sfr (CCAPM2 , 0xDC);Sfr (CCAP3H , 0xFD);Sfr (CCAP3L , 0xED);Sfr (CCAPM3 , 0xDD);Sfr (CCAP4H , 0xFE);Sfr (CCAP4L , 0xEE);Sfr (CCAPM4 , 0xDE);/* CCON */Sbit (CF , 0xD8, 7);Sbit (CR , 0xD8, 6);Sbit (CCF4 , 0xD8, 4);Sbit (CCF3 , 0xD8, 3);Sbit (CCF2 , 0xD8, 2);Sbit (CCF1 , 0xD8, 1);Sbit (CCF0 , 0xD8, 0);/*------------------ T W I registers ------------------------------*/Sfr ( SSCON , 0x93);Sfr ( SSCS , 0x94);Sfr ( SSDAT , 0x95);Sfr ( SSADR , 0x96);Sfr ( PI2, 0xF8);Sbit (PI2_1 , 0xF8, 1);Sbit (PI2_0 , 0xF8, 0);/*-------------------- OSC control registers ----------------------*/Sfr ( CKSEL , 0x85 );Sfr ( OSCCON , 0x86 );Sfr ( CKRL , 0x97 );/*-------------------- Keyboard control registers -----------------*/Sfr ( KBLS , 0x9C );Sfr ( KBE , 0x9D );Sfr ( KBF , 0x9E );/*-------------------- SPI ---------------------- -----------------*/Sfr ( SPCON, 0xC3 );Sfr ( SPSTA, 0xC4 );Sfr ( SPDAT, 0xC5 );/*------ Misc ----------------------------------------------------*/Sfr( AUXR , 0x8E);Sfr ( AUXR1, 0xA2);Sfr ( FCON, 0xD1);/*------ E data --------------------------------------------------*/Sfr ( EECON, 0xD2 );204365A–80C51–07/04Disclaimer: Atmel Corporation makes no warranty for the use of its products, other than those expressly contained in the Company’s standard warranty which is detailed in Atmel’s Terms and Conditions located on the Company’s web site. The Company assumes no responsibility for any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without notice, and does not make any commitment to update the information contained herein. No licenses to patents or other intellectual property of Atmel are granted by the Company in connection with the sale of Atmel products, expressly or by implication. Atmel’s products are not authorized for use as critical components in life support devices or systems.Atmel CorporationAtmel Operations2325 Orchard Parkway San Jose, CA 95131Tel: 1(408) 441-0311Fax: 1(408) 487-2600Regional HeadquartersEuropeAtmel SarlRoute des Arsenaux 41Case Postale 80CH-1705 Fribourg SwitzerlandTel: (41) 26-426-5555Fax: (41) 26-426-5500AsiaRoom 1219Chinachem Golden Plaza 77 Mody Road Tsimshatsui East Kowloon Hong KongTel: (852) 2721-9778Fax: (852) 2722-1369Japan9F, Tonetsu Shinkawa Bldg.1-24-8 ShinkawaChuo-ku, Tokyo 104-0033JapanTel: (81) 3-3523-3551Fax: (81) 3-3523-7581Memory2325 Orchard Parkway San Jose, CA 95131Tel: 1(408) 441-0311Fax: 1(408) 436-4314Microcontrollers2325 Orchard Parkway San Jose, CA 95131Tel: 1(408) 441-0311Fax: 1(408) 436-4314La Chantrerie BP 7060244306 Nantes Cedex 3, France Tel: (33) 2-40-18-18-18Fax: (33) 2-40-18-19-60ASIC/ASSP/Smart CardsZone Industrielle13106 Rousset Cedex, France Tel: (33) 4-42-53-60-00Fax: (33) 4-42-53-60-011150 East Cheyenne Mtn. Blvd.Colorado Springs, CO 80906Tel: 1(719) 576-3300Fax: 1(719) 540-1759Scottish Enterprise Technology Park Maxwell BuildingEast Kilbride G75 0QR, Scotland Tel: (44) 1355-803-000Fax: (44) 1355-242-743RF/AutomotiveTheresienstrasse 2Postfach 353574025 Heilbronn, Germany Tel: (49) 71-31-67-0Fax: (49) 71-31-67-23401150 East Cheyenne Mtn. Blvd.Colorado Springs, CO 80906Tel: 1(719) 576-3300Fax: 1(719) 540-1759Biometrics/Imaging/Hi-Rel MPU/High Speed Converters/RF DatacomAvenue de Rochepleine BP 12338521 Saint-Egreve Cedex, France Tel: (33) 4-76-58-30-00Fax: (33) 4-76-58-34-80e-mail********************Web Site4365A–80C51–07/04/xM©Atmel Corporation 2004. All rights reserved. Atmel, the Atmel logo, andcombinations thereof are registered trademarks of Atmel Corporation or its subsidiaries. Windows ® Windows 98™, Windows XP ™, and Windows 2000™ are trademarks and/ore registered trademark of Microsoft Corporation. Other terms and product names in this document may be the trademarks of others.。

笙泉 8051 烧录器中文使用手册

笙泉 8051 烧录器中文使用手册

10
3.3.2 将编程器连接起来
10
3.3.3 按编程器里的‘Auto’键,开始编程
10
4. 芯片储存空间的配置
11
4.1 MPC87L/E51/52
11
5. 芯片的硬件选项
12
5.1 MPC87L/E51/52
12
-2-
MEGAWIN
MAKE YOU WIN
笙泉 8051 编程器使用手册
V1.10
MEGAWIN
MAKE YOU WIN
笙泉 8051 编程器使用手册
V1.10
3.1.4 设置硬件选项 在这设置一一些硬件选项 1): ISP 空间设置. 如需要使用到 ISP 代码,则必须设置相对应的空间大小来存储 ISP 代码 2): OSC 设置. 如需使用内部 ROSC, 则必须 OSC 频率,并且选上 ENRCO
用于存放客户代码和数据,这部分数据可由编程器和 ISP 程序进行擦除和读写操作等编程操作 IAP 空间:
是一段非易失性的数据存储空间,这部分数据可由编程器、ISP 程序以及 AP 程序进行擦除和读写操作等 编程操作 ISP 空间: 是一段特殊的存储空间,可独立运行程序代码,一般是用于对 AP 和 IAP 空间进行在线编程,而 ISP 本 身的存储空间只能用编程器来进行编程 笙泉的 8051 芯片的存储空间的配置情况会各有差异
笙泉 8051 编程器使用手册
V1.10
日期 2008/10/22 2008/11/24
- 13 -
按 AUTO 键开始编程. 在编程过程中 “黄灯”亮, 完成后,如果成功则”绿灯”亮,且蜂鸣器长鸣一声, 否则”红灯” 亮,且蜂鸣器短鸣 10 声.
- 10 -

8051_芯片手册

8051_芯片手册

8051芯片手册目录1 NL06F86 芯片概述 (1)1.1结构框图 (1)1.2NL06F86 性能 (1)1.3外设连接示意图 (4)1.4管脚定义 (5)1.5NL06F86 最小系统 (18)1.6部分管脚的配臵电路 (18)2 内存映射 (20)3 CPU内核 (23)3.1概述 (23)3.2CPU编程模型 (24)3.3处理器寻址方式 (28)3.4CPU指令集 (32)3.5MMU和Cache (48)4 外设功能 (61)4.1 功能综述 (61)4.2 所有寄存器列表 (62)4.3 外设使用说明 (71)4.4 编程实例 (71)5 程序起动描述 (73)6 存储器控制器 (74)6.2 寄存器表 (74)6.3 寄存器功能描述 (74)6.4 模块管脚描述 (76)6.5 典型电路 (80)6.6 编程实例 (81)7 中断控制器 (83)7.1 功能综述 (83)7.2 寄存器表 (84)7.3 寄存器功能描述 (84)7.4 编程实例 (86)8 定时器 (88)8.1 功能综述 (88)8.2 寄存器表 (88)8.3 寄存器功能描述 (89)8.4 编程实例 (90)9 通用I/O (91)9.1 功能综述 (91)9.2 寄存器表 (91)9.3 寄存器功能描述 (93)9.4 编程实例 (96)10 HW控制器 (98)10.1 功能综述 (98)10.2 寄存器表 (98)10.4 编程实例 (99)11 以太网MAC控制器 (100)11.1 功能综述 (100)11.2 寄存器表 (100)11.3 寄存器功能描述 (101)11.4 模块管脚描述 (106)11.5 典型电路 (107)11.6 编程实例 (107)12 通用异步收发器UARTs (112)12.1 功能综述 (112)12.2 UART寄存器表 (112)12.3 寄存器功能描述 (113)12.4 模块管脚描述 (117)12.5 编程实例 (118)13 I2C总线接口 (122)13.1 功能综述 (122)13.2 寄存器表 (122)13.3 寄存器功能描述 (122)13.4 时序波形图 (123)13.5 模块管脚描述 (125)13.6 典型电路 (125)13.7 编程实例 (126)14 低速外设接口 (128)14.2 寄存器表 (128)14.3 寄存器功能描述 (128)14.4 模块管脚描述 (130)14.5 典型电路 (131)14.6 编程实例 (132)15 显示接口 (134)15.1 功能总述 (134)15.2 寄存器表 (134)15.3 寄存器功能描述 (136)15.4 模块管脚描述 (143)15.5 典型电路 (144)15.6 编程实例 (145)16 磁卡接口 (149)16.1 功能综述 (149)16.2 寄存器表 (149)16.3 寄存器功能描述 (149)16.4 模块管脚描述 (151)16.5 编程实例 (151)17 IC卡接口 (153)17.1 功能综述 (153)17.2 寄存器表 (153)17.3 寄存器功能描述 (154)17.4 模块管脚描述 (156)17.6 编程实例 (157)18 打印机接口 (159)18.1 功能综述 (159)18.2 寄存器表 (159)18.3 寄存器功能描述 (159)18.4 模块管脚描述 (161)18.5 典型电路 (162)18.6 编程实例 (162)19 PC键盘接口 (164)19.1 功能综述 (164)19.2 寄存器表 (164)19.3 寄存器功能描述 (164)19.4 模块管脚描述 (165)19.5 数据格式和时序图 (166)19.6 典型电路 (166)19.7 编程实例 (167)20 PWM接口 (169)20.1 功能综述 (169)20.2 寄存器表 (169)20.3 寄存器功能描述 (170)20.4 模块管脚描述 (171)20.5 典型电路 (171)20.6 编程实例 (172)21 蜂鸣器 (173)21.1 功能综述 (173)21.2 寄存器表 (173)21.3 寄存器功能描述 (173)21.4 模块管脚描述 (174)21.5 典型电路 (174)21.6 编程实例 (175)22 DES控制器 (176)22.1 功能综述 (176)22.2 寄存器表 (176)22.3 寄存器功能描述 (176)22.4 编程实例 (177)23 封装尺寸 (179)1. 8051 芯片概述8051微控制器属于MCS-51系列,自其1980年由Inter公司设计以来,由于其完善的指令集,在嵌入式系统应用中占有很大的市场。

MC51F8124 用户手册说明书

MC51F8124 用户手册说明书

MC51F8124晟矽微电本公司保留对以下所有产品在可靠性、功能和设计方面的改进作进一步说明的权利。

MC51F8124 用户手册 V1.7 8位增强型8051单片机主要特性CORE✧ 1T 高速增强型8051内核 ✧ 双DPTR ROM✧ 片上16K 字节 FLASH ,擦写10万次以上✧ 片上1024字节 E2(EEPROM),擦写10万次以上 ✧ 支持代码分区保护功能(有效防止非法读/写/擦) ✧ 支持FLASH 和E2在电路编程(ICP ), 支持E2在应用编程(IAP ) RAM✧ 片上1536(256+1280)字节 SRAM 时钟源✧ 片上高精度32MHz 高速振荡器(常温5.0V 电压下±1%精度;全工作条件下±5%精度)✧ 片上32KHz 超低功耗低速振荡器,供看门狗定时器和T3使用✧ 外部可选接32768Hz 晶体振荡器 电源管理模式✧ 4种工作模式:高速/低速/停止/休眠✧ 增加高级能耗控制功能,满足用户低功耗的需求 复位✧ 上电复位(POR )/外部复位/低电压复位(LVR )/看门狗复位/软件复位✧ LVR 电压4级可选:2.1V 、2.5V 、3.5V 、4.1V ✧ 看门狗复位可选8种溢出时间 I/O✧ 最多26个双向通用I/O 口(28PIN 封装下) ✧ 支持3种输入/输出模式,支持输入上拉电阻配置 ✧ 14个IO 具备独立大电流驱动能力✧ 24个I/O 可软件模拟成1/2 BIAS 的LCD COM 口 定时器/计数器✧ 2个16位T0/T1定时器,兼容标准8051✧ 1个16位增强型T2定时器,兼容8052的T2,带输入捕获和输出比较功能 ✧ 1个16位T3时基定时器,可连接外部32768Hz 晶振,在停止/休眠模式下可定时唤醒 PWM 定时器✧ 1路独立8位PWM0,可作通用定时器✧ 3组共6路16位PWM1阵列,可互补输出且死区时间可调,并具有故障保护中断功能✧ PWM1可在选片上高速时钟或其分频下独立工作 12位高精度ADC✧ 12位高精度逐次逼近型ADC✧ 14通道:外部12通道+内部2通道✧ 参考电压可选:内部2.0V 、VDD 、Vref 引脚输入 2路UART✧ 2路UART 模块,可兼容8051标准✧ 增强UART0支持“帧出错”检测及自动地址识别 ✧ 支持8位同步半双工、8位/9位异步全双工等4种工作方式 SPI✧ 支持全双工,3线/4线同步模式,主/从机可选 ✧ 支持主机模式错误用以防止主机冲突 TK 触摸按键✧ 最大支持16通道的高灵敏触摸按键✧ 支持4MHz/2MHz/1MHz/500KHz 四种工作频率 ✧ 支持可选基准电压,支持触摸按键扫描中断,支持触摸按键唤醒 中断✧ INT0X 、T0、INT1X 、T1、UART0、TK 、ADC 、T2、SPI 、PWM1、PWM0、PWM1FB 、UART1、CRC 、T3共15个中断源 ✧ 2级中断优先级可设 ✧ 其中INTnx (n=0~1,x=0~4)支持多重映射输入,5选1分别对应两个中断源(INT0x/INT1x );支持上升沿触发方式和高电平脉宽测量功能 循环冗余校验算法模块(符合CRC-16标准) 双两线调试与编程接口✧ 两组调试和编程接口任意二选一,支持自动识别 开发工具兼容KEIL TM 集成开发环境 工作电压✧ 2.0V ~5.5V 工作环境温度 ✧ -40℃~85℃ 封装形式 ✧ SOP28、SSOP28、SOP24、SSOP24、SOP20、TSSOP201T 8051内核FLASH 型MCU ,16KB FLASH ROM ,1536B SRAM ,1KB 独立EEPROM ,12位高速ADC ,16通道高灵敏触摸电路,6通道16位PWM ,8位PWM ,4个16位定时器,2路UART ,SPI ,CRC ,双两线调试1产品简介1.1概述本产品是一款高速低功耗1T周期8051内核8位增强型FLASH微控制器芯片,较传统8051相比,运行效率更高。

硅科 C8051F32x 开发套件用户手册说明书

硅科 C8051F32x 开发套件用户手册说明书

Rev. 0.9 2/14Copyright © 2014 by Silicon LaboratoriesC8051F32xX EVELOPMENT IT SER S UIDE1. Kit ContentsThe C8051F32x Development Kit contains the following items:•C8051F320 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 AdapterNote:The C8051F320 target board has the ability to be powered through the USB cable. To enable the USB-powered mode,move the shorting block located at header J2 to header J11.PWRP1.6C8051F32x3. 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 C8051F320 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 C8051F32x family by checking the C8051F32x 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.C8051F32x3.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 C8051F320 Development Kit , in the Part drop-down, select C8051F320, and in the SDK drop-down, select the desired SDK. Click Next .4. Select Example and click Next .5. Under C8051F320 Development Kit in the Blinky folder, select F320-1 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 .C8051F32x3.3. Legacy 8-bit IDENote:Using the Simplicity Studio tools with the C8051F320 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 C8051F32x devices. After installation, examples can be found in ...\Examples\C8051F320_1 in the installation directory. At a minimum, the C8051F320 DK requires:⏹ Silicon Labs IDE —Software enabling initial evaluation, development, and debugging.⏹ Configuration Wizard 2—Initialization code generation software for the C8051F32x 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 requiredC8051F32xinformation.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.C8051F32x4. Target BoardThe C8051F32x Development Kit includes a target board with a C8051F320 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 36-pin Expansion I/O connectorJ2Power Target Board from power adapterJ3Port I/O Configuration ConnectorJ4DEBUG connector for Debug Adapter interfaceJ5 DB-9 connector for UART0 RS232 interfaceJ6 Analog I/O terminal blockJ7Low pass filter connectorJ8USB Debug Adapter target board power connectorJ9, J10 External crystal enable connectorsJ11Power Target Board from USBJ12Connects external capacitance to P0.7J13 Connects R14 Potentiometer to P1.7J14USB connector for USB interfaceFigure4.C8051F320 Target BoardC8051F32x4.1. System Clock SourcesThe C8051F320 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 1.5MHz (±1.5%) 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 C8051F320 device at a frequency not available with the internal oscillator, an external crystal may be used. Refer to the C8051F32x 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 J10 and install the crystal at the pads marked Y1. Install a 10MΩ resistor at R9 and install capacitors at C14 and C15 using values appropriate for the crystal you select. Refer to the C8051F32x data sheet for more information on the use of external oscillators.4.2. Switches and LEDsThree switches are provided on the target board. Switch SW1 is connected to the RESET pin of the C8051F320. Pressing SW1 puts the device into its hardware-reset state. Switch SW2 and SW3 are connected to the C8051F320’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 blocks from the header to disconnect SW2 and SW3 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 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 C8051F320’s GPIO pins through headers. Remove the shorting blocks from the header to disconnect the LEDs from the port pin. 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.Also included on the C8051F320 target board is a 10KΩ Thumb-Wheel Rotary Potentiometer, part number R14. The Potentiometer is connected to the C8051F320’s GPIO pin through a header. Remove the shorting block from the header to disconnect the Potentiometer from the port pin. The port pin signal is also routed to a pin on the J1 I/ O connector. See Table1 for the port pin and header corresponding to the Potentiometer.Table 1. Target Board I/O DescriptionsDescription I/O HeaderSW1Reset noneSW2P2.0J3[1–2]SW3P2.1J3[3–4]Green LED P2.2J3[5–6]Green LED P2.3J3[7–8]Red LED PWR nonePotentiometer R14J13C8051F32x4.3. Universal Serial Bus (USB) Interface (J14)A Universal Serial Bus (USB) connector (J14) is provided to facilitate connections to the USB interface on the C8051F320. Table2 shows the J14 pin definitions.Table 2. USB Connector Pin DescriptionsPin #Description1VBUS2D-3D+4GND (Ground)4.4. Expansion I/O Connector (J1)The 32-pin Expansion I/O connector J1 provides access to all signal pins of the C8051F320 device. Pins for +3V, digital ground and the output of an on-board low-pass filter are also available. 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 J1 and the prototyping area (see Figure4 on page6). Each connection point is labeled indicating the signal available at the connection point. See Table3 for a list of pin descriptions for J1.Table 3. J1 Pin DescriptionsPin #Description Pin #Description Pin #Description1+3VD(+3.3VDC)13P1.225P2.62PWM Output14P1.326P2.73P0.015P1.427P3.04P0.116P1.528/RST (Reset)5P0.217P1.629VREGIN6P0.318P1.730VDD7P0.419P2.031VBUS8P0.520P2.132GND (Ground)9P0.621P2.210P0.722P2.311P1.023P2.412P1.124P2.54.5. USB Self-Powered Configuration (J2, J11)The C8051F320 target board can be configured as a self-powered USB device to take power from the USB cable instead of the ac/dc adapter connected at P1. To configure the target boards as a self-powered USB device, remove the shorting block from J2 and install on J11. (A shorting block should only be installed on J2 or J11, never both at the same time.) Install shorting blocks in the following manner:J2(ON) & J11(OFF) →Target Board is powered from the ac/dc Adapter at P1.J2(OFF) & J11(ON) →Target Board is powered from the USB connectionNote: When the C8051F320 target board is self-powered from the USB, the Serial Adapter is not powered from the target board. The Serial Adapter must be powered directly by connecting the ac/dc adapter to the Serial Adapters’dc power jack. Also, the RS232 Serial Interface (J5) cannot be used when powering the target board from the USB.C8051F32x4.6. Target Board DEBUG Interface (J4)The DEBUG connector (J4) provides access to the DEBUG (C2) pins of the C8051F320. It is used to connect the Serial Adapter or the USB Debug Adapter to the target board for in-circuit debugging and Flash programming. Table4 shows the DEBUG pin definitions.Table 4. DEBUG Connector Pin DescriptionsPin #Description1+3VD(+3.3VDC)2, 3, 9GND (Ground)4C2D5/RST(Reset)6P3.07C2CK8Not Connected10USB Power4.7. 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 C8051F320. 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.J3[9-10]- Install shorting block to connect UART0 TX (P0.4) to transceiver.J3[11-12]- Install shorting block to connect UART0 RX (P0.5) to transceiver.J3[13-14]- Install shorting block to connect UART0 RTS (P2.6) to transceiver.J3[15-16]- Install shorting block to connect UART0 CTS (P2.7) to transceiver.4.8. Analog I/O (J6)Several of the C8051F320 target device’s port pins are connected to the J6 terminal block. Refer to Table5 for the J6 terminal block connections.Table 5. J6 Terminal Block Pin DescriptionsPin #Description1P2.5 / AIN2.52P2.4 / AIN2.43GND (Ground)4P0.7 / Vref (Voltage Reference)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. Please note that the second option is not supported with either the EC1 or EC2 Serial Adapters.4.10. Low-Pass Filter (J7)The C8051F320 target board features a low-pass filter that may be connected to port pin P2.4. Install a shorting block on J7[1-2] to connect the P2.4 pin of the target device to the low-pass filter input. The output of the low-pass filter is routed to the PWM signal at J1[2]. The C8051F320 may be programmed to generate a PWM (Pulse-Width Modulated) waveform which is then input to the low-pass filter to implement a user-controlled PWM digital-to-analog converter. Refer to Applications Note AN107 - Implementing 16-Bit PWM Using the PCA for a discussion on generating a programmable dc voltage level with a PWM waveform and low-pass filter.C8051F32xC8051F32x D OCUMENT C HANGE L ISTRevision 0.6 to Revision 0.7⏹ 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.⏹ Section 7, J8, changed "Serial Adapter" to "USB Debug Adapter"⏹ DEBUG Connector Pin Descriptions Table, changed pin 10 to USB Power⏹ USB Debug Adapter Target Board Power Connector (J8) Section, changed "Serial" to "USB Debug" Revision 0.7 to Revision 0.8⏹ 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.Revision 0.8 to Revision 0.9⏹ 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 ChavezAustin, TX 78701USAIoT Portfolio/IoT SW/HW /simplicity Quality /quality Support and Community 。

C8051F开发板用户手册

C8051F开发板用户手册

2
亿和电子工作室出品
C8051F-DK
目录 1. 背景简述......................................................................................................................................5 1.1. 亿和 C8051F 实验仪简介................................................................................................5 1.2. C8051F 单片机的优势..................................................................................................... 5 1.3. 实验仪用途...................................................................................................................... 6 2. 准备工作..................................................................................................................................... 6 2.1. 相关软件介绍........................................................................................................

新华龙单片机C8051F410学习板使用手册

新华龙单片机C8051F410学习板使用手册

目录一、学习板概括 (1)二、准备工作 (1)三、学习板硬件介绍 (3)四、实验程序 (5)实验一、跑马灯 (5)实验二、独立按键 (6)实验三、继电器控制 (7)实验四、P2口驱动数码管 (8)实验五、定时器 (10)实验六、99S倒计时 (10)实验七、TM1668 (11)实验八、AD采样模数转换+TM1668 (17)实验九、串口通信 (18)实验十、ADC+UART (19)实验十一、1602液晶显示 (19)实验十二、8Bit PWM输出 (21)实验十三、单线温度传感器18B20 (21)一、学习板概括:本手册适用于江南晶创科技推出的C8051F410单片机学习板、开发板第二版(V2.0)。

C8051F410单片机学习板由江南科技创办人朱发旺、陈家乐及其团队设计,版权归其所有!淘宝旗舰店(直销店),QQ交流群:112481187。

该学习板主控制芯片使用了新华龙(Silicon)单片机c8051f410。

配套JTAG 仿真器编程器U-EC5,该仿真器可以对C8051F大部分系列单片机进行仿真、调试、单步、烧录、下载、加密等操作。

学习板采用模块化设计,尽量做到各功能模块完全独立,互不干扰,减小初学者编程误区。

使是初学者可快速了解主板硬件电路的结构,尽快熟悉硬件电路,快速入门。

此外由于各模块可独立工作,所有引脚均已使用标准接口外扩,所以可以将模块用于其他场合,大大增加开发板的用途!二、准备工作:1、软件安装(1)本学习板配套的所有演示程序均使用C语言编辑,编写软件为Keil 51(Uvision4),推荐大家也是用此软件编程;(2)程序下载(烧写)软件使用的是U-EC5中文下载程序;(3)JTAG U-EC5 驱动程序,部分电脑系统可自动安装;注:以上软件均支持windows Xp/win7 32/64,JTAG仿真器支持USB2.0。

2、硬件连接使用C8051F410单片机学习板,需要USB MiNi接口数据线一根、IDC10芯下载线一根、JTAG(EC-3/5)仿真器一个、C8051F410单片机学习板主板一块。

8051系列单片机C程序设计完全手册

8051系列单片机C程序设计完全手册

8051系列单片机C程序设计完全手册(实事求是编著)目录第1章单片机基础1.1 单片机技术发展状况1.2 51系列单片机体系结构1.2.1 内部结构1.2.2 存储器组织结构l.2.3 内部功能模块l.2.4 外部引脚1.2.5 系统资源扩展1.3 单片机的编程方法第2章 C语言编程基础2.1 基本概念2.1.1 概述2.1.2 变量与算术表达式2.1.3 for语句2.1.4 符号常量2.2 数据类型、运算符和表达式2.2.1 C语言的数据类型2.2.2 常量与变量2.2.3 整型数据2.2.4 实型数据2.2.5 字符型数据2.2.6 运算符2.2.7 表达式2.3 程序控制语句2.3.1 程序的3种基本结构2.3.2 条件控制语句2.3.3 程序应用举例2.4 循环控制语句2.4.1 while语句2.4.2 dowhile语句2.4.3 for语句2.4.4 break与continue语句2.4.5 程序应用举例2.5 小结第3章 C语言高级编程3.1 函数与程序结构3.1.1 函数的基本知识3.1.2 返回非整数值的函数3.1.3 外部变量3.1.4 作用域规则3.1.5 头文件3.1.6 静态变量3.1.7 寄存器变量3.1.8 分程序结构3.1.9 初始化3.1.10 递归3.2 数组3.2.1 一维数组3.2.2 维数组3.2.3 多维数组3.2.4 数组的初始化3.3 指针3.3.1 指针与指针变量.3.3.2 指针变量的定义与引用3.3.3 指针运算符与指针表达式3.3.4 指针与数组3.3.5 指针的地址分配3.3.6 指针数组3.3.7 指向指针的指针3.4 占构体与共用体3.4.1 结构体类型变量的定义和引用3.4.2 结构体数组的定义和引用3.4.3 结构体指针的定义和引用3.4.4 共用体3.5 小结第4章C51程序设计4.1 C51对标准C语言的扩展4.1.1 存储区域4.1.2 数据变量分类4.1.3 存储器模式4.1.4 绝对地址的访问4.1.5 指针4.1.6 函数4.2 C5 1函数库4.2.1 字符函数CTYPE.H4.2.2 一般I/O函数STDIO.H4.2.3 字符串函数STRING.H4.2.4 标准函数STDLIB.H4.2.5 数学函数MATH.H4.2.6 绝对地址访问ABSACC.H4.2.7 内部函数INTRINS.H4.2.8 变量参数表STDARG.H4.2.9 全程跳转SETJMPH4.2.10 访问SFR和SFR bit地址REGxxx.H4.3 C51程序编写4.3.1 C程序基本结构4.3.2 编写高效的C51程序及优化程序第5章 Windows集成开发环境μVision25.1 μVision2编辑界面及其功能介绍5.1.1 μVision2界面综述5.1.2 主菜单栏5.1.3 μVision2功能按钮5.1.4 μVision2窗口环境5.2 应用μVision2开发流程介绍5.2.1 建立新项目5.2.2 常用环境配置5.2.3 代码优化5.2.4 目标代码调试5.3 CPU仿真5.3.1 μVision2调试器5.3.2 调试命令5.3.3 存储器空间5.3.4 表述(Expressions)5.3.5 技巧5.4 深入了解μVision25.4.1 μVision2的项目管理5.4.2 使用技巧5.4.3 μVision2调试函数第6章 C5l编译器6.1 预处理6.1.1 宏定义6.1.2 文件包含6.1.3 条件编译6.1.4 其他预处理命令6.2 C51编译器控制指令详解6.2.1 源控制指令6.2.2 列表控制指令6.2.3 目标控制指令6.3 C5l的高级配置文件6.3.1 目标程序启动配置文件——STARTUP.A51.6.3.2 CPU初始化文件——START751.A516.3.3 静态变量初始化文件——INT.A516.3.4 专用变量初始化文件——INIT751.A51第7章 C51的典型资源编程7.1 中断系统设计7.2 定时/计数器的使用7.3 I/O口的使用7.4 扩展存储器7.4.1 外部ROM7.4.2 外部RAM7.4.3 外部串行E2PROM7.5 一个使用多种资源的完整例程7.5.1 项目需求7.5.2 步进电机背景知识7.5.3 解决方案设计与实现第8章单片机通信8.1 串口通信8.1.1 串行通信基础8.1.2 单片机串口使用8.2 单片机点对点通信8.2.1 通信接口设计8.2.2 单片机点对点通信程序设计8.3 单片机多机通信8.3.1 主机部分通信程序设计8.3.2 从机部分通信程序设计8.4 单片机I2C总线通信8.4.1 I2C总线介绍8.4.2 I2C总线硬件接口设计8.4.3 I2C总线模拟硬件接口软件设计8.4.4 I2C总线系统的设计要点8.5 单片机与计算机的互连8.5.1 电路设计8.5.2电路的C5 1程序代码8.5.3计算机端的Visual C++程序代码第9章 C51单片机的工程开发实例9.1 单片机系统设计方法9.2 C51系统设计的相关知识9.2.1 硬件以及电路的知识9.2.2 软件以及编程语言的知识9.3 C5l系统设计需要注意的一些问题9.3.1 单片机资源的分配9.3.2 单片机的寻址9.3.3 C5 1函数的返回值9.3.4 单片机的看门狗功能9.3.5 单片机的外设9.3.6 单片机的功耗9.4 有关C51的一些问题9.5 键盘和发光数码管显示9.5.1 电路设计的背景及功能9.5.2 电路的设计9.5.3 键盘扫描电路的C51程序代码9.5.4 电路的改进——键盘的消抖动程序9.5.5 电路的显示部分-LED数码管电路9.6 A/D、D/A转换器使用9.6.1 电路设计的背景及功能9.6.2 电路的设计9.6.3 电路的C51程序代码9.7 基于单片机的数字钟9.7.1 电路设计的背景及功能9.7.2 电路的设计9.7.3 电路的C51程序代码第10章 C5l单片机典型模块实例10.1 典型外部ROM和RAM器件的使用10.1.1 实例功能10.1.2 器件和原理10.1.3 电路10.1.4 程序设计10.2 液晶显示和驱动实例10.2.1 实例功能10.2.2 器件和原理10.2.3 电路lO.2.4 程序设计10.3 用A/D芯片进行电压测量10.3.1 实例功能10.3.2 器件和原理10.3.3 电路10.3.4 程序设计lO.4 使用DSl820进行温度补偿和测量10.4.1 实例功能10.4.2 器件和原理10.4.3 电路10.4.4 程序设计10.5 语音芯片在单片机系统中的使用10.5.1 实例功能10.5.2 器件和原理10.5.3 电路10.5.4 程序设计10.6 时钟芯片在单片机系统中的应用10.6.1 实例功能10.6.2 器件和原理10.6.3 电路10.6.4 程序设计10.7 单片机中滤波算法的实现10.8 信号数据的FFT变换。

8051单片机教程

8051单片机教程

8051单片机教程实验一:扩展存储器读写实验一.实验要求编制简单程序,对实验板上提供的外部存贮器(62256)进行读写操作。

二.实验目的1.学习片外存储器扩展方法。

2.学习数据存储器不同的读写方法。

三.实验电路及连线将P1.0接至L1。

CS256连GND孔。

四.实验说明1.单片机系统中,对片外存贮器的读写操作是最基本的操作。

用户藉此来熟悉MCS51单片机编程的基本规则、基本指令的使用和使用本仿真实验系统调试程序的方法。

用户编程可以参考示例程序和流程框图。

本示例程序中对片外存贮器中一固定地址单元进行读写操作,并比较读写结果是否一致。

不一致则说明读写操作不可靠或该存储器单元不可靠,程序转入出错处理代码段(本示例程序通过熄灭一个发光二极管来表示出错)。

读写数据的选用,本例采用的是55(0101,0101)与AA(1010,1010)。

一般采用这两个数据的读写操作就可查出数据总线的短路、断路等,在实际调试用户电路时非常有效。

用户调试该程序时,可以灵活使用单步、断点和变量观察等方法,来观察程序执行的流程和各中间变量的值。

2.在I状态下执行MEM1程序,对实验机数据进行读写,若L1灯亮说明RAM读写正常。

3.也可进入LCA51的调试工具菜单中的对话窗口,用监控命令方式读写RAM,在I状态执行SX0000↓ 55,SPACE,屏幕上应显示55,再键入AA,SPACE,屏幕上也应显示AA,以上过程执行效果与编程执行效果完全相同。

注:SX是实验机对外部数据空间读写命令。

4.本例中,62256片选接地时,存储器空间为0000~7FFFH。

五.实验程序框图实验示例程序流程框图如下:六.实验源程序:ORG 0000HLJMP STARTORG 0040HSTART:MOV SP,#60HMOV DPTR,#0000H ;置外部RAM读写地址MOV A,#55H ;测试的数据一MOV B,AMOVX @DPTR,A ;写外部RAMMOVX A,@DPTR ;读外部RAMXRL A,B ;比较读回的数据JNZ ERRORMOV A,#0AAH ;测试的数据二MOV B,AMOVX @DPTR,AMOVX A,@DPTRXRL A,BJZ PASS ;测试通过ERROR: SETB P1.0 ;测试失败,点亮LED SJMP $PASS: CPL P1.0 ;LED状态(亮/灭)转换MOV R1,#00H ;延时DELAY: MOV R2,#00HDJNZ R2,$DJNZ R1,DELAYLJMP START ;循环测试END实验二P1口输入、输出实验一.实验要求1.P1口做输出口,接八只发光二极管,编写程序,使发光二极管循环点亮。

8051OCDICEUserManual

8051OCDICEUserManual

Megawin 8051 OCD ICE 使用说明书(中文版)内容1 介绍 (3)特色 (3)描述 (3)2 硬件配置 (4)3 软件设定 (5)3.1 安装ICE转接器的驱动程序 (5)3.2 新增Megawin芯片的数据到Keil 8051 IDE (5)4 Keil IDE设定 (6)4.1 Device选项 (7)4.2 Target选项 (7)4.3 Output选项 (8)4.4 C51选项 (8)4.5 Debug选项 (9)4.6 Utilities 选项 (10)5 开始调试 (11)5.1 启动dScope-Debugger功能 (11)5.2 介绍调试环境 (12)5.2.1 复位(Reset)/执行(Run)/停止(Halt)/单步(Step)/执行到某行(Run-to-Cursor) (13)5.2.2 原始码等级(Source-Level)的调试 (13)5.2.3 设定断点 (14)5.2.4 显示/编辑外围寄存器的内容 (15)5.2.5 检视反编译窗口 (16)5.2.6 检视查看窗口 (17)5.2.7 检视内存窗口 (18)6 注意事项 (19)6.1 寄存器定义文件 (19)6.2 内建XRAM及外部数据存储器 (19)6.3 程序代码优化及原始码调试 (20)6.4 for循环的原始码调试 (21)6.5 使用调试时的硬件选项要求 (21)6.6 错误讯息 (22)6.7 正确的连接ICE转接器到计算机 (23)修订记录 (24)1 介绍特色z笙泉专利的OCD(On-Chip-Debug) 技术z MCU内建实时调试z独立的两双接脚串行接口,不占用系统的接脚z直接兼容于Keil的8051 IDE调试仿真接口z使用USB连接计算机于系统z强大的调试动作:复位、全速执行、暂停、单步执行…等等z可程序化的中断,可以同时插入四个中断z多个有用的调试窗口:寄存器/反编译/监看变量/内存窗口描述这个全新的”Megawin 8051 OCD ICE”对8051嵌入式系统来说是一个强而有力的开发工具。

8051_ISP(U2)编程器说明书

8051_ISP(U2)编程器说明书

8051 ISP(U2) 烧录器用户指南V7.03目录1简介 (2)2使用ISP功能前必须的芯片配置 (3)3安装ISP(U2)烧录器 (4)3.1安装驱动程序 (4)3.2安装应用程序 (4)4使用ISP(U2)烧录器 (5)4.1下载烧录数据到ISP(U2)烧录器 (5)4.1.1步骤一:选择你要的“单片机型号” (5)4.1.2步骤二:点击“载入文件”,HEX和BIN,MPJ格式都可以。

(5)4.1.3步骤三:配置硬件选项(仅MPC89/MG82系列有效) (6)4.1.4步骤四:“设置脱机模式” (8)4.2更新目标芯片 (9)4.2.1方法一: 点击“更新目标芯片”进行联机更新 (9)4.2.1方法二: 按烧录器的“开始按键”进行脱机更新 (9)4.3读取信息区的内容 (9)4.3.1步骤一:选择你要的“单片机型号” (9)4.3.2步骤二:点击“读取信息区”,来读取内容 (9)4.4笙泉项目文件(MPJ文件) (10)4.4.1保存一个MPJ文件 (10)4.4.2加载一个MPJ文件 (11)5信息区域 (12)5.1信息区域的设定 (12)5.2读取信息区域的内容 (13)6特別注意 (14)7关于信息 (15)8关于自动重载代码 (17)9版本历史 (18)1 简介ISP 是”I n-S ystem P rogramming ”的缩写。

可使用户通过软件来更新用户程序,而不必从产品中取下芯片来。

”8051 ISP(U2) 烧录器”工具(见下图)。

因为可以将用户程序存储到烧录器里的非易失性记忆体里,所以这烧录器可以进行脱机烧录(不用连接到电脑), 非常适用与没有电脑的地方。

8051 ISP 烧录器图片8051 U2 烧录器图片绿灯 开始按键 红灯 12 34ISP 接口 4: 不接 3: VCC 2: DTA 1: GND USB 灯 USB 接口2使用ISP功能前必须的芯片配置为了能使用ISP功能,用户应当在“Megawin 8051 Writer”或“Megawin 8051 Writer U1”里使用“插入ISP代码”来配置目标MCU,并且设置ISP 空间为1KB(对于MPC82L(E)54是1.5KB)和确认HWBS 或HWBS2选项使能注意:为了用户更容易使用ISP功能,笙泉8051系列MCU在出厂时已经做下列出厂设置,即:1)ISP空间设置成1K(或1.5K),并且”HWBS”选项使能2)预烧录笙泉提供的标准ISP-code.因此,用户不必在使用ISP功能之前对芯片进行配置****更多信息请联系笙泉3安装ISP(U2)烧录器3.1安装驱动程序将ISP(U2) 烧录器连接到电脑的USB口,当电脑弹出提示框显示发现新硬件时,按以下步骤操作。

MCS-51单片机综合实验台指导说明书(学生用书)

MCS-51单片机综合实验台指导说明书(学生用书)

第一章系统介绍一.系统特点EL-MUL-III型单片机教学实验系统是北京精仪达盛科技有限公司根据广大学者和许多高等院校实验需求,结合电子发展情况而研制的具有开发,使用,实验相结合的高科技实验设备。

旨在尽快提高我国电子科技发展水平,提高实验者手动能力,分析解决问题能力。

系统具有以下特点:1. CPU可选用80C31,系统功能齐全,涵盖了单片机教学实验课程的大部分内容。

2.系统采用开放式模块化结构设计,通过两组相对独立的总线最多可同时扩展2块使用实验板,用户可根据需要购置相应实验板,降低了成本,提高了灵活性,便于升级换代。

3.配有两块可编程器件:EPM7128被系统占用。

另一块EPM70供用户实验用。

两块器件皆可通过JTAG接口在线编程。

使用十分方便。

4.灵活的电源接口:配有PC电源插座,可由PC提供电源。

另外还配有外接开关电源,提供所需的+5V,+12V,-12V,其输入为220V的交流电。

5.系统的联机运行模式:配有系统调试软件,为中文多窗口界面。

调试程序时可以同时打开寄存器窗口,内存窗口,变量窗口,反汇编窗口,波形显示窗口等等,极大地方便了用户的程序调试。

该软件集源程序编辑,编译,链接,调试和一体,每项功能均为中文下拉菜单,简明易学。

经常使用的功能均备有热键,这样可以提高程序的调试效率。

8051调试软件不仅支持汇编语言,而且还支持C语言编辑调试。

6.系统的单机运行模式:系统在没有和计算机连接的情况下,自动运行在单机模式,在此模式下,用户可通过键盘输入运行程序(机器码),和操作指令,同时将输入信息及操作的结果在LED 数码管上显示出来。

系统功能齐全,可扩展性强。

本实验系统不仅完全能满足教学大纲规定的基本接口芯片实验,其灵活性和扩展性(数据总线,地址总线,控制总线为用户开放)亦能轻松满足其课程设计,毕业设计使用等二.系统概述微处理器采用i80c31,它的P1口,P3口皆对用户开放,供用户使用。

时钟频率为6.0MHz。

MC8051+IPcore实验教程

MC8051+IPcore实验教程

关于本实验教程本教程内容力求以详细的步骤和讲解让读者以最快的方式学会MC8051 IP core的应用以及相关设计软件的使用,并激起读者对SOPC技术的兴趣。

本实验重点讲8051Core的应用,并通过一个简单C51程序对51Core进行硬件测试。

本实验教程的内容编排如下:第1章简单的描述了MC8051 IP core的基本结构及一些应用说明。

第2章详细的介绍8051Core综合、编译应用。

包括Quartus II、Synplify Pro软件的基本应用,ROM、RAM模块的生成,8051Core的封装及应用测试。

附录A为MC8051 IP Core的指令集。

在阅读本教程的过程中,请读者注意以下几点:本教程在写作过程中遵循“宁可啰唆一点,也不放过细节”的方针。

在教程中的某些地方,有些读者可能觉得很“简单”,甚至显得有些啰唆,但对大多数初学者可能并非如此。

因为作者认为,足够简单甚至可以跳过的内容,对某些读者来说,未必能一下子就弄清楚,所以,本教程很多地方将尽量阐述清楚,以节省读者理解的时间。

但在后面的章节中,如果涉及的细节在前面章节中已经提及,这些内容就会省略。

最后作者要强调的是,本教程旨在引路,不会带领读者掌握更深层次的开发,更高级的应用希望读者自己去挖掘。

本实验教程的MC8051 IP Core (V1.4) 源于http://oregano.at/ip/8051.htm网站,读者如有需要可到该网站下载。

目录第1章MC8051的基本结构 (3)1.1 功能特点 (3)1.2 顶层结构 (3)1.3 设计层次 (4)1.4 硬件配置 (5)1.4.1 定时器/计数器、串口和中断 (5)1.4.2 可选择的指令 (7)1.5 并行I/O口 (7)1.6 其它说明 (8)第2章MC8051的硬件运行 (9)2.1 MC8051中ROM、RAM模块的生成 (9)2.1.1 建立Quartus II工程 (9)2.1.2 建立图形设计文件 (13)2.1.3 ROM和RAM模块的生成 (14)2.2 MC8051 core RTL的封装 (17)2.2.1 更新mc8051 core的顶层源文件 (17)2.2.2 使用Synplify新建综合工程 (20)2.2.3 设置综合工程 (23)2.2.4 综合工程文件 (24)2.3 MC8051 core 在Quartus II中的应用 (25)2.3.1 建立PLL数字锁相环模块 (25)2.3.2 mc8051 core在Quartus II中的应用设计 (28)2.3.3 FPGA参数设置 (30)2.3.4 下载硬件设计到目标FPGA (33)2.4 测试MC8051的I/O、UART和定时器功能 (33)2.4.1 Keil C测试程序 (33)2.4.2 测试步骤 (35)参考文献 (36)附录A MC8051指令表 (37)第1章MC8051的基本结构这一章将简单的介绍MC8051 IP Core的基本硬件结构和一些设计应用的注意事项,具体内容包括:1.功能特点2.顶层结构3.设计层次4.硬件配置5.并行I/O口6.其它说明本章介绍的内容可能过于简略,如果要更详细的资料可参考mc8051_user_guide.pdf文档(位于:“MC8051_IPcore\相关参考资料”文件夹里面)。

Megawin 8051 OCD ICE使用说明书(中文版)

Megawin 8051 OCD ICE使用说明书(中文版)

Megawin 8051 OCD ICE 使用說明書(中文版)內容1 介紹 (3)特色 (3)描述 (3)2 硬體設定 (4)3 軟體設定 (5)3.1 安裝ICE轉接器的驅動程式 (5)3.2 新增Megawin晶片的資料到Keil 8051 IDE (5)4 Keil IDE設定 (6)4.1 Device選項 (7)4.2 Target選項 (7)4.3 Output選項 (8)4.4 C51選項 (8)4.5 Debug選項 (9)4.6 Utilities 選項 (10)5 開始除錯 (11)5.1 啟動dScope-Debugger功能 (11)5.2 介紹除錯環境 (12)5.2.1 重置(Reset)/執行(Run)/停止(Halt)/單步(Step)/執行到某行(Run-to-Cursor) (13)5.2.2 原始碼等級(Source-Level)的除錯 (13)5.2.3 設定中斷點 (14)5.2.4 顯示/編輯週邊暫存器的內容 (15)5.2.5 檢視反組譯視窗 (16)5.2.6 檢視查看視窗 (17)5.2.7 檢視記憶體視窗 (18)6 注意事項 (19)6.1 暫存器定義檔 (19)6.2 內建XRAM及外部資料記憶體 (19)6.3 程式碼最佳化及原始碼除錯 (20)6.4 for迴圈的原始碼除錯 (21)6.5 使用除錯時的硬體選項要求 (21)6.6 錯誤訊息 (22)6.7 正確的連接ICE轉接器到電腦 (23)修訂記錄 (24)1 介紹特色z笙泉專利的OCD(On-Chip-Debug) 技術z MCU內建即時除錯z獨立的兩雙接腳串列介面,不佔用系統的接腳z直接相容於Keil的8051 IDE除錯模擬介面z使用USB連接電腦於系統z強大的除錯動作:重置、全速執行、暫停、單步執行…等等z可程式化的中斷,可以同時插入四個中斷z多個有用的除錯視窗:暫存器/反組譯/監看變數/記憶體視窗描述這個全新的”Megawin 8051 OCD ICE”對8051嵌入式系統來說是一個強而有力的開發工具。

8051单片机手册

8051单片机手册

! 确定你的计算机系统符合最低配置要求 ! 将安装盘备份 系统要求
为了保证编译器和工具的正常工作 系统必须满足软件和硬件的最低配置
对 Windows 版工具 必须满足以下条件 ! 100 IBM 兼容 386 或以上 PC ! Windows3.1 版或以上 ! 至少 4M 内存 ! 硬盘至少有 6MB 磁盘空间 对 DOS 版工具 必须满足以下条件 ! 100 IBM 兼容 386 或以上 PC 带 640K 内存 ! MS-DOS3.1 版或以上 ! 硬盘至少有 6MB 磁盘空间 C 编译器及工具要求 CONFIG.SYS 文件中至少定义 20 个文件及 20 个缓冲区 环境空间供编译器和工具的环境变量使用 见 环境设置 章节
第一章 介绍
Keil 软件公司的 8051 单片机软件开发工具可用于众多的 8051 派生器件以实现嵌入式应用 开发 工具清单如下
! C51 优化 C 编译器 ! A51 宏汇编器 ! 8051 工具 连接器 目标文件转换器 库管理器 ! Windows 版 dScope 源程序级调试器/模拟器 ! Windows 版µVision 集成开发环境 这些工具都集合在一个套件内 见第三章 独立的工具在第四章详细介绍 除了以上的开发工具 以外 还提供实时内核 评估板和调试硬件 这些内容详见第六章和第七章的讲述 这套工具是为专 业软件开发者设计的 但任何水平的编程者都可使用 手册主题 该手册讨论了许多主题 包括 ! 将软件安装到系统并将其调整到最佳性能 见第二章 ! 为你的应用系统选择最佳工具套件 见第三章 ! 使用 8051 开发工具 见第四章 ! 运行演示程序 见第五章 如果想要马上开始使用 应当安装软件并运行演示程序 评估和演示套件 Keil 提供两套软件供用户对开发工具进行评估 C51 演示套件是开发工具的示范版本 演示套件中的工具并不产生实际的目标代码 而是产生列 表文件 可通过列表文件查看编译器和其它工具产生的代码 C51 评估套件是工具的评估版本 评估套件的工具可产生最大为 2K 的应用程序 可使用该套件评 估开发工具的效用 并可用于产生小型的目标应用系统

Megawin MA82G5Cxx 8051 MCU 数据手册说明书

Megawin MA82G5Cxx 8051 MCU 数据手册说明书

8051-Based MCUThis document contains information on a new product under development by Megawin. Megawin reserves the right to change or discontinue this product without notice.Megawin Technology Co., Ltd. 2015 All rights reserved. 2015/07 版本 0.24MA82G5Cxx 数据手册版本: 0.24特性●1-T 80C51 中央处理器●MA82G5C64 / MA82G5C32内含64K / 32K字节闪存━ISP 空间可以选择为0.5KB/1.0KB~7.5KB━灵活的 IAP 大小空间设置━密码保护程序区访问━Flash 写/擦次数: 10,000━Flash 数据保留时间: 100 年 25℃━MA82G5C64 默认空间配置AP 程序空间(60KB, 0000h~EFFFh)IAP 数据空间(2.5KB, F000h~F9FFh)ISP 引导码空间(1.5KB, FA00h~FFFFh)━MA82G5C32 默认空间配置AP 程序空间(29.5KB, 0000h~75FFh)IAP 数据空间(1KB, 7600h~79FFh)ISP 引导码空间(1.5KB, 7A00h~7FFFh)●数据存储器RAM: 4K/2K 字节━片内 256 字节高速缓存━3840 / 1792字节扩展 RAM (XRAM)●双数据指针●用于慢速SRAM/外设的可变长度的MOVX指令━MOVX指令支持16位数据读/写━无地址模式访问 (FIFO模式)●中断控制━24中断源,4级优先级━四个带滤波的外部中断, nINT0,nINT1, nINT2 和 nINT3━所有的外部中断支持高/低或上升/下降沿触发●MA82G5C64共有12个定时器━RTC 定时器和 WDT 定时器━定时器 0, 定时器1, 定时器2, 定时器3 and定时器4━S1BRG, S2BRG 和 S3BRG━PCA0 和PCA1━如果定时器2/3/4用于分割模式,则共有15 个定时器●五个16-位定时/计数,定时器0,定时器1,定时器2 ,定时器3和定时器4━X12模式和时钟输出功能━所有定时器都有同步运行使能(在停止和重载有同样的功能)━定时器2/3/4有新的4个操作模式,它们有着8个时钟源和8个捕捉源━定时器2/3/4 可以分割位两个8位定时器━时钟输出(CCO)在T2CKO, T3CKO 和 T4CKO━S1/S2/S3BRG 级联定时器1可以组成一个32/40位●两个可编程16位计数/定时阵列(PCA0 和 PCA1) 有着12个 CCP模块━每个PCA有6个CCP(捕获/比较/PWM)模块━可重载16位基准计数器支持可变长度的PWM━从片内CKM可获得高达100MHz的时钟来源━捕获模式, 16位软件定时器模式和高速输出模式━缓冲捕获模式可以监控窄脉冲输入input2MA82G5Cxx 数据手册MEGAWIN━8/10/12/16位可调PWM,带相位位移功能,可被配置成:最高6通道无缓冲16位PWM,或最高6通道带缓冲8位PWM,或最高3通道带缓冲16位PWM━PCA0 PWM 模块有死区控制,中断控制和中心对齐选项●键盘中断(P0/P2/P5/P3+P4)●10位单端ADC━可编程吞吐率到500Ksps━16个外部输入通道━ADC VREF+ 从外部输入●模拟比较器0━可编程片上比较电压,与模拟比较器1/2共享━ 4 个可选AIN0(+)输入━可唤醒掉电模式和IDLE模式━滤波选项和输出给内部定时器捕捉●模拟比较器 1/2━可唤醒掉电模式和IDLE模式━滤波选项和输出给内部定时器捕捉●增强型 UART (S0)━帧错误侦测━自动地址识别━速度增强机制 (X2/X4模式), 最大波特率可达7.3728/12.0MHz━模式4支持SPI主机,SPICLK速率可达12MHz●第2/第3/第4 UARTs (S1/S2/S3)━每个UART 都有专用的波特率发生器━S1 可以共享波特率给S0━每个模块都有8位定时器功能,叠加在定时器1可以组成一个32/40位定时器/计数器━最大 UART 波特率可达到1.8432/3.0MHz━模式4支持SPI主机,SPICLK速率可达12MHz━S1 在模式5下支持 LIN 总线协议━S1/S2/S3 在模式7下支持SCI (智能卡接口, ISO-7816)●一个主/从SPI串行接口━SPICLK速率可达12MHz━可用于四位外围接口(QPI)━8/16 位数据传送━包括S0~S3 的模式4就有5个主机●3个主/从两线串行接口: TWSI, TWI1 和 STWI (SID)━两个主/从硬件引擎: TWSI 和 TWI1━3个在TWSI/TWI1从机模式器件地址识别━用于STWI(软件TWI)的两线开始/停止串行信号侦测●可编程看门狗定时器,时钟来源为ILRCO━通过CPU或上电一次性使能━WDT溢出可中断 CPU 或复位 CPU━掉电模式(watch模式)下支持看门狗(WDT)功能,用于自动唤醒功能●实时时钟模块,时钟源来自XTAL或ILRCO━可编程中断周期从微秒到月━21-位长系统定时器●蜂鸣器功能MEGAWIN MA82G5Cxx 数据手册3●片上调试接口 (OCD)●在LQFP64封装中最大59 个通用输入输出口(GPIO)━P3可以设置成准双向口模式,推挽输出模式,开漏集输出模式和仅输入模式━P0, P1, P2, P4, P5, P6 和 P7 可以设置为推挽输出模式,开漏集输出模式━P6.0, P6.1和P4.7公用XTAL2, XTAL1和RST●时钟源━内部12MHz/11.059MHz 振荡器(IHRCO): 工厂校对到 1%, 典型值━外部晶振模式, 支持 32.768KHz 振荡━内部低功耗32KHz RC 振荡器 (ILRCO)━外部时钟输入(ECKI) 在P6.0/XTAL2, 可达到25MHz━内部RC 振荡输出在P6.0/XTAL2━片内时钟倍频器(CKM) 可提供高速时钟源●两个低电压检测━BOD0: 检测 1.7V━BOD1: 选择检测电压为4.2V/3.7V/2.4V/2.0V━中断 CPU或复位 CPU━(BOD1)在掉电模式下唤醒CPU●多种功耗控制模式:掉电模式,空闲模式,慢频模式,副频模式,RTC 模式,watch 模式和 monitor 模式,━所有的中断能唤醒空闲(IDLE)模式━13个中断源能唤醒掉电模式━慢频模式和副频模式支持低速MCU运转━RTC模式在掉电模式下支持实时时钟(RTC)恢复CPU━Watch 模式在掉电模式下支持看门狗(WDT) 恢复CPU━Monitor 模式在掉电模式下支持BOD1 恢复 CPU●工作电压范围:1.8V – 5.5V━flash 写操作(ISP/IAP/ICP)的最低电压为1.8V●工作频率范围:25MHz(最高)━外部晶振模式,0 – 12MHz在1.8V – 5.5V和0 – 25MHz在2.7V – 5.5V━CPU工作频率可达12MHz在1.8V – 5.5V和25MHz在2.2V – 5.5V●工作温度━工业级(-40°C到+85°C)*●封装类型━LQFP64 (10mm x 10mm): MA82G5C64AC64━LQFP48( 7mm x 7mm): MA82G5C32AD48*:抽样检测4MA82G5Cxx 数据手册MEGAWIN目录特性 (2)目录 (5)1.概述 (11)2.方框图 (12)3.特殊功能寄存器 (13)3.1.SFR 图 (页 0~F) (13)3.2.SFR 位分配(页 0~F) (14)3.3.辅助 SFR 图 ( P页) (18)3.4.辅助特殊功能寄存器位分配 (P页) (19)4.引脚结构 (20)4.1.封装指南 (20)4.2.引脚描述 (22)4.3.功能复用 (26)5.8051 CPU 功能描述 (31)5.1.CPU 寄存器 (31)5.2.CPU 时序 (32)5.3.CPU 寻址模式 (33)6.存储器组织 (34)6.1.片内程序存储器Flash (34)6.2.片内数据存储器RAM (35)6.3.片上扩展RAM (XRAM) (38)6.4.片外扩展数据存储器访问 (39)6.4.1.8位地址复用模式用于MOVX访问8位数据 (41)6.4.2.8位地址复用模式用于MOVX访问16位数据 (42)6.4.3.16位地址复用模式用于MOVX访问8位数据 (43)6.4.4.16位地址复用模式用于MOVX访问16位数据 (44)6.4.5.无地址模式用于MOVX访问8位数据 (45)6.4.6.无地址模式用于MOVX访问16位数据 (46)6.4.7.ADDRO 模式用于MOVX 16地址访问 (46)6.4.8.ADDRO模式用于MOVX 16地址访问 (46)6.5.关于C51编译器的声明标识符 (47)7.双数据指针寄存器(DPTR) (48)8.系统时钟 (49)8.1.时钟结构 (50)8.2.时钟寄存器 (51)9.看门狗定时器(WDT) (54)9.1.WDT 结构 (54)9.2.WDT在掉电模式和空闲模式期间 (54)9.3.WDT 寄存器 (55)9.4.WDT 硬件选项 (57)10.实时时钟 (RTC)/系统时间 (58)10.1.RTC 结构 (58)10.2.RTC 寄存器 (59)11.系统复位 (61)MEGAWIN MA82G5Cxx 数据手册511.1.复位源 (61)11.2.上电复位 (61)11.3.外部复位 (62)11.4.软件复位 (62)11.5.低电检测复位 (63)11.6.WDT复位 (63)11.7.非法地址复位 (63)12.电源管理 (64)12.1.低电监测器 (64)12.2.电源节省模式 (65)12.2.1.慢频模式 (65)12.2.2.副频模式 (65)12.2.3.RTC 模式 (65)12.2.4.Watch 模式 (65)12.2.5.Monitor 模式 (65)12.2.6.空闲模式 (65)12.2.7.掉电模式 (65)12.2.8.中断唤醒掉电模式 (67)12.2.9.复位唤醒掉电模式 (67)12.2.10.KBI 键盘唤醒掉电模式 (67)12.3.电源控制寄存器 (68)13.I/O口配置 (70)13.1.IO 结构 (70)13.1.1.端口 3 准双向口结构 (71)13.1.2.端口3推挽输出结构 (72)13.1.3.端口3 仅输入 (高阻抗输入) 结构 (72)13.1.4.端口3 开漏输出结构 (73)13.1.5.通用开漏输出结构 (73)13.1.6.通用推挽输出结构 (74)13.1.7.通用端口数字输入配置 (74)13.2.I/O 口寄存器 (75)13.2.1.端口 0 寄存器 (75)13.2.2.端口 1 寄存器 (75)13.2.3.端口 2 Register (76)13.2.4.端口 3 Register (76)13.2.5.端口 4 寄存器 (77)13.2.6.端口 5 寄存器 (77)13.2.7.端口6 寄存器 (77)13.2.8.端口 7 寄存器 (78)13.2.9.上拉控制寄存器 (78)13.2.10.模拟输入配置寄存器 (80)13.2.11.端口输出驱动能力控制寄存器 (81)14.中断 (83)14.1.中断结构 (83)14.2.中断源 (85)14.3.中断使能 (88)14.4.中断优先级 (89)14.5.中断处理 (89)14.6.nINTx 输入源选择和输入滤波(x=0~3) (90)14.7.中断寄存器 (91)15.定时器/计数器 (100)6MA82G5Cxx 数据手册MEGAWIN15.1.1.定时器 0/1 模式0 (101)15.1.2.定时器 0/1 模式1 (103)15.1.3.定时器 0/1 模式2 (104)15.1.4.定时器 0/1 模式3 (105)15.1.5.定时器 0/1可编程时钟输出 (106)15.1.6.定时器 0/1 寄存器 (108)15.2.定时器 22 (112)15.2.1.定时器 2 模式0 (自动重载和外部中断) (112)15.2.2.定时器2模式1 (带外部中断的自动重载) (113)15.2.3.定时器2模式2 (捕获) (114)15.2.4.定时器2模式3 (捕获带自动清零) (115)15.2.5.分割定时器2模式0 (自动重载和外部中断) (116)15.2.6.分割定时器2模式1 (自动重载带外部中断) (117)15.2.7.分割定时器2模式2(捕获) (118)15.2.8.分割定时器2模式3(捕获带自动清零) (119)15.2.9.波特率发生器模式(BRG) (120)15.2.10.定时器2可编程时钟输出 (122)15.2.11.定时器2寄存器 (123)15.3.定时器3 (127)15.3.1.定时器3模式0 (自动重载和外部中断) (127)15.3.2.定时器3模式1(自动重载带外部中断) (128)15.3.3.定时器3模式2(捕获) (129)15.3.4.定时器3模式3(捕获和自动清零) (130)15.3.5.分割定时器3模式0(自动重载和外部中断) (131)15.3.6.分割定时器3模式1(自动重载带外部中断) (132)15.3.7.分割定时器3模式2 (捕获) (133)15.3.8.分割定时器3模式3(捕获带自动清零) (134)15.3.9.定时器3寄存器 (135)15.4.定时器4 (139)15.4.1.定时器4模式0 (自动重载和外部中断) (139)15.4.2.定时器4模式1 (自动重载带外部中断) (140)15.4.3.定时器4模式2(捕获) (141)15.4.4.定时器4模式3 (捕获带自动清零) (142)15.4.5.分割定时器4模式0 (自动重载和外部中断) (143)15.4.6.分割定时器4模式1(自动重载带外部中断) (144)15.4.7.分割定时器4模式2(捕获) (145)15.4.8.分割定时器4模式3 (捕获带自动清零) (146)15.4.9.定时器4寄存器 (147)16.可编程计数器阵列(PCA0) (151)16.1.PCA 概述 (151)16.2.PCA 定时器/计数器 (152)16.3.比较/捕获模块 (156)16.4.PCA操作模式 (158)16.4.1.捕获模式 (158)16.4.2.16位软件定时器模式 (160)16.4.3.高速输出模式 (161)16.4.4.PWM 模式 (162)16.4.5.增强型PWM 模式 (163)17.可编程计数器阵列1 (PCA1) (166)17.1.PCA1寄存器 (168)18.串口 0 (UART0) (170)MEGAWIN MA82G5Cxx 数据手册718.2.串口0模式1 (173)18.3.串口0模式2和模式3 (174)18.4.帧错误检测 (174)18.5.多处理器通讯 (175)18.6.自动地址识别 (175)18.7.波特率设置 (177)18.7.1.模式0波特率 (177)18.7.2.模式2波特率 (177)18.7.3.Mode 1 & 3波特率 (177)18.8.串口0模式4 (SPI主机) (184)18.9.串口0寄存器 (186)19.串口1 (UART1) (189)19.1.串口1 波特率发生器(S1BRG) (189)19.2.串口1波特率设置 (190)19.2.1.模式0波特率 (190)19.2.2.模式2波特率 (190)19.2.3.模式1和3波特率 (190)19.3.串口 1 模式4 (SPI 主机) (192)19.4.S1BRG纯定时器模式 (194)19.5.S1BRT 可编程时钟输出 (195)19.6.S1 波特率发生器用于S0 (196)19.7.串口1 寄存器 (197)20.串口2 (UART2) (200)20.1.S2BRG的纯定时器模式 (200)20.2.串口2 寄存器 (201)21.串口3 (UART3) (204)21.1.S3BRG的纯定时器模式 (204)21.2.串口 3 寄存器 (205)22.串行外围接口(SPI) (208)22.1.SPI典型配置 (209)22.1.1.单主机& 单从机 (209)22.1.2.双驱动,既是主机也是从机 (209)22.1.3.单主机 & 多从机 (209)22.2.配置 SPI (210)22.2.1.从机注意事项 (210)22.2.2.主机注意事项 (210)22.2.3.nSS引脚的模式改变 (211)22.2.4.发送保持寄存器满标志 (211)22.2.5.写冲突 (211)22.2.6.SPI 忙标志 (211)22.2.7.SPI 时钟速率选择 (211)22.3.数据模式 (212)22.4.SPI 寄存器 (214)23.双线串行接口(TWSI 和 TWI1) (217)23.1.操作模式 (218)23.1.1.主机发送模式 (218)23.1.2.主机接收模式 (218)23.1.3.从机发送模式 (219)23.1.4.从机接收模式 (219)8MA82G5Cxx 数据手册MEGAWIN23.3.使用TWSI (220)23.4.TWSI 寄存器 (226)23.5.TWI1 寄存器 (229)24.串行接口侦测(SID/STWI) (232)24.1.SID (STWI) 结构 (232)24.2.SID 寄存器 (233)24.3.SID 示例代码 (234)25.蜂鸣器 (235)25.1.蜂鸣器寄存器 (235)25.2.蜂鸣器示例代码 (236)26.键盘中断 (KBI) (237)26.1.KBI 结构 (238)26.2.KBI 寄存器 (239)27.10位ADC (241)27.1.ADC 结构 (241)27.2.ADC操作 (242)27.2.1.ADC输入通道 (242)27.2.2.ADC 参考电压 (242)27.2.3.开始一个转换 (242)27.2.4.ADC转换时间 (242)27.2.5.I/O引脚用于ADC功能 (243)27.2.6.空闲和掉电模式 (243)27.3.ADC 寄存器 (244)28.模拟比较器 0/1/2 (AC0/AC1/AC2) (247)28.1.AC0/AC1/AC2 结构 (247)28.2.AC0/AC1/AC2 寄存器 (249)29.I SP 和 IAP (254)29.1.MA82G5C64 Flash 存储器配置 (254)29.2.MA82G5C64 Flash 在ISP/IAP上的访问 (255)29.2.1.ISP/IAP Flash 页擦除模式 (256)29.2.2.ISP/IAP Flash 字节编程模式 (258)29.2.3.ISP/IAP Flash 读模式 (260)29.3.ISP 操作 (262)29.3.1.硬件方法启动ISP (262)29.3.2.软件方法启动ISP (262)29.3.3.ISP注意事项 (263)29.4.在应用编程 (IAP) (264)29.4.1.IAP-存储空间边界/范围 (264)29.4.2.IAP-存储空间更新数据 (264)29.4.3.IAP注意事项 (265)29.5.ISP/IAP 寄存器 (266)29.5.1.ISP/IAP 示例代码 (269)30.P页 SFR 访问 (270)31.辅助特殊功能寄存器 (274)32.硬件选项 (281)33.应用说明 (283)33.1.电源电路 (283)MEGAWIN MA82G5Cxx 数据手册933.3.外部晶振XTAL振荡电路 (284)33.4.ICP 和 OCD 接口电路 (285)33.5.在芯片编程功能 (286)33.6.在线调试功能 (287)34.电气特性 (288)34.1.最大绝对额定值 (288)34.2.直流特性 (289)34.3.外部时钟特性 (291)34.4.IHRCO 特性 (291)34.5.ILRCO 特性 (291)34.6.CKM 特性 (292)34.7.Flash 特性 (292)34.8.ADC 特性 (293)34.9.串口时序特性 (294)34.10.SPI 时序特性 (295)34.11.外部存储周期时序特性 (297)35.封装尺寸 (299)36.指令集 (301)37.版本历史 (304)38.免责声明 (305)10MA82G5Cxx 数据手册MEGAWIN1. 概述MA82G5C64是基于80C51的高效1-T结构的单芯片微处理器,每条指令需要1~7 时钟信号(比标准的8051快6~7 倍), 与标准8051指令集兼容。

8051发发达开发板用户指南说明书

8051发发达开发板用户指南说明书

E R-DBO0208-1MCU 8051 Development Board & Kit User GuideEastRising Technology Co., LimitedAttention:A. Some specifications of IC are not listed in this datasheet. Please refer to the IC datasheet for more details.B. The related documents for interfacing, demo code, ic datasheet are all available, please download from our web.REV DESCRIPTION RELEASE DATE1.0 P reliminary Release Dec-12-2019CONTENTS1. ORDERING INFORMATION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 032. QUICK START - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 043. BUTTONS DEFINITIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 054. SPECIFICATION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 065. OUTLINE DRAWING -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 076. HOW TO MAKE A CUSTOM DEMONSTRATION - - - - - - - - - - - - - - - - - - - - - - - - - - - 087. METHODS FOR USING IN SYSTEM PROGRAMMING - - - - - - - - - - - - - - - - - - - - 088. CARE AND HANDLING PRECAUTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 141. ORDERING INFORMATION1.1 Order NumberPart Number(Order Number) DescriptionER-DBO0208-1 8051 Microcontroller Development Board & Kit1.2 What's included in the packageName Quantity No StandardAccessoryBoard 11 MCUBoard 12 AdaptorAdaptor(12V/2A) 13 PowerCable 14 USB5 MicroSD Memory Card Loaded with Images 11.3 Compatible with following displays:Part Number(Order Number) DescriptionER-OLED0208-1W 2.8” OLED Display with White Color2. QUICK START2-1 Simply plug the power adaptor into an AC outlet and plug FFC(Cable) of lcd display into the ZIF connector of adaptor board as the below image shows.2-2 Press the power button to run the demonstration program.3. BUTTONS DEFINITIONSButton Name Description*Stop/Next Button Stop or Next the Image Slideshows Reset Button Restart to Initialized StatePower Button Press On or Press Off*For color display, this button is used to next the image slideshows. For mono display, this button is used to stop the image slideshows.4. SPECIFICATION4.1 Mechanical SpecificationITEM STANDARDVALUE UNITMCU Board Outline Dimension151.00×77.00 mmA daptor Board Outline Dimension 90.00×95.00 m mG ross Weight for Whole Demo Kit 0.40 k g4.2 Electrical SpecificationVALUE UNITITEM STANDARDMicrocontroller STC89LE516RD+ --I nterface 4-Wire Serial SPI--Power Supply Voltage12V V5. OUTLINE DRAWING6. HOW TO MAKE A CUSTOM DEMONSTRATIONBy using the software of LCD Font Maker or Image2LCD and ISP(In System Programming) to customize the demonstration that includes your own bitmap images, personalized fonts, symbols, icons and burn sketches. The large capacity of the MicroSD card allows you to store more fonts or images. We also prepare the demo code, interfacing document (download from each product page) and schematic MCU datasheet (download from each 8051 microcontroller development board page) for your further study.LCD Font Maker:/download/software/LCDFontMaker.zipImage2LCD:/download/software/Image2Lcd.zip7. METHODS FOR USING IN SYSTEM PROGRAMMING7-1 Hardware Preparation7-1-1 Please power off the development board,7-1-2 No power supply is connecting with 8051 development board,7-7-3 The jumpers on JP8 is on ISP position as below image shows7-2 Install the USB to RS232 Driver/download/software/USB-TO-RS232-DRIVER.rar7-3 Connecting the 8051 development board to computer by USB Cable and you should find the new port USB-SERIAL CH340 in Computer-System Properties-Device Manager as below image shows and remember the COM number that would be used in Step7-4.7-4 Install STC 8051 Microcontroller ISP(In System Programming)Software/download/software/STC-ISP-V4.86-NOT-SETUP-ENGLISH.zip7-5 Open ISP and Select COM Port that should be the same with the step 7-2 you see from Device Manager.7-6 Select MCU part number that should be the same with your purchased one. (Refer to 4.2 Electrical Specification)7-7 Open target “,hex” file by clicking open code file7-8 Programming7-8-1 Click Download/Program7-8-2 Then you will see ”Checking target MCU….”7-8-3 Power on the development board by pressing the white power button7-8-4 Now you could see the process of programming7-8-5 Progarmming Finished8 Please move the jumpers on JP8 from ISP to N_ISP as below image shows.8. CARE AND HANDLING PRECAUTIONSThe kit is sold with a module mounted on it. If you attempt to modify the board to work with other modules, the warranty is void. For optimum operation of the module and demonstration board and to prolong their life, please follow the precautions below.8.1 ESD (Electro-Static Discharge)The circuitry is industry standard CMOS logic and susceptible to ESD damage. Please use industry standard antistatic precautions as you would for any other PCB such as expansion cards or motherboards.8.2 Avoid Shock,Impact,Torque and Tension◇Do not expose the module to strong mechanical shock, impact, torque, and tension.◇Do not drop, toss, bend, or twist the module.◇Do not place weight or pressure on the module.8.3 LCD&OLED Display Glass◇The exposed surface of the LCD "glass" is actually a polarizer laminated on top of the glass.To protect the soft plastic polarizer from damage, the module ships with a protective film over the polarizer. Please peel off the protective film slowly. Peeling off the protective film abruptly may generate static electricity.◇The polarizer is made out of soft plastic and is easily scratched or damaged. When handling the module, avoid touching the polarizer. Finger oils are difficult to remove.◇If the LCD panel breaks, be careful not to get the liquid crystal fluid in your mouth or eyes. If the liquid crystal fluid touches your skin, clothes, or work surface, wash it off immediately using soap and plenty of water.◇Be very careful when you clean the polarizer. Do not clean the polarizer with liquids. Do not wipe the polarizer with any type of cloth or swab (for example, Q-tips). Use the removable protective film to remove smudges (for example, fingerprints) and any foreign matter. If you no longer have the protective film, use standard transparent office tape . If the polarizer is dusty, you may carefully blow it off with clean, dry, oil-free compressed air.8.4 Operation◇Use only the included AC adapter to power the board.◇Observe the operating temperature limitations: from -20°C minimum to +70°C maximum with minimal fluctuations. Operation outside of these limits may shorten the life and/or harm the display.□At lower temperatures of this range, response time is delayed.□At higher temperatures of this range, display becomes dark. (You may need to adjust the contrast.) ◇Operate away from dust, moisture, and direct sunlight.8.5 Storage and Recycling◇Store in an ESD-approved container away from dust, moisture, and direct sunlight.◇Observe the storage temperature limitations: from -30°C minimum to +80°C maximum with minimal fluctuations. Rapid temperature changes can cause moisture to form, resulting in permanentdamage.◇ Do not allow weight to be placed on the modules while they are in storage.◇ Please recycle your outdated displays at an approved facility.。

MCS8051学习板使用说明

MCS8051学习板使用说明

MCS8051学习板使用说明
一、浏览光盘
光盘内容如图所示:
二、软件安装说明
一、打开软件文件夹:
文件内容包括:
KEIL编程软件(keilc51v720)、PDF阅览软件(AdbeRdr708) 如图所示:
二、安装KeilC51软件
打开keilc51v720文件夹→打开setup文件夹→双击Setup开始安
装Keil软件。

选择Full Version进行安装。

选项Serial Number:填写为SN记事本内容。

Keil软件安装成功。

三、安装下载程序的软件
下载软件是用于将编写好的HEX文件烧录到MCS8051芯片上。

解压软件:
STC_ISP下载软件安装成功。

三、软件使用编程使用KEIL软件。

打开KEIL软件。

选择建立HEX文件。

生成HEX 文件。

四、将HEX文件下载到芯片
在进行下载之前,先将学习板的电源关闭,使线路板处于无电源状态。

关闭学习板电源,先点击下载:
再打开电源:
程序下载完毕。

打开电源观察运行结果。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

编译:陈拓 chentuo2000@
2009年9月2日
MC8051 IP核可综合 VHDL 微控制器 IP-Core
用户指南
Web: http://oregano.at/services/8051.htm
Contact: mc8051@oregano.at
Version 1.1
June 2002
8051 IP核 - 概述
关键特性
y全可综合设计
y指令集兼容工业标准8051微控制器
y优化的架构是该核达到每操作码1到4个时钟
y使用全新架构速度更快至10倍
y用户可选择定时器/计数器以及串口单元的数目
y活动定时器/计数器以及串口单元可以通过特殊功能寄存器选择
y使用并行乘法器单元优化乘法命令(MUL)的实现
y使用并行除法器单元优化除法命令(MUL)的实现
y无复用的I/O端口
y256K字节的内部RAM
y多至64K字节ROM和多至64K字节RAM
y源代码在GNU LGPL许可证下可以自由修改
y技术独立,结构清晰,注释良好的VHDL源码
y通过调整/修改VHDL源码易于扩展
y通过VHDL常量可参数化
8051 IP核-方块图
顶层模块及其子模块描绘于图1。

图1:8051微控制器IP核的方块图
表1:顶层设计名字
设计层次
设计层次和相应的VHDL文件描绘于图2。

图2:8051微控制器IP核的设计层次
VHDL源文件在整个设计中统一命名:
y VHDL实体 entity-name_.vhd
y VHDL构造 entity-name_rtl.vhd用于包含逻辑的模块
entity-name_struc.vhd用于仅连接子模块的模块
y VHDL配置 entity-name_rtl_cfg.vhd
entity-name_struc_cfg.vhd
核本身由子模块、定时器/计数器、算数逻辑单元AUL、串口和控制单元组成。

RAN和ROM块的生成通常与所选择的目标技术相对应,并因此在最高设计层次被实例化。

生成的RAM块和BIST结构 - 用于ASIC生产测试集成 - 可以容易地在该设计层次添加。

时钟域
IP核是一个全同步的设计。

有一个单一的信号时钟控制每个存储单元的时钟输入。

8051
未使用时钟门控。

时钟信号不反馈到任何组合元件。

中断输入线用标准的两级同步阶段被同步到全局时钟信号,因为它们可能被用另一个时钟操作的外部电路所驱动。

并口输入信号不用这种方式同步,如果用户决定需要同步这些信号,它也可以容易地被添加。

存储器接口
由于优化的架构,从存储器块来去的信号没有被寄存。

所以在同步输入和输出期间定时
约束应该被放置在相应的端口上,并且同步存储器块应该被用于mc8051 IP核。

配置8051 IP核
下面将讨论8051微控制器IP核的参数化设计,并且将给出在大设计中嵌入IP核的信息。

定时器/计数器,串口和中断
原始的微控制器设计只提供2个定时器/计数器,1个串口和2个外部中断源,而面派生的8051在片上提供更多的资源。

但有时这是一个限制因素,因此我们决定在8051 IP核中实现一些可参数化的端口。

该8051微控制器IP核简单地用改变VHDL实例的值的方法提供能产生多至256个各种单元的能力。

在VHDL源文件mc8051_p.vhd中包含的C_IMPL_N_TMR可以从1到256取值以控制该特性。

组成这些间隔结果的值在核的非功能配置中。

图3显示了VHDL代码相应的行。

图3:用于配置定时器/计数器单元,串口和外部中断的VHDL源代码 不能同时单独改变3个常量C_IMPL_N_TMR,C_IMPL_N_SIU,C_IMPL_N_EXT。

常量C_IMPL_N_TMR每增加1意味着多生成2个附加的定时器/计数器单元,一个附加的串口和2个附加的外部中断源。

为了能够访问到所有已生成单元的寄存器,而不改变微控制器的地址空间,仅有的2个8位寄存器被推断为特殊功能寄存器,它们是TSEL(地址0x8Eh用于定时器/计数器单元)和SSEL(地址0x9Ah用于串口单元)。

如果这些寄存器指向一个不存在的设备号,默认单元号1将被选择。

电路描绘在图4中。

图4:通过附加的TSEL寄存器选择一个TCON寄存器
如果在这个特殊的器件没有被TSEL选择期间发生一个中断,相应的中断标志保持置位直到匹配的中断服务例程被执行。

在器件还没有被选择的这段时间内的随后的中断,仅有一个信号调用中断服务例程。

可选指令
在某些情况下不实现那些不需要而且消耗许多芯片面积的指令是有意义的。

这些指令是8位乘法器,8位除法器和8位十进制校正。

因此在mc8051_p.vdl源文件中的VHDL常量C_IMPL_MUL被设置为0时,用于8位乘法的MUL指令可以被跳过。

同样通过设置VHDL 常量C_IMPL_DIV为0时,8位除法DIV可以被跳过。

设置常量C_IMPL_DA为0时,十进制校正指令可以被跳过。

VHDL源代码相应的行见图5。

图5:显示指令怎样被跳过的代码片段
如果3个可选指令都不实现,可节省10%的芯片面积。

并行I/O端口
IP核仅提供原始的8051微控制器的4个双向8位I/O端口以方便与微控制器的 mc8051
环境交换数据。

为了在IC设计中易于集成我们的核,原始的多功能端口不必重新构建并且所有信号(例如,串口,中断,计数器输入和外部存储器接口)都已经被分别馈送到核的输出(见图1)。

并行I/O端口的基本结构示于图6。

图6:并行I/O端口的基本结构
校验
核的校验由VHDL代码的仿真实现,并用由工业标准的8051仿真产生的结果和执行程序的结果(例如ROM的内容)相比较(/demo/evaldl.asp?p=C51)。

在仿真之后,一些确定的存储器区域的内容被写到一个文件中,既用于标准的8051仿真(使用命令sava keil.hex 0x00, 0xFF)也用于VHDL代码仿真(例如,使用脚本write2file.do,在仿真目录中产生文件regs.log)。

作为结果文本文件必须完全一致。

为了能够从Keil开发软件馈送编译好的汇编文件到VHDL代码仿真一个在最后发布的IP核中提供的短C程序,要转换Intel的hex格式文件到一个包含8位数据的文本文件,以适合被VHDL仿真器读取(文件mc8051_rom.dua在仿真目录中)。

交付使用
解压mc8051.zip文件使用如我们建议的目录树。

已经有用于综合的脚本,有使用Synopsys的用于ASIC设计的DesignCompiler脚本和Synplicity的用于FPGA设计的脚本,还有使用Mentor/Modeltech的Modelsim的用于RTL仿真的脚本。

图7是mc8051目录树图。

图7:mc8051 IP核发布的目录树
表2:目录树:简单描述
文档版本。

相关文档
最新文档