esp8266 可以使用的版本

master
a74589669 2019-07-14 02:57:21 +08:00
parent 965fa90ccb
commit 6762ed027b
16 changed files with 3549 additions and 144 deletions

View File

@ -1,37 +0,0 @@
### uVision2 Project, (C) Keil Software
### Do not modify !
cExt (*.c)
aExt (*.a*; *.src)
oExt (*.obj)
lExt (*.lib)
tExt (*.txt)
pExt (*.plm)
CppX (*.cpp)
DaveTm { 0,0,0,0,0,0,0,0 }
Target (Target 1), 0x0000 // Tools: 'MCS-51'
GRPOPT 1,(Source Group 1),1,0,0
ExtF <.\main.c> 1,5,0,{ 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,248,255,255,255,225,255,255,255,52,0,0,0,52,0,0,0,140,8,0,0,72,2,0,0 }
TARGOPT 1, (Target 1)
CLK51=24000000
OPTTT 0,1,1,0
OPTHX 0,65535,0,0,0
OPTLX 120,65,8,<.\>
OPTOX 16
OPTLT 1,1,1,0,1,1,0,1,0,0,0,0
OPTXL 1,1,1,1,1,1,1,0,0
OPTFL 1,0,1
OPTBL 0,(Data Sheet)<DATASHTS\ATMEL\DOC0313.PDF>
OPTBL 1,(Add on databooks)<DATASHTS\ADDBOOKS.PDF>
OPTBL 2,(Instruction Set Manual)<DATASHTS\ATMEL\DOC0509.PDF>
OPTDL (S8051.DLL)()(DP51.DLL)(-p52)(S8051.DLL)()(TP51.DLL)(-p52)
OPTDBG 509,0,()()()()()()()()()() ()()()()
OPTDF 0x0
OPTLE <>
OPTLC <>
EndOpt

View File

@ -1,102 +0,0 @@
### uVision2 Project, (C) Keil Software
### Do not modify !
Target (Target 1), 0x0000 // Tools: 'MCS-51'
Group (Source Group 1)
Options 1,0,0 // Target 'Target 1'
Device (AT89C52)
Vendor (Atmel)
Cpu (IRAM(0 - 0xFF) IROM(0 - 0x1FFF) CLOCK(24000000))
Rgf (AT89X52.H)
Mem ()
C ()
A ()
RL ()
OH ()
UseEnv=0
EnvBin ()
EnvInc ()
EnvLib ()
EnvReg (ÿAtmel\)
OrgReg (ÿAtmel\)
TgStat=0
OutDir (.\)
OutName (RelayController)
GenApp=1
GenLib=0
GenHex=0
Debug=1
Browse=1
LstDir (.\)
HexSel=0
MG32K=0
RunUsr 0 0 <>
RunUsr 1 0 <>
SVCSID <>
MODEL5=0
RTOS5=0
ROMSZ5=2
DHOLD5=0
XHOLD5=0
T51FL=80
CBANKS5=0
XBANKS5=0
RCB51 { 0,0,0,0,0,0,0,0,0 }
RXB51 { 0,0,0,0,0,0,0,0,0 }
OCM51 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
OCR51 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
IRO51 { 1,0,0,0,0,0,32,0,0 }
IRA51 { 0,0,0,0,0,0,1,0,0 }
XRA51 { 0,0,0,0,0,0,0,0,0 }
C51FL=21630224
C51VA=0
C51MSC ()
C51DEF ()
C51UDF ()
INCC5 ()
AX51FL=4
AX51MSC ()
AX51SET ()
AX51RST ()
INCA5 ()
IncBld=1
AlwaysBuild=0
GenAsm=0
AsmAsm=0
PublicsOnly=0
StopCode=3
CustArgs ()
LibMods ()
BankNo=65535
LX51FL=292
LX51OVL ()
LX51MSC ()
LX51DWN ()
LX51LFI ()
LX51ASN ()
LX51RES ()
LX51CCL ()
LX51UCL ()
LX51CSC ()
LX51UCS ()
LX51COB ()
LX51XDB ()
LX51PDB ()
LX51BIB ()
LX51DAB ()
LX51IDB ()
LX51PRC ()
LX51STK ()
LX51COS ()
LX51XDS ()
LX51BIS ()
LX51DAS ()
LX51IDS ()
OPTDL (S8051.DLL)()(DP51.DLL)(-p52)(S8051.DLL)()(TP51.DLL)(-p52)
OPTDBG 509,0,()()()()()()()()()() ()()()()
EndOpt

View File

@ -1,5 +0,0 @@
#include <AT89X52.H>

View File

@ -0,0 +1,198 @@
$NOMOD51
;------------------------------------------------------------------------------
; This file is part of the C51 Compiler package
; Copyright (c) 1988-2005 Keil Elektronik GmbH and Keil Software, Inc.
; Version 8.01
;
; *** <<< Use Configuration Wizard in Context Menu >>> ***
;------------------------------------------------------------------------------
; STARTUP.A51: This code is executed after processor reset.
;
; To translate this file use A51 with the following invocation:
;
; A51 STARTUP.A51
;
; To link the modified STARTUP.OBJ file to your application use the following
; Lx51 invocation:
;
; Lx51 your object file list, STARTUP.OBJ controls
;
;------------------------------------------------------------------------------
;
; User-defined <h> Power-On Initialization of Memory
;
; With the following EQU statements the initialization of memory
; at processor reset can be defined:
;
; <o> IDATALEN: IDATA memory size <0x0-0x100>
; <i> Note: The absolute start-address of IDATA memory is always 0
; <i> The IDATA space overlaps physically the DATA and BIT areas.
IDATALEN EQU 80H
;
; <o> XDATASTART: XDATA memory start address <0x0-0xFFFF>
; <i> The absolute start address of XDATA memory
XDATASTART EQU 0
;
; <o> XDATALEN: XDATA memory size <0x0-0xFFFF>
; <i> The length of XDATA memory in bytes.
XDATALEN EQU 0
;
; <o> PDATASTART: PDATA memory start address <0x0-0xFFFF>
; <i> The absolute start address of PDATA memory
PDATASTART EQU 0H
;
; <o> PDATALEN: PDATA memory size <0x0-0xFF>
; <i> The length of PDATA memory in bytes.
PDATALEN EQU 0H
;
;</h>
;------------------------------------------------------------------------------
;
;<h> Reentrant Stack Initialization
;
; The following EQU statements define the stack pointer for reentrant
; functions and initialized it:
;
; <h> Stack Space for reentrant functions in the SMALL model.
; <q> IBPSTACK: Enable SMALL model reentrant stack
; <i> Stack space for reentrant functions in the SMALL model.
IBPSTACK EQU 0 ; set to 1 if small reentrant is used.
; <o> IBPSTACKTOP: End address of SMALL model stack <0x0-0xFF>
; <i> Set the top of the stack to the highest location.
IBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
; </h>
;
; <h> Stack Space for reentrant functions in the LARGE model.
; <q> XBPSTACK: Enable LARGE model reentrant stack
; <i> Stack space for reentrant functions in the LARGE model.
XBPSTACK EQU 0 ; set to 1 if large reentrant is used.
; <o> XBPSTACKTOP: End address of LARGE model stack <0x0-0xFFFF>
; <i> Set the top of the stack to the highest location.
XBPSTACKTOP EQU 0xFFFF +1 ; default 0FFFFH+1
; </h>
;
; <h> Stack Space for reentrant functions in the COMPACT model.
; <q> PBPSTACK: Enable COMPACT model reentrant stack
; <i> Stack space for reentrant functions in the COMPACT model.
PBPSTACK EQU 0 ; set to 1 if compact reentrant is used.
;
; <o> PBPSTACKTOP: End address of COMPACT model stack <0x0-0xFFFF>
; <i> Set the top of the stack to the highest location.
PBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
; </h>
;</h>
;------------------------------------------------------------------------------
;
; Memory Page for Using the Compact Model with 64 KByte xdata RAM
; <e>Compact Model Page Definition
;
; <i>Define the XDATA page used for PDATA variables.
; <i>PPAGE must conform with the PPAGE set in the linker invocation.
;
; Enable pdata memory page initalization
PPAGEENABLE EQU 0 ; set to 1 if pdata object are used.
;
; <o> PPAGE number <0x0-0xFF>
; <i> uppermost 256-byte address of the page used for PDATA variables.
PPAGE EQU 0
;
; <o> SFR address which supplies uppermost address byte <0x0-0xFF>
; <i> most 8051 variants use P2 as uppermost address byte
PPAGE_SFR DATA 0A0H
;
; </e>
;------------------------------------------------------------------------------
; Standard SFR Symbols
ACC DATA 0E0H
B DATA 0F0H
SP DATA 81H
DPL DATA 82H
DPH DATA 83H
NAME ?C_STARTUP
?C_C51STARTUP SEGMENT CODE
?STACK SEGMENT IDATA
RSEG ?STACK
DS 1
EXTRN CODE (?C_START)
PUBLIC ?C_STARTUP
CSEG AT 0
?C_STARTUP: LJMP STARTUP1
RSEG ?C_C51STARTUP
STARTUP1:
IF IDATALEN <> 0
MOV R0,#IDATALEN - 1
CLR A
IDATALOOP: MOV @R0,A
DJNZ R0,IDATALOOP
ENDIF
IF XDATALEN <> 0
MOV DPTR,#XDATASTART
MOV R7,#LOW (XDATALEN)
IF (LOW (XDATALEN)) <> 0
MOV R6,#(HIGH (XDATALEN)) +1
ELSE
MOV R6,#HIGH (XDATALEN)
ENDIF
CLR A
XDATALOOP: MOVX @DPTR,A
INC DPTR
DJNZ R7,XDATALOOP
DJNZ R6,XDATALOOP
ENDIF
IF PPAGEENABLE <> 0
MOV PPAGE_SFR,#PPAGE
ENDIF
IF PDATALEN <> 0
MOV R0,#LOW (PDATASTART)
MOV R7,#LOW (PDATALEN)
CLR A
PDATALOOP: MOVX @R0,A
INC R0
DJNZ R7,PDATALOOP
ENDIF
IF IBPSTACK <> 0
EXTRN DATA (?C_IBP)
MOV ?C_IBP,#LOW IBPSTACKTOP
ENDIF
IF XBPSTACK <> 0
EXTRN DATA (?C_XBP)
MOV ?C_XBP,#HIGH XBPSTACKTOP
MOV ?C_XBP+1,#LOW XBPSTACKTOP
ENDIF
IF PBPSTACK <> 0
EXTRN DATA (?C_PBP)
MOV ?C_PBP,#LOW PBPSTACKTOP
ENDIF
MOV SP,#?STACK-1
; This code is required if you use L51_BANK.A51 with Banking Mode 4
;<h> Code Banking
; <q> Select Bank 0 for L51_BANK.A51 Mode 4
#if 0
; <i> Initialize bank mechanism to code bank 0 when using L51_BANK.A51 with Banking Mode 4.
EXTRN CODE (?B_SWITCH0)
CALL ?B_SWITCH0 ; init bank mechanism to code bank 0
#endif
;</h>
LJMP ?C_START
END

View File

@ -0,0 +1,347 @@
#ifndef __STC12C5A60S2_H_
#define __STC12C5A60S2_H_
/////////////////////////////////////////////////
//--------------------------------------------------------------------------------
//??? 1T 8051?? ???????????? C51 Core SFRs
// 7 6 5 4 3 2 1 0 Reset Value
sfr ACC = 0xE0; //Accumulator 0000,0000
sfr B = 0xF0; //B Register 0000,0000
sfr PSW = 0xD0; //Program Status Word CY AC F0 RS1 RS0 OV F1 P 0000,0000
//-----------------------------------
sbit CY = PSW^7;
sbit AC = PSW^6;
sbit F0 = PSW^5;
sbit RS1 = PSW^4;
sbit RS0 = PSW^3;
sbit OV = PSW^2;
sbit P = PSW^0;
//-----------------------------------
sfr SP = 0x81; //Stack Pointer 0000,0111
sfr DPL = 0x82; //Data Pointer Low Byte 0000,0000
sfr DPH = 0x83; //Data Pointer High Byte 0000,0000
//--------------------------------------------------------------------------------
//??? 1T 8051?? ??????????????
// 7 6 5 4 3 2 1 0 Reset Value
sfr PCON = 0x87; //Power Control SMOD SMOD0 LVDF POF GF1 GF0 PD IDL 0001,0000
// 7 6 5 4 3 2 1 0 Reset Value
sfr AUXR = 0x8E; //Auxiliary Register T0x12 T1x12 UART_M0x6 BRTR S2SMOD BRTx12 EXTRAM S1BRS 0000,0000
//-----------------------------------
sfr AUXR1 = 0xA2; //Auxiliary Register 1 - PCA_P4 SPI_P4 S2_P4 GF2 ADRJ - DPS 0000,0000
/*
PCA_P4:
0, ??PCA ?P1 ?
1,PCA/PWM ?P1 ????P4 ?: ECI ?P1.2 ???P4.1 ?,
PCA0/PWM0 ?P1.3 ???P4.2 ?
PCA1/PWM1 ?P1.4 ???P4.3 ?
SPI_P4:
0, ??SPI ?P1 ?
1,SPI ?P1 ????P4 ?: SPICLK ?P1.7 ???P4.3 ?
MISO ?P1.6 ???P4.2 ?
MOSI ?P1.5 ???P4.1 ?
SS ?P1.4 ???P4.0 ?
S2_P4:
0, ??UART2 ?P1 ?
1,UART2 ?P1 ????P4 ?: TxD2 ?P1.3 ???P4.3 ?
RxD2 ?P1.2 ???P4.2 ?
GF2: ?????
ADRJ:
0, 10 ?A/D ??????8 ???ADC_RES ???, ?2 ???ADC_RESL ???
1,10 ?A/D ???????2 ???ADC_RES ?????2 ?, ?8 ???ADC_RESL ???
DPS: 0, ????????DPTR0
1,?????????DPTR1
*/
//-----------------------------------
sfr WAKE_CLKO = 0x8F; //??? SFR WAK1_CLKO
/*
7 6 5 4 3 2 1 0 Reset Value
PCAWAKEUP RXD_PIN_IE T1_PIN_IE T0_PIN_IE LVD_WAKE _ T1CLKO T0CLKO 0000,0000B
b7 - PCAWAKEUP : PCA ????? powerdown?
b6 - RXD_PIN_IE : ? P3.0(RXD) ????? RI ???? powerdown(????????)?
b5 - T1_PIN_IE : ? T1 ?????? T1 ???????? powerdown(????????)?
b4 - T0_PIN_IE : ? T0 ?????? T0 ???????? powerdown(????????)?
b3 - LVD_WAKE : ? CMPIN ?????? LVD ???????? powerdown(????????)?
b2 -
b1 - T1CLKO : ?? T1CKO(P3.5) ??? T1 ????,Fck1 = 1/2 T1 ???
b0 - T0CLKO : ?? T0CKO(P3.4) ??? T0 ????,Fck0 = 1/2 T1 ???
*/
//-----------------------------------
sfr CLK_DIV = 0x97; //Clock Divder - - - - - CLKS2 CLKS1 CLKS0 xxxx,x000
//-----------------------------------
sfr BUS_SPEED = 0xA1; //Stretch register - - ALES1 ALES0 - RWS2 RWS1 RWS0 xx10,x011
/*
ALES1 and ALES0:
00 : The P0 address setup time and hold time to ALE negative edge is one clock cycle
01 : The P0 address setup time and hold time to ALE negative edge is two clock cycles.
10 : The P0 address setup time and hold time to ALE negative edge is three clock cycles. (default)
11 : The P0 address setup time and hold time to ALE negative edge is four clock cycles.
RWS2,RWS1,RWS0:
000 : The MOVX read/write pulse is 1 clock cycle.
001 : The MOVX read/write pulse is 2 clock cycles.
010 : The MOVX read/write pulse is 3 clock cycles.
011 : The MOVX read/write pulse is 4 clock cycles. (default)
100 : The MOVX read/write pulse is 5 clock cycles.
101 : The MOVX read/write pulse is 6 clock cycles.
110 : The MOVX read/write pulse is 7 clock cycles.
111 : The MOVX read/write pulse is 8 clock cycles.
*/
//--------------------------------------------------------------------------------
//??? 1T 8051?? ????????????
//?????????????????????????,??????????
//???????????,??? ??? 1T 8051?? ???????
// 7 6 5 4 3 2 1 0 Reset Value
sfr IE = 0xA8; //??????? EA ELVD EADC ES ET1 EX1 ET0 EX0 0x00,0000
//-----------------------
sbit EA = IE^7;
sbit ELVD = IE^6; //?????????
sbit EADC = IE^5; //ADC ?????
sbit ES = IE^4;
sbit ET1 = IE^3;
sbit EX1 = IE^2;
sbit ET0 = IE^1;
sbit EX0 = IE^0;
//-----------------------
sfr IE2 = 0xAF; //Auxiliary Interrupt - - - - - - ESPI ES2 0000,0000B
//-----------------------
// 7 6 5 4 3 2 1 0 Reset Value
sfr IP = 0xB8; //??????? PPCA PLVD PADC PS PT1 PX1 PT0 PX0 0000,0000
//--------
sbit PPCA = IP^7; //PCA ???????
sbit PLVD = IP^6; //?????????
sbit PADC = IP^5; //ADC ?????
sbit PS = IP^4;
sbit PT1 = IP^3;
sbit PX1 = IP^2;
sbit PT0 = IP^1;
sbit PX0 = IP^0;
//-----------------------
// 7 6 5 4 3 2 1 0 Reset Value
sfr IPH = 0xB7; //??????? PPCAH PLVDH PADCH PSH PT1H PX1H PT0H PX0H 0000,0000
sfr IP2 = 0xB5; // - - - - - - PSPI PS2 xxxx,xx00
sfr IPH2 = 0xB6; // - - - - - - PSPIH PS2H xxxx,xx00
//-----------------------
//??? 1T 8051?? ???I/O ????????
// 7 6 5 4 3 2 1 0 Reset Value
sfr P0 = 0x80; //8 bitPort0 P0.7 P0.6 P0.5 P0.4 P0.3 P0.2 P0.1 P0.0 1111,1111
sbit P00 = P0^0;
sbit P01 = P0^1;
sbit P02 = P0^2;
sbit P03 = P0^3;
sbit P04 = P0^4;
sbit P05 = P0^5;
sbit P06 = P0^6;
sbit P07 = P0^7;
sfr P0M0 = 0x94; // 0000,0000
sfr P0M1 = 0x93; // 0000,0000
sfr P1 = 0x90; //8 bitPort1 P1.7 P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0 1111,1111
sbit P10 = P1^0;
sbit P11 = P1^1;
sbit P12 = P1^2;
sbit P13 = P1^3;
sbit P14 = P1^4;
sbit P15 = P1^5;
sbit P16 = P1^6;
sbit P17 = P1^7;
sfr P1M0 = 0x92; // 0000,0000
sfr P1M1 = 0x91; // 0000,0000
sfr P1ASF = 0x9D; //P1 analog special function
sfr P2 = 0xA0; //8 bitPort2 P2.7 P2.6 P2.5 P2.4 P2.3 P2.2 P2.1 P2.0 1111,1111
sbit P20 = P2^0;
sbit P21 = P2^1;
sbit P22 = P2^2;
sbit P23 = P2^3;
sbit P24 = P2^4;
sbit P25 = P2^5;
sbit P26 = P2^6;
sbit P27 = P2^7;
sfr P2M0 = 0x96; // 0000,0000
sfr P2M1 = 0x95; // 0000,0000
sfr P3 = 0xB0; //8 bitPort3 P3.7 P3.6 P3.5 P3.4 P3.3 P3.2 P3.1 P3.0 1111,1111
sbit P30 = P3^0;
sbit P31 = P3^1;
sbit P32 = P3^2;
sbit P33 = P3^3;
sbit P34 = P3^4;
sbit P35 = P3^5;
sbit P36 = P3^6;
sbit P37 = P3^7;
sfr P3M0 = 0xB2; // 0000,0000
sfr P3M1 = 0xB1; // 0000,0000
sfr P4 = 0xC0; //8 bitPort4 P4.7 P4.6 P4.5 P4.4 P4.3 P4.2 P4.1 P4.0 1111,1111
sbit P40 = P4^0;
sbit P41 = P4^1;
sbit P42 = P4^2;
sbit P43 = P4^3;
sbit P44 = P4^4;
sbit P45 = P4^5;
sbit P46 = P4^6;
sbit P47 = P4^7;
sfr P4M0 = 0xB4; // 0000,0000
sfr P4M1 = 0xB3; // 0000,0000
// 7 6 5 4 3 2 1 0 Reset Value
sfr P4SW = 0xBB; //Port-4 switch - LVD_P4.6 ALE_P4.5 NA_P4.4 - - - - x000,xxxx
sfr P5 = 0xC8; //8 bitPort5 - - - - P5.3 P5.2 P5.1 P5.0 xxxx,1111
sbit P50 = P5^0;
sbit P51 = P5^1;
sbit P52 = P5^2;
sbit P53 = P5^3;
sfr P5M0 = 0xCA; // 0000,0000
sfr P5M1 = 0xC9; // 0000,0000
//--------------------------------------------------------------------------------
//??? 1T 8051?? ?????????????
// 7 6 5 4 3 2 1 0 Reset Value
sfr TCON = 0x88; //T0/T1 Control TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0 0000,0000
//-----------------------------------
sbit TF1 = TCON^7;
sbit TR1 = TCON^6;
sbit TF0 = TCON^5;
sbit TR0 = TCON^4;
sbit IE1 = TCON^3;
sbit IT1 = TCON^2;
sbit IE0 = TCON^1;
sbit IT0 = TCON^0;
//-----------------------------------
sfr TMOD = 0x89; //T0/T1 Modes GATE1 C/T1 M1_1 M1_0 GATE0 C/T0 M0_1 M0_0 0000,0000
sfr TL0 = 0x8A; //T0 Low Byte 0000,0000
sfr TH0 = 0x8C; //T0 High Byte 0000,0000
sfr TL1 = 0x8B; //T1 Low Byte 0000,0000
sfr TH1 = 0x8D; //T1 High Byte 0000,0000
//--------------------------------------------------------------------------------
//??? 1T 8051?? ?????????????
// 7 6 5 4 3 2 1 0 Reset Value
sfr SCON = 0x98; //Serial Control SM0/FE SM1 SM2 REN TB8 RB8 TI RI 0000,0000
//-----------------------------------
sbit SM0 = SCON^7; //SM0/FE
sbit SM1 = SCON^6;
sbit SM2 = SCON^5;
sbit REN = SCON^4;
sbit TB8 = SCON^3;
sbit RB8 = SCON^2;
sbit TI = SCON^1;
sbit RI = SCON^0;
//-----------------------------------
sfr SBUF = 0x99; //Serial Data Buffer xxxx,xxxx
sfr SADEN = 0xB9; //Slave Address Mask 0000,0000
sfr SADDR = 0xA9; //Slave Address 0000,0000
//-----------------------------------
// 7 6 5 4 3 2 1 0 Reset Value
sfr S2CON = 0x9A; //S2 Control S2SM0 S2SM1 S2SM2 S2REN S2TB8 S2RB8 S2TI S2RI 00000000B
sfr S2BUF = 0x9B; //S2 Serial Buffer xxxx,xxxx
sfr BRT = 0x9C; //S2 Baud-Rate Timer 0000,0000
//--------------------------------------------------------------------------------
//??? 1T 8051?? ????????????????
sfr WDT_CONTR = 0xC1; //Watch-Dog-Timer Control register
// 7 6 5 4 3 2 1 0 Reset Value
// WDT_FLAG - EN_WDT CLR_WDT IDLE_WDT PS2 PS1 PS0 xx00,0000
//-----------------------
//--------------------------------------------------------------------------------
//??? 1T 8051?? ???PCA/PWM ???????
// 7 6 5 4 3 2 1 0 Reset Value
sfr CCON = 0xD8; //PCA ?????? CF CR - - - - CCF1 CCF0 00xx,xx00
//-----------------------
sbit CF = CCON^7; //PCA???????,????????,??????0?
sbit CR = CCON^6; //1:?? PCA ?????, ??????0?
//-
//-
sbit CCF1 = CCON^1; //PCA ??1 ????, ?????, ??????0?
sbit CCF0 = CCON^0; //PCA ??0 ????, ?????, ??????0?
//-----------------------
sfr CMOD = 0xD9; //PCA ???????? CIDL - - - CPS2 CPS1 CPS0 ECF 0xxx,x000
/*
CIDL: idle ??? PCA ?????????, 0: ????, 1: ?????
CPS2: PCA ????????? 2?
CPS1: PCA ????????? 1?
CPS0: PCA ????????? 0?
CPS2 CPS1 CPS0
0 0 0 ?????? fosc/12?
0 0 1 ?????? fosc/2?
0 1 0 Timer0 ???
0 1 1 ? ECI/P3.4 ????????,?? fosc/2?
1 0 0 ??????, Fosc/1
1 0 1 ??????/4,Fosc/4
1 1 0 ??????/6,Fosc/6
1 1 1 ??????/8,Fosc/8
ECF: PCA??????????, 1--?? CF(CCON.7) ?????
*/
//-----------------------
sfr CL = 0xE9; //PCA ????? 0000,0000
sfr CH = 0xF9; //PCA ????? 0000,0000
//-----------------------
// 7 6 5 4 3 2 1 0 Reset Value
sfr CCAPM0 = 0xDA; //PCA ??0 PWM ??? - ECOM0 CAPP0 CAPN0 MAT0 TOG0 PWM0 ECCF0 x000,0000
sfr CCAPM1 = 0xDB; //PCA ??1 PWM ??? - ECOM1 CAPP1 CAPN1 MAT1 TOG1 PWM1 ECCF1 x000,0000
//ECOMn = 1:???????
//CAPPn = 1:????????????
//CAPNn = 1:????????????
//MATn = 1:????????, ?? CCON ?? CCFn ???
//TOGn = 1:????????, CEXn ????
//PWMn = 1:? CEXn ??? PWM ???
//ECCFn = 1:?? CCON ?? CCFn ?????
//ECOMn CAPPn CAPNn MATn TOGn PWMn ECCFn
// 0 0 0 0 0 0 0 0x00 ????????
// x 1 0 0 0 0 x 0x21 16?CEXn??????????
// x 0 1 0 0 0 x 0x11 16?CEXn??????????
// x 1 1 0 0 0 x 0x31 16?CEXn??(????)???????
// 1 0 0 1 0 0 x 0x49 16???????
// 1 0 0 1 1 0 x 0x4d 16????????
// 1 0 0 0 0 1 0 0x42 8? PWM?
//ECOMn CAPPn CAPNn MATn TOGn PWMn ECCFn
// 0 0 0 0 0 0 0 0x00 ????
// 1 0 0 0 0 1 0 0x42 ??8?PWM, ???
// 1 1 0 0 0 1 1 0x63 PWM???????????
// 1 0 1 0 0 1 1 0x53 PWM???????????
// 1 1 1 0 0 1 1 0x73 PWM?????????????????
//-----------------------
sfr CCAP0L = 0xEA; //PCA ?? 0 ???/?????? 8 ?? 0000,0000
sfr CCAP0H = 0xFA; //PCA ?? 0 ???/?????? 8 ?? 0000,0000
sfr CCAP1L = 0xEB; //PCA ?? 1 ???/?????? 8 ?? 0000,0000
sfr CCAP1H = 0xFB; //PCA ?? 1 ???/?????? 8 ?? 0000,0000
//-----------------------
// 7 6 5 4 3 2 1 0 Reset Value
sfr PCA_PWM0 = 0xF2; //PCA ??0 PWM ???? - - - - - - EPC0H EPC0L xxxx,xx00
sfr PCA_PWM1 = 0xF3; //PCA ??1 PWM ???? - - - - - - EPC1H EPC1L xxxx,xx00
//PCA_PWMn: 7 6 5 4 3 2 1 0
// - - - - - - EPCnH EPCnL
//B7-B2: ??
//B1(EPCnH): ? PWM ???,? CCAPnH ?? 9 ???
//B0(EPCnL): ? PWM ???,? CCAPnL ?? 9 ???
//--------------------------------------------------------------------------------
//??? 1T 8051?? ??? ADC ???????
// 7 6 5 4 3 2 1 0 Reset Value
sfr ADC_CONTR = 0xBC; //A/D ??????? ADC_POWER SPEED1 SPEED0 ADC_FLAG ADC_START CHS2 CHS1 CHS0 0000,0000
sfr ADC_RES = 0xBD; //A/D ?????8? ADCV.9 ADCV.8 ADCV.7 ADCV.6 ADCV.5 ADCV.4 ADCV.3 ADCV.2 0000,0000
sfr ADC_RESL = 0xBE; //A/D ?????2? ADCV.1 ADCV.0 0000,0000
//--------------------------------------------------------------------------------
//??? 1T 8051?? ??? SPI ???????
// 7 6 5 4 3 2 1 0 Reset Value
sfr SPCTL = 0xCE; //SPI Control Register SSIG SPEN DORD MSTR CPOL CPHA SPR1 SPR0 0000,0100
sfr SPSTAT = 0xCD; //SPI Status Register SPIF WCOL - - - - - - 00xx,xxxx
sfr SPDAT = 0xCF; //SPI Data Register 0000,0000
//--------------------------------------------------------------------------------
//??? 1T 8051?? ??? IAP/ISP ???????
sfr IAP_DATA = 0xC2;
sfr IAP_ADDRH = 0xC3;
sfr IAP_ADDRL = 0xC4;
// 7 6 5 4 3 2 1 0 Reset Value
sfr IAP_CMD = 0xC5; //IAP Mode Table 0 - - - - - MS1 MS0 0xxx,xx00
sfr IAP_TRIG = 0xC6;
sfr IAP_CONTR = 0xC7; //IAP Control Register IAPEN SWBS SWRST CFAIL - WT2 WT1 WT0 0000,x000
//--------------------------------------------------------------------------------
/////////////////////////////////////////////////
#endif

View File

@ -0,0 +1 @@
"main.c" ROM(COMPACT) BROWSE DEBUG OBJECTEXTEND TABS (2)

200
c51/relay_controller/main.c Normal file
View File

@ -0,0 +1,200 @@
/*------------------------------------------------------------------*/
/* --- STC MCU Limited ---------------------------------------------*/
/* --- STC10/11xx Series MCU UART (8-bit/9-bit)Demo ----------------*/
/* --- Mobile: (86)13922805190 -------------------------------------*/
/* --- Fax: 86-0513-55012956,55012947,55012969 ---------------------*/
/* --- Tel: 86-0513-55012928,55012929,55012966----------------------*/
/* --- Web: www.STCMCU.com -----------------------------------------*/
/* --- Web: www.GXWMCU.com -----------------------------------------*/
/* If you want to use the program or the program referenced in the */
/* article, please specify in which data and procedures from STC */
/*------------------------------------------------------------------*/
#include "STC11.h"
#include "intrins.h"
typedef unsigned char BYTE;
typedef unsigned int WORD;
/*Define UART parity mode*/
#define NONE_PARITY 0 //None parity
#define ODD_PARITY 1 //Odd parity
#define EVEN_PARITY 2 //Even parity
#define MARK_PARITY 3 //Mark parity
#define SPACE_PARITY 4 //Space parity
#define PARITYBIT NONE_PARITY //Testing even parity
#define UART_P1 0x80 //(AUXR1.7) switch RXD/TXD from P3.0/P3.1 to P1.6/P1.7
sbit bit9 = P2^2; //P2.2 show UART data bit9
bit busy;
bit recv_flag = 0;
bit overflow_flag = 0;
char recv_buf[30] = {0};
char index = 0;
void SendData(BYTE dat);
void SendString(char *s);
code char SetUp[30] = "ATE0\r\n";
code char Connect[] = "AT+CIPSTART=\"TCP\",\"192.168.2.108\",8080\r\n";
void P1_Uart(){
AUXR1 &= 0x7f;
AUXR1 |= UART_P1;
}
void P3_Uart(){
AUXR1 &= 0x7f;
}
void Delay3020ms() //@11.0592MHz
{
unsigned char i, j, k;
_nop_();
_nop_();
i = 127;
j = 233;
k = 148;
do
{
do
{
while (--k);
} while (--j);
} while (--i);
}
void Delay1020us() //@11.0592MHz
{
unsigned char i, j;
i = 11;
j = 246;
do
{
while (--j);
} while (--i);
}
void Uart_Init(){
PCON &= 0x7F; //??????
SCON = 0x50; //8???,?????
AUXR |= 0x40; //???1???Fosc,?1T
AUXR &= 0xFE; //??1?????1???????
TMOD &= 0x0F; //?????1???
TMOD |= 0x20; //?????1?8???????
TL1 = 0xFD; //??????
TH1 = 0xFD; //????????
ET1 = 0; //?????1??
TR1 = 1; //?????1
}
void callbackUart(){
if (recv_flag == 1 || overflow_flag == 1){
P3_Uart();
SendString(recv_buf);
recv_flag = 0;
overflow_flag = 0;
P1_Uart();
}
}
void main()
{
bit flag1 = 0;
bit flag2 = 0;
Delay3020ms();
Delay3020ms();
Delay3020ms();
Uart_Init();
P1M1 = 0x00;
P1M0 = 0x3f; // realy gpio init
// open uart interrupt
ES = 1;
EA = 1;
REN = 1;
P1_Uart();
Delay1020us();
// close P1 input
//P1 = 0X00;
Delay1020us();
while(1){
if (flag1 == 0){
flag1 = 1;
SendString(SetUp);
Delay3020ms();
}
callbackUart();
if ((flag1 == 1) && (flag2 == 0)) {
flag2 = 1;
SendString(Connect);
Delay3020ms();
}
callbackUart();
};
}
/*----------------------------
UART interrupt service routine
----------------------------*/
void Uart_Isr() interrupt 4
{
static char last_byte;
if (RI)
{
RI = 0; //Clear receive interrupt flag
if((last_byte == '\r') &&(SBUF == '\n' )&& (index != 1)) {
recv_flag = 1;
index = 0;
}
RI = 0;
recv_buf[index] = SBUF;
last_byte = SBUF;
index ++;
if(index > 29){
index = 0;
overflow_flag = 1;
}
}
if (TI)
{
TI = 0; //Clear transmit interrupt flag
busy = 0; //Clear transmit busy flag
}
}
/*----------------------------
Send a byte data to UART
Input: dat (data to be sent)
Output:None
----------------------------*/
void SendData(BYTE dat)
{
while(busy == 1) return;
ACC = dat; //Calculate the even parity bit P (PSW.0)
busy = 1;
SBUF = ACC; //Send data to UART buffer
while(busy == 1) ;
}
/*----------------------------
Send a string to UART
Input: s (address of string)
Output:None
----------------------------*/
void SendString(char *s)
{
while (*s != '\0') //Check the end of the string
{
Delay1020us();
SendData(*s++); //Send current char and increment string ptr
}
}

BIN
c51/relay_controller/relay Normal file

Binary file not shown.

View File

@ -0,0 +1,355 @@
BL51 BANKED LINKER/LOCATER V6.22 07/13/2019 21:58:43 PAGE 1
BL51 BANKED LINKER/LOCATER V6.22, INVOKED BY:
D:\C51\C51\BIN\BL51.EXE STARTUP.obj, main.obj TO relay RAMSIZE (256)
MEMORY MODEL: SMALL
INPUT MODULES INCLUDED:
STARTUP.obj (?C_STARTUP)
main.obj (MAIN)
D:\C51\C51\LIB\C51S.LIB (?C_INIT)
D:\C51\C51\LIB\C51S.LIB (?C?CLDPTR)
LINK MAP OF MODULE: relay (?C_STARTUP)
TYPE BASE LENGTH RELOCATION SEGMENT NAME
-----------------------------------------------------
* * * * * * * D A T A M E M O R Y * * * * * * *
REG 0000H 0008H ABSOLUTE "REG BANK 0"
DATA 0008H 0003H UNIT _DATA_GROUP_
000BH 0015H *** GAP ***
BIT 0020H.0 0000H.3 UNIT ?BI?MAIN
BIT 0020H.3 0000H.2 UNIT _BIT_GROUP_
0020H.5 0000H.3 *** GAP ***
DATA 0021H 0020H UNIT ?DT?MAIN
IDATA 0041H 0001H UNIT ?STACK
* * * * * * * C O D E M E M O R Y * * * * * * *
CODE 0000H 0003H ABSOLUTE
0003H 0020H *** GAP ***
CODE 0023H 0003H ABSOLUTE
0026H 07DAH *** GAP ***
CODE 0800H 008CH UNIT ?C_C51STARTUP
CODE 088CH 0052H INBLOCK ?PR?MAIN?MAIN
CODE 08DEH 004DH INBLOCK ?PR?UART_ISR?MAIN
CODE 092BH 0047H UNIT ?CO?MAIN
CODE 0972H 002CH INBLOCK ?PR?_SENDSTRING?MAIN
CODE 099EH 0028H UNIT ?C_INITSEG
CODE 09C6H 001DH INBLOCK ?PR?UART_INIT?MAIN
CODE 09E3H 001AH INBLOCK ?PR?CALLBACKUART?MAIN
CODE 09FDH 0019H UNIT ?C?LIB_CODE
CODE 0A16H 000FH INBLOCK ?PR?DELAY3020MS?MAIN
CODE 0A25H 000DH INBLOCK ?PR?_SENDDATA?MAIN
CODE 0A32H 0009H INBLOCK ?PR?DELAY1020US?MAIN
CODE 0A3BH 0007H INBLOCK ?PR?P1_UART?MAIN
CODE 0A42H 0004H INBLOCK ?PR?P3_UART?MAIN
OVERLAY MAP OF MODULE: relay (?C_STARTUP)
SEGMENT BIT_GROUP DATA_GROUP
+--> CALLED SEGMENT START LENGTH START LENGTH
------------------------------------------------------------------
BL51 BANKED LINKER/LOCATER V6.22 07/13/2019 21:58:43 PAGE 2
?C_C51STARTUP ----- ----- ----- -----
+--> ?PR?MAIN?MAIN
+--> ?C_INITSEG
?PR?MAIN?MAIN 0020H.3 0000H.2 ----- -----
+--> ?PR?DELAY3020MS?MAIN
+--> ?PR?UART_INIT?MAIN
+--> ?PR?P1_UART?MAIN
+--> ?PR?DELAY1020US?MAIN
+--> ?CO?MAIN
+--> ?PR?_SENDSTRING?MAIN
+--> ?PR?CALLBACKUART?MAIN
?PR?_SENDSTRING?MAIN ----- ----- 0008H 0003H
+--> ?PR?DELAY1020US?MAIN
+--> ?PR?_SENDDATA?MAIN
?PR?CALLBACKUART?MAIN ----- ----- ----- -----
+--> ?PR?P3_UART?MAIN
+--> ?PR?_SENDSTRING?MAIN
+--> ?PR?P1_UART?MAIN
SYMBOL TABLE OF MODULE: relay (?C_STARTUP)
VALUE TYPE NAME
----------------------------------
------- MODULE ?C_STARTUP
C:0800H SEGMENT ?C_C51STARTUP
I:0041H SEGMENT ?STACK
C:0000H PUBLIC ?C_STARTUP
D:00E0H SYMBOL ACC
D:00F0H SYMBOL B
D:0083H SYMBOL DPH
D:0082H SYMBOL DPL
N:0000H SYMBOL IBPSTACK
N:0100H SYMBOL IBPSTACKTOP
N:0080H SYMBOL IDATALEN
C:0803H SYMBOL IDATALOOP
N:0000H SYMBOL PBPSTACK
N:0100H SYMBOL PBPSTACKTOP
N:0000H SYMBOL PDATALEN
N:0000H SYMBOL PDATASTART
N:0000H SYMBOL PPAGE
N:0000H SYMBOL PPAGEENABLE
D:00A0H SYMBOL PPAGE_SFR
D:0081H SYMBOL SP
C:0800H SYMBOL STARTUP1
N:0000H SYMBOL XBPSTACK
N:0000H SYMBOL XBPSTACKTOP
N:0000H SYMBOL XDATALEN
N:0000H SYMBOL XDATASTART
C:0000H LINE# 126
C:0800H LINE# 133
C:0802H LINE# 134
BL51 BANKED LINKER/LOCATER V6.22 07/13/2019 21:58:43 PAGE 3
C:0803H LINE# 135
C:0804H LINE# 136
C:0806H LINE# 185
C:0809H LINE# 196
------- ENDMOD ?C_STARTUP
------- MODULE MAIN
C:0000H SYMBOL _ICE_DUMMY_
D:0092H PUBLIC P1M0
C:0A3BH PUBLIC P1_Uart
D:0091H PUBLIC P1M1
D:0080H PUBLIC P0
D:0090H PUBLIC P1
C:0A42H PUBLIC P3_Uart
D:00A0H PUBLIC P2
D:00B0H PUBLIC P3
D:00C0H PUBLIC P4
D:00C8H PUBLIC P5
B:00A8H.7 PUBLIC EA
C:0972H PUBLIC _SendString
C:0A25H PUBLIC _SendData
D:00A8H PUBLIC IE
C:09C6H PUBLIC Uart_Init
B:00A8H.4 PUBLIC ES
D:00B8H PUBLIC IP
C:0A16H PUBLIC Delay3020ms
D:0022H PUBLIC index
B:0098H.0 PUBLIC RI
B:0098H.1 PUBLIC TI
C:0A32H PUBLIC Delay1020us
D:00D8H PUBLIC CCON
C:088CH PUBLIC main
C:08DEH PUBLIC Uart_Isr
B:0020H.0 PUBLIC recv_flag
D:0099H PUBLIC SBUF
D:0087H PUBLIC PCON
D:0098H PUBLIC SCON
D:0089H PUBLIC TMOD
D:0088H PUBLIC TCON
D:008EH PUBLIC AUXR
B:0020H.1 PUBLIC busy
D:00E0H PUBLIC ACC
B:00A8H.3 PUBLIC ET1
D:008DH PUBLIC TH1
C:0949H PUBLIC Connect
C:09E3H PUBLIC callbackUart
D:0023H PUBLIC recv_buf
D:008BH PUBLIC TL1
B:0088H.6 PUBLIC TR1
B:0098H.4 PUBLIC REN
D:00A2H PUBLIC AUXR1
C:092BH PUBLIC SetUp
B:0020H.2 PUBLIC overflow_flag
D:00D0H PUBLIC PSW
------- PROC P1_UART
C:0A3BH LINE# 43
C:0A3BH LINE# 44
BL51 BANKED LINKER/LOCATER V6.22 07/13/2019 21:58:43 PAGE 4
C:0A3EH LINE# 45
C:0A41H LINE# 46
------- ENDPROC P1_UART
------- PROC P3_UART
C:0A42H LINE# 47
C:0A42H LINE# 48
C:0A45H LINE# 49
------- ENDPROC P3_UART
------- PROC DELAY3020MS
------- DO
D:0007H SYMBOL i
D:0006H SYMBOL j
D:0005H SYMBOL k
------- ENDDO
C:0A16H LINE# 50
C:0A16H LINE# 51
C:0A16H LINE# 54
C:0A17H LINE# 55
C:0A18H LINE# 56
C:0A1AH LINE# 57
C:0A1CH LINE# 58
C:0A1EH LINE# 60
C:0A1EH LINE# 62
C:0A1EH LINE# 63
C:0A20H LINE# 64
C:0A22H LINE# 65
C:0A24H LINE# 66
------- ENDPROC DELAY3020MS
------- PROC DELAY1020US
------- DO
D:0007H SYMBOL i
D:0006H SYMBOL j
------- ENDDO
C:0A32H LINE# 68
C:0A32H LINE# 69
C:0A32H LINE# 72
C:0A34H LINE# 73
C:0A36H LINE# 75
C:0A36H LINE# 76
C:0A38H LINE# 77
C:0A3AH LINE# 78
------- ENDPROC DELAY1020US
------- PROC UART_INIT
C:09C6H LINE# 79
C:09C6H LINE# 80
C:09C9H LINE# 81
C:09CCH LINE# 82
C:09CFH LINE# 83
C:09D2H LINE# 84
C:09D5H LINE# 85
C:09D8H LINE# 86
C:09DBH LINE# 87
C:09DEH LINE# 88
C:09E0H LINE# 89
C:09E2H LINE# 90
------- ENDPROC UART_INIT
------- PROC CALLBACKUART
BL51 BANKED LINKER/LOCATER V6.22 07/13/2019 21:58:43 PAGE 5
C:09E3H LINE# 92
C:09E3H LINE# 93
C:09E9H LINE# 94
C:09ECH LINE# 95
C:09F5H LINE# 96
C:09F7H LINE# 97
C:09F9H LINE# 98
C:09FCH LINE# 99
C:09FCH LINE# 100
------- ENDPROC CALLBACKUART
------- PROC MAIN
------- DO
B:0020H.3 SYMBOL flag1
B:0020H.4 SYMBOL flag2
------- ENDDO
C:088CH LINE# 101
C:088CH LINE# 102
C:088CH LINE# 103
C:088EH LINE# 104
C:0890H LINE# 105
C:0893H LINE# 107
C:0896H LINE# 108
C:0899H LINE# 109
C:089CH LINE# 111
C:089FH LINE# 112
C:08A2H LINE# 115
C:08A4H LINE# 116
C:08A6H LINE# 117
C:08A8H LINE# 118
C:08ABH LINE# 119
C:08AEH LINE# 122
C:08B1H LINE# 125
C:08B1H LINE# 126
C:08B4H LINE# 127
C:08B6H LINE# 128
C:08BFH LINE# 129
C:08C2H LINE# 131
C:08C2H LINE# 132
C:08C5H LINE# 133
C:08CBH LINE# 134
C:08CDH LINE# 135
C:08D6H LINE# 136
C:08D9H LINE# 138
C:08D9H LINE# 139
C:08DCH LINE# 140
------- ENDPROC MAIN
------- PROC UART_ISR
------- DO
D:0021H SYMBOL last_byte
------- ENDDO
C:08DEH LINE# 146
C:08E7H LINE# 149
C:08EAH LINE# 150
C:08EAH LINE# 151
C:08ECH LINE# 152
C:08FCH LINE# 153
C:08FEH LINE# 154
BL51 BANKED LINKER/LOCATER V6.22 07/13/2019 21:58:43 PAGE 6
C:0901H LINE# 155
C:0901H LINE# 156
C:0903H LINE# 157
C:090AH LINE# 158
C:090DH LINE# 159
C:090FH LINE# 160
C:0918H LINE# 161
C:091BH LINE# 162
C:091DH LINE# 163
C:091DH LINE# 164
C:091DH LINE# 165
C:0920H LINE# 166
C:0920H LINE# 167
C:0922H LINE# 168
C:0924H LINE# 169
C:0924H LINE# 170
------- ENDPROC UART_ISR
------- PROC _SENDDATA
D:0007H SYMBOL dat
C:0A25H LINE# 177
C:0A25H LINE# 178
C:0A25H LINE# 179
C:0A29H LINE# 180
C:0A2AH LINE# 182
C:0A2CH LINE# 183
C:0A2EH LINE# 184
C:0A31H LINE# 185
------- ENDPROC _SENDDATA
------- PROC _SENDSTRING
D:0008H SYMBOL s
C:0972H LINE# 192
C:0978H LINE# 193
C:0978H LINE# 194
C:0983H LINE# 195
C:0983H LINE# 196
C:0986H LINE# 197
C:099BH LINE# 198
C:099DH LINE# 199
------- ENDPROC _SENDSTRING
------- ENDMOD MAIN
------- MODULE ?C?CLDPTR
C:09FDH PUBLIC ?C?CLDPTR
------- ENDMOD ?C?CLDPTR
******************************************************************************
* RESTRICTED VERSION WITH 0800H BYTE CODE SIZE LIMIT; USED: 01B2H BYTE (21%) *
******************************************************************************
Program Size: data=44.5 xdata=0 code=588
LINK/LOCATE RUN COMPLETE. 0 WARNING(S), 0 ERROR(S)

View File

@ -0,0 +1,49 @@
:03000000020800F3
:0C080000787FE4F6D8FD758140020847BF
:10092B00415445300D0A000000000000000000009B
:10093B000000000000000000000000000000415417
:10094B002B43495053544152543D22544350222C73
:10095B00223139322E3136382E322E313038222C8C
:07096B00383038300D0A009E
:10099E00C100C1021E230000000000000000000084
:1009AE000000000000000000000000000000000039
:0709BE00000000000122000F
:070A3B0053A27F43A28022B9
:040A420053A27F221A
:0E0A160000007F7F7EE97D94DDFEDEFCDFFACE
:010A240022AF
:080A32007F0B7EF6DEFEDFFC07
:010A3A002299
:1009C60053877F759850438E40538EFE53890F434D
:0D09D6008920758BFD758DFDC2ABD28E2280
:1009E300200003300213120A427B007A007923129B
:0A09F3000972C200C202120A3B2280
:10088C00C203C204120A16120A16120A161209C65A
:10089C00E4F59175923FD2ACD2AFD29C120A3B12C6
:1008AC000A32120A3220030ED2037BFF7A09792B0B
:1008BC00120972120A161209E330031120040ED227
:1008CC00047BFF7A097949120972120A161209E39C
:0208DC0080D3C7
:030023000208DEF2
:0908DE00C0E0C0D075D000C000DC
:1008E700309833C298E521B40D10E599B40A0BE5A9
:1008F7002264016005D200752200C2987423252264
:10090700F8A6998599210522D3E5226480949D4014
:0D09170005752200D202309904C299C20178
:07092400D000D0D0D0E0327A
:0D0A250030010122EFD201F5992001FD22E0
:100972008B088A09890AAB08AA09A90A1209FD602B
:100982001A120A32AB08050AE50AAA097002050919
:0C09920014F91209FDFF120A2580DB2277
:10080C0002088CE493A3F8E493A34003F68001F26E
:10081C0008DFF48029E493A3F85407240CC8C333ED
:10082C00C4540F4420C8834004F456800146F6DFBC
:10083C00E4800B010204081020408090099EE47EA5
:10084C00019360BCA3FF543F30E509541FFEE493B1
:10085C00A360010ECF54C025E060A840B8E493A378
:10086C00FAE493A3F8E493A3C8C582C8CAC583CAA3
:10087C00F0A3C8C582C8CAC583CADFE9DEE780BE5B
:0109C5000031
:1009FD00BB010689828A83E0225002E722BBFE02F8
:090A0D00E32289828A83E493222A
:00000001FF

View File

@ -0,0 +1,4 @@
"STARTUP.obj",
"main.obj"
TO "relay"
RAMSIZE(256)

View File

@ -0,0 +1,636 @@
<html>
<body>
<pre>
<h1>µVision Build Log</h1>
<h2>Project:</h2>
D:\project\relay_controller\relay.uvproj
Project File Date: 07/08/2019
<h2>Output:</h2>
Build target 'Target 1'
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=495
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=39.3 xdata=0 code=498
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=39.3 xdata=0 code=507
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=39.3 xdata=0 code=505
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
main.c(112): warning C206: 'Delay1020sus': missing function-prototype
linking...
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
ADDRESS: 08AEH
Program Size: data=39.3 xdata=0 code=505
creating hex file from "relay"...
"relay" - 0 Error(s), 3 Warning(s).
Build target 'Target 1'
compiling main.c...
main.c(112): warning C206: 'Delay1020sus': missing function-prototype
linking...
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
ADDRESS: 08AEH
Program Size: data=39.3 xdata=0 code=505
creating hex file from "relay"...
"relay" - 0 Error(s), 3 Warning(s).
Build target 'Target 1'
compiling main.c...
main.c(111): warning C206: 'Delay1020sus': missing function-prototype
linking...
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
ADDRESS: 08AEH
Program Size: data=39.3 xdata=0 code=502
creating hex file from "relay"...
"relay" - 0 Error(s), 3 Warning(s).
Build target 'Target 1'
compiling main.c...
main.c(111): warning C206: 'Delay1020sus': missing function-prototype
linking...
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
ADDRESS: 08AEH
Program Size: data=39.3 xdata=0 code=502
creating hex file from "relay"...
"relay" - 0 Error(s), 3 Warning(s).
Build target 'Target 1'
compiling main.c...
main.c(111): warning C206: 'Delay1020sus': missing function-prototype
linking...
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
ADDRESS: 08AEH
Program Size: data=39.3 xdata=0 code=502
creating hex file from "relay"...
"relay" - 0 Error(s), 3 Warning(s).
Build target 'Target 1'
compiling main.c...
main.c(111): warning C206: 'Delay1020sus': missing function-prototype
linking...
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
ADDRESS: 08AEH
Program Size: data=39.3 xdata=0 code=502
creating hex file from "relay"...
"relay" - 0 Error(s), 3 Warning(s).
Build target 'Target 1'
compiling main.c...
main.c(111): warning C206: 'Delay1020sus': missing function-prototype
linking...
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
ADDRESS: 08EFH
Program Size: data=39.3 xdata=0 code=496
creating hex file from "relay"...
"relay" - 0 Error(s), 3 Warning(s).
Build target 'Target 1'
compiling main.c...
main.c(112): warning C206: 'Delay1020sus': missing function-prototype
linking...
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
ADDRESS: 08ABH
Program Size: data=39.3 xdata=0 code=499
creating hex file from "relay"...
"relay" - 0 Error(s), 3 Warning(s).
Build target 'Target 1'
compiling main.c...
main.c(112): warning C206: 'Delay1020sus': missing function-prototype
linking...
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: DELAY1020SUS
MODULE: main.obj (MAIN)
ADDRESS: 08ABH
Program Size: data=39.3 xdata=0 code=499
creating hex file from "relay"...
"relay" - 0 Error(s), 3 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=495
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=490
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=495
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=495
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=495
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
compiling main.c...
main.c - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=495
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=495
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=492
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=492
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=495
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=490
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=493
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=493
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=499
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=499
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=499
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=499
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
main.c(114): error C202: 'TXEN': undefined identifier
Target not created
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=511
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=511
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=512
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=494
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=491
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY3020MS?MAIN
Program Size: data=39.3 xdata=0 code=488
creating hex file from "relay"...
"relay" - 0 Error(s), 1 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=39.3 xdata=0 code=497
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=39.3 xdata=0 code=497
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.3 xdata=0 code=502
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.3 xdata=0 code=502
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.3 xdata=0 code=502
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.3 xdata=0 code=502
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.3 xdata=0 code=502
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
linking...
Program Size: data=44.3 xdata=0 code=502
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.3 xdata=0 code=502
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.3 xdata=0 code=508
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.3 xdata=0 code=508
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.3 xdata=0 code=508
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.3 xdata=0 code=508
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.3 xdata=0 code=508
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
linking...
Program Size: data=44.3 xdata=0 code=508
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.3 xdata=0 code=508
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.5 xdata=0 code=587
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.5 xdata=0 code=596
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.5 xdata=0 code=596
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
linking...
Program Size: data=44.5 xdata=0 code=596
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Rebuild target 'Target 1'
assembling STARTUP.A51...
compiling main.c...
linking...
Program Size: data=44.5 xdata=0 code=587
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.5 xdata=0 code=587
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
linking...
Program Size: data=44.5 xdata=0 code=587
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.5 xdata=0 code=568
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.3 xdata=0 code=549
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
main.c(93): error C141: syntax error near 'sbit'
main.c(93): error C202: 'flag1': undefined identifier
main.c(94): error C141: syntax error near 'sbit'
main.c(94): error C202: 'flag2': undefined identifier
main.c(117): error C202: 'flag1': undefined identifier
main.c(118): error C202: 'flag1': undefined identifier
main.c(121): error C202: 'flag1': undefined identifier
main.c(122): error C202: 'flag1': undefined identifier
Target not created
Build target 'Target 1'
compiling main.c...
main.c(93): error C141: syntax error near 'sbit'
main.c(93): error C202: 'flag2': undefined identifier
main.c(94): error C141: syntax error near 'sbit'
main.c(94): error C202: 'flag1': undefined identifier
main.c(116): error C202: 'flag1': undefined identifier
main.c(117): error C202: 'flag1': undefined identifier
main.c(120): error C202: 'flag1': undefined identifier
main.c(121): error C202: 'flag1': undefined identifier
Target not created
compiling main.c...
main.c(93): error C141: syntax error near 'sbit'
main.c(93): error C202: 'flag2': undefined identifier
main.c(94): error C141: syntax error near 'sbit'
main.c(94): error C202: 'flag1': undefined identifier
main.c(116): error C202: 'flag1': undefined identifier
main.c(117): error C202: 'flag1': undefined identifier
main.c(120): error C202: 'flag1': undefined identifier
main.c(121): error C202: 'flag1': undefined identifier
main.c - 8 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
main.c(93): error C141: syntax error near 'sbit'
main.c(93): error C202: 'flag2': undefined identifier
main.c(94): error C141: syntax error near 'sbit'
main.c(94): error C202: 'flag1': undefined identifier
main.c(116): error C202: 'flag1': undefined identifier
main.c(117): error C202: 'flag1': undefined identifier
main.c(120): error C202: 'flag1': undefined identifier
main.c(121): error C202: 'flag1': undefined identifier
Target not created
Build target 'Target 1'
compiling main.c...
main.c(93): error C202: 'bool': undefined identifier
main.c(93): error C141: syntax error near 'flag1'
main.c(94): error C202: 'bool': undefined identifier
main.c(94): error C141: syntax error near 'flag2'
main.c(116): error C202: 'flag1': undefined identifier
main.c(117): error C202: 'flag1': undefined identifier
main.c(120): error C202: 'flag1': undefined identifier
main.c(121): error C202: 'flag1': undefined identifier
Target not created
Build target 'Target 1'
compiling main.c...
main.c(94): error C202: 'bool': undefined identifier
main.c(94): error C141: syntax error near 'flag2'
main.c(120): error C202: 'flag2': undefined identifier
Target not created
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.5 xdata=0 code=575
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.5 xdata=0 code=575
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
linking...
Program Size: data=44.5 xdata=0 code=575
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.5 xdata=0 code=596
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.5 xdata=0 code=597
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
linking...
Program Size: data=44.5 xdata=0 code=597
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.5 xdata=0 code=603
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.5 xdata=0 code=577
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.5 xdata=0 code=605
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
linking...
Program Size: data=44.5 xdata=0 code=605
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.5 xdata=0 code=601
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.5 xdata=0 code=603
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=44.5 xdata=0 code=588
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
linking...
Program Size: data=44.5 xdata=0 code=588
creating hex file from "relay"...
"relay" - 0 Error(s), 0 Warning(s).

File diff suppressed because one or more lines are too long

347
c51/relay_controller/stc.h Normal file
View File

@ -0,0 +1,347 @@
#ifndef __STC12C5A60S2_H_
#define __STC12C5A60S2_H_
/////////////////////////////////////////////////
//--------------------------------------------------------------------------------
//??? 1T 8051?? ???????????? C51 Core SFRs
// 7 6 5 4 3 2 1 0 Reset Value
sfr ACC = 0xE0; //Accumulator 0000,0000
sfr B = 0xF0; //B Register 0000,0000
sfr PSW = 0xD0; //Program Status Word CY AC F0 RS1 RS0 OV F1 P 0000,0000
//-----------------------------------
sbit CY = PSW^7;
sbit AC = PSW^6;
sbit F0 = PSW^5;
sbit RS1 = PSW^4;
sbit RS0 = PSW^3;
sbit OV = PSW^2;
sbit P = PSW^0;
//-----------------------------------
sfr SP = 0x81; //Stack Pointer 0000,0111
sfr DPL = 0x82; //Data Pointer Low Byte 0000,0000
sfr DPH = 0x83; //Data Pointer High Byte 0000,0000
//--------------------------------------------------------------------------------
//??? 1T 8051?? ??????????????
// 7 6 5 4 3 2 1 0 Reset Value
sfr PCON = 0x87; //Power Control SMOD SMOD0 LVDF POF GF1 GF0 PD IDL 0001,0000
// 7 6 5 4 3 2 1 0 Reset Value
sfr AUXR = 0x8E; //Auxiliary Register T0x12 T1x12 UART_M0x6 BRTR S2SMOD BRTx12 EXTRAM S1BRS 0000,0000
//-----------------------------------
sfr AUXR1 = 0xA2; //Auxiliary Register 1 - PCA_P4 SPI_P4 S2_P4 GF2 ADRJ - DPS 0000,0000
/*
PCA_P4:
0, ??PCA ?P1 ?
1,PCA/PWM ?P1 ????P4 ?: ECI ?P1.2 ???P4.1 ?,
PCA0/PWM0 ?P1.3 ???P4.2 ?
PCA1/PWM1 ?P1.4 ???P4.3 ?
SPI_P4:
0, ??SPI ?P1 ?
1,SPI ?P1 ????P4 ?: SPICLK ?P1.7 ???P4.3 ?
MISO ?P1.6 ???P4.2 ?
MOSI ?P1.5 ???P4.1 ?
SS ?P1.4 ???P4.0 ?
S2_P4:
0, ??UART2 ?P1 ?
1,UART2 ?P1 ????P4 ?: TxD2 ?P1.3 ???P4.3 ?
RxD2 ?P1.2 ???P4.2 ?
GF2: ?????
ADRJ:
0, 10 ?A/D ??????8 ???ADC_RES ???, ?2 ???ADC_RESL ???
1,10 ?A/D ???????2 ???ADC_RES ?????2 ?, ?8 ???ADC_RESL ???
DPS: 0, ????????DPTR0
1,?????????DPTR1
*/
//-----------------------------------
sfr WAKE_CLKO = 0x8F; //??? SFR WAK1_CLKO
/*
7 6 5 4 3 2 1 0 Reset Value
PCAWAKEUP RXD_PIN_IE T1_PIN_IE T0_PIN_IE LVD_WAKE _ T1CLKO T0CLKO 0000,0000B
b7 - PCAWAKEUP : PCA ????? powerdown?
b6 - RXD_PIN_IE : ? P3.0(RXD) ????? RI ???? powerdown(????????)?
b5 - T1_PIN_IE : ? T1 ?????? T1 ???????? powerdown(????????)?
b4 - T0_PIN_IE : ? T0 ?????? T0 ???????? powerdown(????????)?
b3 - LVD_WAKE : ? CMPIN ?????? LVD ???????? powerdown(????????)?
b2 -
b1 - T1CLKO : ?? T1CKO(P3.5) ??? T1 ????,Fck1 = 1/2 T1 ???
b0 - T0CLKO : ?? T0CKO(P3.4) ??? T0 ????,Fck0 = 1/2 T1 ???
*/
//-----------------------------------
sfr CLK_DIV = 0x97; //Clock Divder - - - - - CLKS2 CLKS1 CLKS0 xxxx,x000
//-----------------------------------
sfr BUS_SPEED = 0xA1; //Stretch register - - ALES1 ALES0 - RWS2 RWS1 RWS0 xx10,x011
/*
ALES1 and ALES0:
00 : The P0 address setup time and hold time to ALE negative edge is one clock cycle
01 : The P0 address setup time and hold time to ALE negative edge is two clock cycles.
10 : The P0 address setup time and hold time to ALE negative edge is three clock cycles. (default)
11 : The P0 address setup time and hold time to ALE negative edge is four clock cycles.
RWS2,RWS1,RWS0:
000 : The MOVX read/write pulse is 1 clock cycle.
001 : The MOVX read/write pulse is 2 clock cycles.
010 : The MOVX read/write pulse is 3 clock cycles.
011 : The MOVX read/write pulse is 4 clock cycles. (default)
100 : The MOVX read/write pulse is 5 clock cycles.
101 : The MOVX read/write pulse is 6 clock cycles.
110 : The MOVX read/write pulse is 7 clock cycles.
111 : The MOVX read/write pulse is 8 clock cycles.
*/
//--------------------------------------------------------------------------------
//??? 1T 8051?? ????????????
//?????????????????????????,??????????
//???????????,??? ??? 1T 8051?? ???????
// 7 6 5 4 3 2 1 0 Reset Value
sfr IE = 0xA8; //??????? EA ELVD EADC ES ET1 EX1 ET0 EX0 0x00,0000
//-----------------------
sbit EA = IE^7;
sbit ELVD = IE^6; //?????????
sbit EADC = IE^5; //ADC ?????
sbit ES = IE^4;
sbit ET1 = IE^3;
sbit EX1 = IE^2;
sbit ET0 = IE^1;
sbit EX0 = IE^0;
//-----------------------
sfr IE2 = 0xAF; //Auxiliary Interrupt - - - - - - ESPI ES2 0000,0000B
//-----------------------
// 7 6 5 4 3 2 1 0 Reset Value
sfr IP = 0xB8; //??????? PPCA PLVD PADC PS PT1 PX1 PT0 PX0 0000,0000
//--------
sbit PPCA = IP^7; //PCA ???????
sbit PLVD = IP^6; //?????????
sbit PADC = IP^5; //ADC ?????
sbit PS = IP^4;
sbit PT1 = IP^3;
sbit PX1 = IP^2;
sbit PT0 = IP^1;
sbit PX0 = IP^0;
//-----------------------
// 7 6 5 4 3 2 1 0 Reset Value
sfr IPH = 0xB7; //??????? PPCAH PLVDH PADCH PSH PT1H PX1H PT0H PX0H 0000,0000
sfr IP2 = 0xB5; // - - - - - - PSPI PS2 xxxx,xx00
sfr IPH2 = 0xB6; // - - - - - - PSPIH PS2H xxxx,xx00
//-----------------------
//??? 1T 8051?? ???I/O ????????
// 7 6 5 4 3 2 1 0 Reset Value
sfr P0 = 0x80; //8 bitPort0 P0.7 P0.6 P0.5 P0.4 P0.3 P0.2 P0.1 P0.0 1111,1111
sbit P00 = P0^0;
sbit P01 = P0^1;
sbit P02 = P0^2;
sbit P03 = P0^3;
sbit P04 = P0^4;
sbit P05 = P0^5;
sbit P06 = P0^6;
sbit P07 = P0^7;
sfr P0M0 = 0x94; // 0000,0000
sfr P0M1 = 0x93; // 0000,0000
sfr P1 = 0x90; //8 bitPort1 P1.7 P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0 1111,1111
sbit P10 = P1^0;
sbit P11 = P1^1;
sbit P12 = P1^2;
sbit P13 = P1^3;
sbit P14 = P1^4;
sbit P15 = P1^5;
sbit P16 = P1^6;
sbit P17 = P1^7;
sfr P1M0 = 0x92; // 0000,0000
sfr P1M1 = 0x91; // 0000,0000
sfr P1ASF = 0x9D; //P1 analog special function
sfr P2 = 0xA0; //8 bitPort2 P2.7 P2.6 P2.5 P2.4 P2.3 P2.2 P2.1 P2.0 1111,1111
sbit P20 = P2^0;
sbit P21 = P2^1;
sbit P22 = P2^2;
sbit P23 = P2^3;
sbit P24 = P2^4;
sbit P25 = P2^5;
sbit P26 = P2^6;
sbit P27 = P2^7;
sfr P2M0 = 0x96; // 0000,0000
sfr P2M1 = 0x95; // 0000,0000
sfr P3 = 0xB0; //8 bitPort3 P3.7 P3.6 P3.5 P3.4 P3.3 P3.2 P3.1 P3.0 1111,1111
sbit P30 = P3^0;
sbit P31 = P3^1;
sbit P32 = P3^2;
sbit P33 = P3^3;
sbit P34 = P3^4;
sbit P35 = P3^5;
sbit P36 = P3^6;
sbit P37 = P3^7;
sfr P3M0 = 0xB2; // 0000,0000
sfr P3M1 = 0xB1; // 0000,0000
sfr P4 = 0xC0; //8 bitPort4 P4.7 P4.6 P4.5 P4.4 P4.3 P4.2 P4.1 P4.0 1111,1111
sbit P40 = P4^0;
sbit P41 = P4^1;
sbit P42 = P4^2;
sbit P43 = P4^3;
sbit P44 = P4^4;
sbit P45 = P4^5;
sbit P46 = P4^6;
sbit P47 = P4^7;
sfr P4M0 = 0xB4; // 0000,0000
sfr P4M1 = 0xB3; // 0000,0000
// 7 6 5 4 3 2 1 0 Reset Value
sfr P4SW = 0xBB; //Port-4 switch - LVD_P4.6 ALE_P4.5 NA_P4.4 - - - - x000,xxxx
sfr P5 = 0xC8; //8 bitPort5 - - - - P5.3 P5.2 P5.1 P5.0 xxxx,1111
sbit P50 = P5^0;
sbit P51 = P5^1;
sbit P52 = P5^2;
sbit P53 = P5^3;
sfr P5M0 = 0xCA; // 0000,0000
sfr P5M1 = 0xC9; // 0000,0000
//--------------------------------------------------------------------------------
//??? 1T 8051?? ?????????????
// 7 6 5 4 3 2 1 0 Reset Value
sfr TCON = 0x88; //T0/T1 Control TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0 0000,0000
//-----------------------------------
sbit TF1 = TCON^7;
sbit TR1 = TCON^6;
sbit TF0 = TCON^5;
sbit TR0 = TCON^4;
sbit IE1 = TCON^3;
sbit IT1 = TCON^2;
sbit IE0 = TCON^1;
sbit IT0 = TCON^0;
//-----------------------------------
sfr TMOD = 0x89; //T0/T1 Modes GATE1 C/T1 M1_1 M1_0 GATE0 C/T0 M0_1 M0_0 0000,0000
sfr TL0 = 0x8A; //T0 Low Byte 0000,0000
sfr TH0 = 0x8C; //T0 High Byte 0000,0000
sfr TL1 = 0x8B; //T1 Low Byte 0000,0000
sfr TH1 = 0x8D; //T1 High Byte 0000,0000
//--------------------------------------------------------------------------------
//??? 1T 8051?? ?????????????
// 7 6 5 4 3 2 1 0 Reset Value
sfr SCON = 0x98; //Serial Control SM0/FE SM1 SM2 REN TB8 RB8 TI RI 0000,0000
//-----------------------------------
sbit SM0 = SCON^7; //SM0/FE
sbit SM1 = SCON^6;
sbit SM2 = SCON^5;
sbit REN = SCON^4;
sbit TB8 = SCON^3;
sbit RB8 = SCON^2;
sbit TI = SCON^1;
sbit RI = SCON^0;
//-----------------------------------
sfr SBUF = 0x99; //Serial Data Buffer xxxx,xxxx
sfr SADEN = 0xB9; //Slave Address Mask 0000,0000
sfr SADDR = 0xA9; //Slave Address 0000,0000
//-----------------------------------
// 7 6 5 4 3 2 1 0 Reset Value
sfr S2CON = 0x9A; //S2 Control S2SM0 S2SM1 S2SM2 S2REN S2TB8 S2RB8 S2TI S2RI 00000000B
sfr S2BUF = 0x9B; //S2 Serial Buffer xxxx,xxxx
sfr BRT = 0x9C; //S2 Baud-Rate Timer 0000,0000
//--------------------------------------------------------------------------------
//??? 1T 8051?? ????????????????
sfr WDT_CONTR = 0xC1; //Watch-Dog-Timer Control register
// 7 6 5 4 3 2 1 0 Reset Value
// WDT_FLAG - EN_WDT CLR_WDT IDLE_WDT PS2 PS1 PS0 xx00,0000
//-----------------------
//--------------------------------------------------------------------------------
//??? 1T 8051?? ???PCA/PWM ???????
// 7 6 5 4 3 2 1 0 Reset Value
sfr CCON = 0xD8; //PCA ?????? CF CR - - - - CCF1 CCF0 00xx,xx00
//-----------------------
sbit CF = CCON^7; //PCA???????,????????,??????0?
sbit CR = CCON^6; //1:?? PCA ?????, ??????0?
//-
//-
sbit CCF1 = CCON^1; //PCA ??1 ????, ?????, ??????0?
sbit CCF0 = CCON^0; //PCA ??0 ????, ?????, ??????0?
//-----------------------
sfr CMOD = 0xD9; //PCA ???????? CIDL - - - CPS2 CPS1 CPS0 ECF 0xxx,x000
/*
CIDL: idle ??? PCA ?????????, 0: ????, 1: ?????
CPS2: PCA ????????? 2?
CPS1: PCA ????????? 1?
CPS0: PCA ????????? 0?
CPS2 CPS1 CPS0
0 0 0 ?????? fosc/12?
0 0 1 ?????? fosc/2?
0 1 0 Timer0 ???
0 1 1 ? ECI/P3.4 ????????,?? fosc/2?
1 0 0 ??????, Fosc/1
1 0 1 ??????/4,Fosc/4
1 1 0 ??????/6,Fosc/6
1 1 1 ??????/8,Fosc/8
ECF: PCA??????????, 1--?? CF(CCON.7) ?????
*/
//-----------------------
sfr CL = 0xE9; //PCA ????? 0000,0000
sfr CH = 0xF9; //PCA ????? 0000,0000
//-----------------------
// 7 6 5 4 3 2 1 0 Reset Value
sfr CCAPM0 = 0xDA; //PCA ??0 PWM ??? - ECOM0 CAPP0 CAPN0 MAT0 TOG0 PWM0 ECCF0 x000,0000
sfr CCAPM1 = 0xDB; //PCA ??1 PWM ??? - ECOM1 CAPP1 CAPN1 MAT1 TOG1 PWM1 ECCF1 x000,0000
//ECOMn = 1:???????
//CAPPn = 1:????????????
//CAPNn = 1:????????????
//MATn = 1:????????, ?? CCON ?? CCFn ???
//TOGn = 1:????????, CEXn ????
//PWMn = 1:? CEXn ??? PWM ???
//ECCFn = 1:?? CCON ?? CCFn ?????
//ECOMn CAPPn CAPNn MATn TOGn PWMn ECCFn
// 0 0 0 0 0 0 0 0x00 ????????
// x 1 0 0 0 0 x 0x21 16?CEXn??????????
// x 0 1 0 0 0 x 0x11 16?CEXn??????????
// x 1 1 0 0 0 x 0x31 16?CEXn??(????)???????
// 1 0 0 1 0 0 x 0x49 16???????
// 1 0 0 1 1 0 x 0x4d 16????????
// 1 0 0 0 0 1 0 0x42 8? PWM?
//ECOMn CAPPn CAPNn MATn TOGn PWMn ECCFn
// 0 0 0 0 0 0 0 0x00 ????
// 1 0 0 0 0 1 0 0x42 ??8?PWM, ???
// 1 1 0 0 0 1 1 0x63 PWM???????????
// 1 0 1 0 0 1 1 0x53 PWM???????????
// 1 1 1 0 0 1 1 0x73 PWM?????????????????
//-----------------------
sfr CCAP0L = 0xEA; //PCA ?? 0 ???/?????? 8 ?? 0000,0000
sfr CCAP0H = 0xFA; //PCA ?? 0 ???/?????? 8 ?? 0000,0000
sfr CCAP1L = 0xEB; //PCA ?? 1 ???/?????? 8 ?? 0000,0000
sfr CCAP1H = 0xFB; //PCA ?? 1 ???/?????? 8 ?? 0000,0000
//-----------------------
// 7 6 5 4 3 2 1 0 Reset Value
sfr PCA_PWM0 = 0xF2; //PCA ??0 PWM ???? - - - - - - EPC0H EPC0L xxxx,xx00
sfr PCA_PWM1 = 0xF3; //PCA ??1 PWM ???? - - - - - - EPC1H EPC1L xxxx,xx00
//PCA_PWMn: 7 6 5 4 3 2 1 0
// - - - - - - EPCnH EPCnL
//B7-B2: ??
//B1(EPCnH): ? PWM ???,? CCAPnH ?? 9 ???
//B0(EPCnL): ? PWM ???,? CCAPnL ?? 9 ???
//--------------------------------------------------------------------------------
//??? 1T 8051?? ??? ADC ???????
// 7 6 5 4 3 2 1 0 Reset Value
sfr ADC_CONTR = 0xBC; //A/D ??????? ADC_POWER SPEED1 SPEED0 ADC_FLAG ADC_START CHS2 CHS1 CHS0 0000,0000
sfr ADC_RES = 0xBD; //A/D ?????8? ADCV.9 ADCV.8 ADCV.7 ADCV.6 ADCV.5 ADCV.4 ADCV.3 ADCV.2 0000,0000
sfr ADC_RESL = 0xBE; //A/D ?????2? ADCV.1 ADCV.0 0000,0000
//--------------------------------------------------------------------------------
//??? 1T 8051?? ??? SPI ???????
// 7 6 5 4 3 2 1 0 Reset Value
sfr SPCTL = 0xCE; //SPI Control Register SSIG SPEN DORD MSTR CPOL CPHA SPR1 SPR0 0000,0100
sfr SPSTAT = 0xCD; //SPI Status Register SPIF WCOL - - - - - - 00xx,xxxx
sfr SPDAT = 0xCF; //SPI Data Register 0000,0000
//--------------------------------------------------------------------------------
//??? 1T 8051?? ??? IAP/ISP ???????
sfr IAP_DATA = 0xC2;
sfr IAP_ADDRH = 0xC3;
sfr IAP_ADDRL = 0xC4;
// 7 6 5 4 3 2 1 0 Reset Value
sfr IAP_CMD = 0xC5; //IAP Mode Table 0 - - - - - MS1 MS0 0xxx,xx00
sfr IAP_TRIG = 0xC6;
sfr IAP_CONTR = 0xC7; //IAP Control Register IAPEN SWBS SWRST CFAIL - WT2 WT1 WT0 0000,x000
//--------------------------------------------------------------------------------
/////////////////////////////////////////////////
#endif