This commit is contained in:
zibright 2025-04-13 01:02:19 +08:00
commit 7f49742420
1433 changed files with 182535 additions and 0 deletions

12
2025/Driver/Init.c Normal file
View File

@ -0,0 +1,12 @@
#include <Init.h>
void System_Init()
{
P2 = P2 & 0x1f | 0x80;
P0 = 0xff;
P2 &= 0x1f;
P2 = P2 & 0x1f | 0xA0;
P0 = 0x00;
P2 &= 0x1f;
}

3
2025/Driver/Init.h Normal file
View File

@ -0,0 +1,3 @@
#include <STC15F2K60S2.H>
void System_Init();

34
2025/Driver/Key.c Normal file
View File

@ -0,0 +1,34 @@
#include <Key.h>
unsigned char Key_Read()
{
unsigned char temp = 0;
ET0 = 0;
P44 = 0;P42 = 1;P35 = 1;P34 = 1;
if(P33 == 0) temp = 4;
if(P32 == 0) temp = 5;
if(P31 == 0) temp = 6;
if(P30 == 0) temp = 7;
P44 = 1;P42 = 0;P35 = 1;P34 = 1;
if(P33 == 0) temp = 8;
if(P32 == 0) temp = 9;
if(P31 == 0) temp = 10;
if(P30 == 0) temp = 11;
P44 = 1;P42 = 1;P35 = 0;P34 = 1;
if(P33 == 0) temp = 12;
if(P32 == 0) temp = 13;
if(P31 == 0) temp = 14;
if(P30 == 0) temp = 15;
P44 = 1;P42 = 1;P35 = 1;P34 = 0;
if(P33 == 0) temp = 16;
if(P32 == 0) temp = 17;
if(P31 == 0) temp = 18;
if(P30 == 0) temp = 19;
ET0 = 1;P3 = 0xff;
return temp;
}

3
2025/Driver/Key.h Normal file
View File

@ -0,0 +1,3 @@
#include <STC15F2K60S2.H>
unsigned char Key_Read();

20
2025/Driver/Led.c Normal file
View File

@ -0,0 +1,20 @@
#include <Led.h>
void Led_Disp(unsigned char addr,enable)
{
static unsigned char temp = 0x00,temp_old = 0xff;
if(enable)
temp |= 0x01 << addr;
else
temp &= ~(0x01 << addr);
if(temp != temp_old)
{
P2 = P2 & 0x1f | 0x80;
P0 = ~temp;
P2 &= 0x1f;
temp_old = temp;
}
}

3
2025/Driver/Led.h Normal file
View File

@ -0,0 +1,3 @@
#include <STC15F2K60S2.H>
void Led_Disp(unsigned char addr,enable);

31
2025/Driver/Seg.c Normal file
View File

@ -0,0 +1,31 @@
#include <Seg.h>
unsigned char Seg_Dula[]={
0xc0,0xf9,0xa4,0xb0,
0x99,0x92,0x82,0xf8,
0x80,0x90,0x88,0x83,
0xc6,0xa1,0x86,0x8e,
0xff
};
unsigned char Seg_Wela[]={
0x01,0x02,0x04,0x08,
0x10,0x20,0x40,0x80
};
void Seg_Disp(unsigned char Wela,Dula,Point)
{
P2 = P2 & 0x1f | 0xe0;
P0 = 0xff;
P2 &= 0x1f;
P2 = P2 & 0x1f | 0xc0;
P0 = Seg_Wela[Wela];
P2 &= 0x1f;
if(Point)
P0 = Seg_Dula[Dula] & 0x7f;
else
P0 = Seg_Dula[Dula];
P2 = P2 & 0x1f | 0xe0;
P2 &= 0x1f;
}

3
2025/Driver/Seg.h Normal file
View File

@ -0,0 +1,3 @@
#include <STC15F2K60S2.H>
void Seg_Disp(unsigned char Wela,Dula,Point);

1914
2025/User/2025.uvgui.ZBright Normal file

File diff suppressed because one or more lines are too long

241
2025/User/2025.uvopt Normal file
View File

@ -0,0 +1,241 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_opt.xsd">
<SchemaVersion>1.0</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Extensions>
<cExt>*.c</cExt>
<aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt>
<CppX>*.cpp; *.cc; *.cxx</CppX>
<nMigrate>0</nMigrate>
</Extensions>
<DaveTm>
<dwLowDateTime>0</dwLowDateTime>
<dwHighDateTime>0</dwHighDateTime>
</DaveTm>
<Target>
<TargetName>2025</TargetName>
<ToolsetNumber>0x0</ToolsetNumber>
<ToolsetName>MCS-51</ToolsetName>
<TargetOption>
<CLK51>35000000</CLK51>
<OPTTT>
<gFlags>1</gFlags>
<BeepAtEnd>1</BeepAtEnd>
<RunSim>1</RunSim>
<RunTarget>0</RunTarget>
<RunAbUc>0</RunAbUc>
</OPTTT>
<OPTHX>
<HexSelection>0</HexSelection>
<FlashByte>65535</FlashByte>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
</OPTHX>
<OPTLEX>
<PageWidth>120</PageWidth>
<PageLength>65</PageLength>
<TabStop>8</TabStop>
<ListingPath>.\Listings\</ListingPath>
</OPTLEX>
<ListingPage>
<CreateCListing>1</CreateCListing>
<CreateAListing>1</CreateAListing>
<CreateLListing>1</CreateLListing>
<CreateIListing>0</CreateIListing>
<AsmCond>1</AsmCond>
<AsmSymb>1</AsmSymb>
<AsmXref>0</AsmXref>
<CCond>1</CCond>
<CCode>0</CCode>
<CListInc>0</CListInc>
<CSymb>0</CSymb>
<LinkerCodeListing>0</LinkerCodeListing>
</ListingPage>
<OPTXL>
<LMap>1</LMap>
<LComments>1</LComments>
<LGenerateSymbols>1</LGenerateSymbols>
<LLibSym>1</LLibSym>
<LLines>1</LLines>
<LLocSym>1</LLocSym>
<LPubSym>1</LPubSym>
<LXref>0</LXref>
<LExpSel>0</LExpSel>
</OPTXL>
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>255</CpuCode>
<DebugOpt>
<uSim>1</uSim>
<uTrg>0</uTrg>
<sLdApp>1</sLdApp>
<sGomain>1</sGomain>
<sRbreak>1</sRbreak>
<sRwatch>1</sRwatch>
<sRmem>1</sRmem>
<sRfunc>1</sRfunc>
<sRbox>1</sRbox>
<tLdApp>1</tLdApp>
<tGomain>0</tGomain>
<tRbreak>1</tRbreak>
<tRwatch>1</tRwatch>
<tRmem>1</tRmem>
<tRfunc>0</tRfunc>
<tRbox>1</tRbox>
<tRtrace>1</tRtrace>
<sRSysVw>1</sRSysVw>
<tRSysVw>1</tRSysVw>
<sRunDeb>0</sRunDeb>
<sLrtime>0</sLrtime>
<bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf>
<nTsel>-1</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
<sDlgPa></sDlgPa>
<sIfile></sIfile>
<tDll></tDll>
<tDllPa></tDllPa>
<tDlgDll></tDlgDll>
<tDlgPa></tDlgPa>
<tIfile></tIfile>
<pMon></pMon>
</DebugOpt>
<Breakpoint/>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
<DebugFlag>
<trace>0</trace>
<periodic>1</periodic>
<aLwin>0</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
<aPa>0</aPa>
<viewmode>0</viewmode>
<vrSel>0</vrSel>
<aSym>0</aSym>
<aTbox>0</aTbox>
<AscS1>0</AscS1>
<AscS2>0</AscS2>
<AscS3>0</AscS3>
<aSer3>0</aSer3>
<eProf>0</eProf>
<aLa>0</aLa>
<aPa1>0</aPa1>
<AscS4>0</AscS4>
<aSer4>0</aSer4>
<StkLoc>0</StkLoc>
<TrcWin>0</TrcWin>
<newCpu>0</newCpu>
<uProt>0</uProt>
</DebugFlag>
<LintExecutable></LintExecutable>
<LintConfigFile></LintConfigFile>
<bLintAuto>0</bLintAuto>
<bAutoGenD>0</bAutoGenD>
<LntExFlags>0</LntExFlags>
<pMisraName></pMisraName>
<pszMrule></pszMrule>
<pSingCmds></pSingCmds>
<pMultCmds></pMultCmds>
<pMisraNamep></pMisraNamep>
<pszMrulep></pszMrulep>
<pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp>
</TargetOption>
</Target>
<Group>
<GroupName>User</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>1</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\main.c</PathWithFileName>
<FilenameWithoutPath>main.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>Driver</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>2</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Driver\Init.c</PathWithFileName>
<FilenameWithoutPath>Init.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>3</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Driver\Led.c</PathWithFileName>
<FilenameWithoutPath>Led.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>4</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Driver\Seg.c</PathWithFileName>
<FilenameWithoutPath>Seg.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>5</FileNumber>
<FileType>1</FileType>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Driver\Key.c</PathWithFileName>
<FilenameWithoutPath>Key.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
</ProjectOpt>

415
2025/User/2025.uvproj Normal file
View File

@ -0,0 +1,415 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_proj.xsd">
<SchemaVersion>1.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Targets>
<Target>
<TargetName>2025</TargetName>
<ToolsetNumber>0x0</ToolsetNumber>
<ToolsetName>MCS-51</ToolsetName>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>STC15F2K60S2 Series</Device>
<Vendor>STC</Vendor>
<Cpu>IRAM(0-0xFF) XRAM(0-0x6FF) IROM(0-0xEFF8) CLOCK(35000000) MODP2</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile>"LIB\STARTUP.A51" ("Standard 8051 Startup Code")</StartupFile>
<FlashDriverDll></FlashDriverDll>
<DeviceId>62472</DeviceId>
<RegisterFile>STC15F2K60S2.H</RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile></SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath>STC\</RegisterFilePath>
<DBRegisterFilePath>STC\</DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
<ButtonStop>0</ButtonStop>
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory>
<OutputName>2025</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\Listings\</ListingPath>
<HexFormatSelection>0</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
<nStopU2X>0</nStopU2X>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X>
<nStopB2X>0</nStopB2X>
</BeforeMake>
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X>
</AfterMake>
<SelectedForBatchBuild>0</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>0</AlwaysBuild>
<GenerateAssemblyFile>0</GenerateAssemblyFile>
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
<BankNo>65535</BankNo>
</CommonProperty>
<DllOption>
<SimDllName>S8051.DLL</SimDllName>
<SimDllArguments></SimDllArguments>
<SimDlgDll>DP51.DLL</SimDlgDll>
<SimDlgDllArguments>-pDP8051</SimDlgDllArguments>
<TargetDllName>S8051.DLL</TargetDllName>
<TargetDllArguments></TargetDllArguments>
<TargetDlgDll>TP51.DLL</TargetDlgDll>
<TargetDlgDllArguments>-p51</TargetDlgDllArguments>
</DllOption>
<DebugOption>
<OPTHX>
<HexSelection>0</HexSelection>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
<Oh166RecLen>16</Oh166RecLen>
</OPTHX>
<Simulator>
<UseSimulator>1</UseSimulator>
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
<RunToMain>1</RunToMain>
<RestoreBreakpoints>1</RestoreBreakpoints>
<RestoreWatchpoints>1</RestoreWatchpoints>
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
<RestoreFunctions>1</RestoreFunctions>
<RestoreToolbox>1</RestoreToolbox>
<LimitSpeedToRealTime>0</LimitSpeedToRealTime>
<RestoreSysVw>1</RestoreSysVw>
</Simulator>
<Target>
<UseTarget>0</UseTarget>
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
<RunToMain>0</RunToMain>
<RestoreBreakpoints>1</RestoreBreakpoints>
<RestoreWatchpoints>1</RestoreWatchpoints>
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
<RestoreFunctions>0</RestoreFunctions>
<RestoreToolbox>1</RestoreToolbox>
<RestoreTracepoints>1</RestoreTracepoints>
<RestoreSysVw>1</RestoreSysVw>
</Target>
<RunDebugAfterBuild>0</RunDebugAfterBuild>
<TargetSelection>-1</TargetSelection>
<SimDlls>
<CpuDll></CpuDll>
<CpuDllArguments></CpuDllArguments>
<PeripheralDll></PeripheralDll>
<PeripheralDllArguments></PeripheralDllArguments>
<InitializationFile></InitializationFile>
</SimDlls>
<TargetDlls>
<CpuDll></CpuDll>
<CpuDllArguments></CpuDllArguments>
<PeripheralDll></PeripheralDll>
<PeripheralDllArguments></PeripheralDllArguments>
<InitializationFile></InitializationFile>
<Driver></Driver>
</TargetDlls>
</DebugOption>
<Utilities>
<Flash1>
<UseTargetDll>0</UseTargetDll>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>0</UpdateFlashBeforeDebugging>
<Capability>0</Capability>
<DriverSelection>-1</DriverSelection>
</Flash1>
<bUseTDR>0</bUseTDR>
<Flash2></Flash2>
<Flash3></Flash3>
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<Target51>
<Target51Misc>
<MemoryModel>0</MemoryModel>
<RTOS>0</RTOS>
<RomSize>2</RomSize>
<DataHold>0</DataHold>
<XDataHold>0</XDataHold>
<UseOnchipRom>0</UseOnchipRom>
<UseOnchipArithmetic>0</UseOnchipArithmetic>
<UseMultipleDPTR>0</UseMultipleDPTR>
<UseOnchipXram>0</UseOnchipXram>
<HadIRAM>1</HadIRAM>
<HadXRAM>1</HadXRAM>
<HadIROM>1</HadIROM>
<Moda2>0</Moda2>
<Moddp2>0</Moddp2>
<Modp2>1</Modp2>
<Mod517dp>0</Mod517dp>
<Mod517au>0</Mod517au>
<Mode2>0</Mode2>
<useCB>0</useCB>
<useXB>0</useXB>
<useL251>0</useL251>
<useA251>0</useA251>
<Mx51>0</Mx51>
<ModC812>0</ModC812>
<ModCont>0</ModCont>
<Lp51>0</Lp51>
<useXBS>0</useXBS>
<ModDA>0</ModDA>
<ModAB2>0</ModAB2>
<Mx51P>0</Mx51P>
<hadXRAM2>0</hadXRAM2>
<uocXram2>0</uocXram2>
<hadXRAM3>0</hadXRAM3>
<ModC2>0</ModC2>
<ModH2>0</ModH2>
<Mdu_R515>0</Mdu_R515>
<Mdu_F120>0</Mdu_F120>
<Psoc>0</Psoc>
<hadIROM2>0</hadIROM2>
<hadIROM3>0</hadIROM3>
<ModSmx2>0</ModSmx2>
<cBanks>0</cBanks>
<xBanks>0</xBanks>
<OnChipMemories>
<RCB>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0xffff</Size>
</RCB>
<RXB>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</RXB>
<Ocm1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm1>
<Ocm2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm2>
<Ocm3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm3>
<Ocr1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr1>
<Ocr2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr2>
<Ocr3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr3>
<IRO>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0xeff9</Size>
</IRO>
<IRA>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x100</Size>
</IRA>
<XRA>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x700</Size>
</XRA>
<XRA512>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRA512>
<IROM512>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</IROM512>
<XRA513>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRA513>
<IROM513>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</IROM513>
</OnChipMemories>
</Target51Misc>
<C51>
<RegisterColoring>0</RegisterColoring>
<VariablesInOrder>0</VariablesInOrder>
<IntegerPromotion>1</IntegerPromotion>
<uAregs>0</uAregs>
<UseInterruptVector>1</UseInterruptVector>
<Fuzzy>3</Fuzzy>
<Optimize>8</Optimize>
<WarningLevel>2</WarningLevel>
<SizeSpeed>1</SizeSpeed>
<ObjectExtend>1</ObjectExtend>
<ACallAJmp>0</ACallAJmp>
<InterruptVectorAddress>0</InterruptVectorAddress>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath>..\Driver</IncludePath>
</VariousControls>
</C51>
<Ax51>
<UseMpl>0</UseMpl>
<UseStandard>1</UseStandard>
<UseCase>0</UseCase>
<UseMod51>0</UseMod51>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</Ax51>
<Lx51>
<useFile>0</useFile>
<linkonly>0</linkonly>
<UseMemoryFromTarget>1</UseMemoryFromTarget>
<CaseSensitiveSymbols>0</CaseSensitiveSymbols>
<WarningLevel>2</WarningLevel>
<DataOverlaying>1</DataOverlaying>
<OverlayString></OverlayString>
<MiscControls></MiscControls>
<DisableWarningNumbers></DisableWarningNumbers>
<LinkerCmdFile></LinkerCmdFile>
<Assign></Assign>
<ReserveString></ReserveString>
<CClasses></CClasses>
<UserClasses></UserClasses>
<CSection></CSection>
<UserSection></UserSection>
<CodeBaseAddress></CodeBaseAddress>
<XDataBaseAddress></XDataBaseAddress>
<PDataBaseAddress></PDataBaseAddress>
<BitBaseAddress></BitBaseAddress>
<DataBaseAddress></DataBaseAddress>
<IDataBaseAddress></IDataBaseAddress>
<Precede></Precede>
<Stack></Stack>
<CodeSegmentName></CodeSegmentName>
<XDataSegmentName></XDataSegmentName>
<BitSegmentName></BitSegmentName>
<DataSegmentName></DataSegmentName>
<IDataSegmentName></IDataSegmentName>
</Lx51>
</Target51>
</TargetOption>
<Groups>
<Group>
<GroupName>User</GroupName>
<Files>
<File>
<FileName>main.c</FileName>
<FileType>1</FileType>
<FilePath>.\main.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>Driver</GroupName>
<Files>
<File>
<FileName>Init.c</FileName>
<FileType>1</FileType>
<FilePath>..\Driver\Init.c</FilePath>
</File>
<File>
<FileName>Led.c</FileName>
<FileType>1</FileType>
<FilePath>..\Driver\Led.c</FilePath>
</File>
<File>
<FileName>Seg.c</FileName>
<FileType>1</FileType>
<FilePath>..\Driver\Seg.c</FilePath>
</File>
<File>
<FileName>Key.c</FileName>
<FileType>1</FileType>
<FilePath>..\Driver\Key.c</FilePath>
</File>
</Files>
</Group>
</Groups>
</Target>
</Targets>
</Project>

380
2025/User/Listings/2025.m51 Normal file
View File

@ -0,0 +1,380 @@
BL51 BANKED LINKER/LOCATER V6.22.4.0 04/13/2025 00:35:53 PAGE 1
BL51 BANKED LINKER/LOCATER V6.22.4.0, INVOKED BY:
C:\USERS\ZBRIGHT\APPDATA\LOCAL\KEIL_V5\C51\BIN\BL51.EXE .\Objects\main.obj, .\Objects\Init.obj, .\Objects\Led.obj, .\Obj
>> ects\Seg.obj, .\Objects\Key.obj TO .\Objects\2025 PRINT (.\Listings\2025.m51) RAMSIZE (256)
MEMORY MODEL: SMALL
INPUT MODULES INCLUDED:
.\Objects\main.obj (MAIN)
.\Objects\Init.obj (INIT)
.\Objects\Led.obj (LED)
.\Objects\Seg.obj (SEG)
.\Objects\Key.obj (KEY)
C:\USERS\ZBRIGHT\APPDATA\LOCAL\KEIL_V5\C51\LIB\C51S.LIB (?C_STARTUP)
C:\USERS\ZBRIGHT\APPDATA\LOCAL\KEIL_V5\C51\LIB\C51S.LIB (?C_INIT)
LINK MAP OF MODULE: .\Objects\2025 (MAIN)
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 0021H UNIT ?DT?MAIN
DATA 0029H 0019H UNIT ?DT?SEG
DATA 0042H 0002H UNIT ?DT?LED
IDATA 0044H 0001H UNIT ?STACK
* * * * * * * C O D E M E M O R Y * * * * * * *
CODE 0000H 0003H ABSOLUTE
CODE 0003H 0001H UNIT ?PR?LED_PROC?MAIN
0004H 0007H *** GAP ***
CODE 000BH 0003H ABSOLUTE
CODE 000EH 008CH UNIT ?C_C51STARTUP
CODE 009AH 0088H UNIT ?PR?TIMER0_SERVER?MAIN
CODE 0122H 007AH UNIT ?PR?KEY_READ?KEY
CODE 019CH 0042H UNIT ?C_INITSEG
CODE 01DEH 0042H UNIT ?PR?_SEG_DISP?SEG
CODE 0220H 003BH UNIT ?PR?_LED_DISP?LED
CODE 025BH 0025H UNIT ?PR?KEY_PROC?MAIN
CODE 0280H 0022H UNIT ?PR?SEG_PROC?MAIN
CODE 02A2H 001DH UNIT ?PR?SYSTEM_INIT?INIT
CODE 02BFH 0015H UNIT ?PR?TIMER0_INIT?MAIN
CODE 02D4H 0011H UNIT ?PR?MAIN?MAIN
OVERLAY MAP OF MODULE: .\Objects\2025 (MAIN)
SEGMENT
+--> CALLED SEGMENT
---------------------
?PR?TIMER0_SERVER?MAIN
+--> ?PR?_SEG_DISP?SEG
BL51 BANKED LINKER/LOCATER V6.22.4.0 04/13/2025 00:35:53 PAGE 2
+--> ?PR?_LED_DISP?LED
*** NEW ROOT ***************************************************
?C_C51STARTUP
+--> ?PR?MAIN?MAIN
+--> ?C_INITSEG
?PR?MAIN?MAIN
+--> ?PR?SYSTEM_INIT?INIT
+--> ?PR?TIMER0_INIT?MAIN
+--> ?PR?KEY_PROC?MAIN
+--> ?PR?SEG_PROC?MAIN
+--> ?PR?LED_PROC?MAIN
?PR?KEY_PROC?MAIN
+--> ?PR?KEY_READ?KEY
SYMBOL TABLE OF MODULE: .\Objects\2025 (MAIN)
VALUE TYPE NAME
----------------------------------
------- MODULE MAIN
C:0000H SYMBOL _ICE_DUMMY_
D:0080H PUBLIC P0
D:0090H PUBLIC P1
D:00A0H PUBLIC P2
D:00B0H PUBLIC P3
D:00C0H PUBLIC P4
D:00C8H PUBLIC P5
D:00E8H PUBLIC P6
B:00A8H.7 PUBLIC EA
D:00F8H PUBLIC P7
C:0003H PUBLIC Led_Proc
D:0008H PUBLIC Seg_Point
D:00A8H PUBLIC IE
C:009AH PUBLIC Timer0_Server
C:0280H PUBLIC Seg_Proc
D:00B8H PUBLIC IP
D:0010H PUBLIC Seg_Buf
C:025BH PUBLIC Key_Proc
D:0018H PUBLIC Seg_Slow_Down
D:001AH PUBLIC Seg_Show
D:00D8H PUBLIC CCON
D:001BH PUBLIC Key_Down
C:02D4H PUBLIC main
C:02BFH PUBLIC Timer0_Init
D:001CH PUBLIC Key_Old
D:001DH PUBLIC Key_Slow_Down
D:001EH PUBLIC Key_Val
D:001FH PUBLIC Seg_Pos
D:0098H PUBLIC SCON
D:0089H PUBLIC TMOD
D:0088H PUBLIC TCON
BL51 BANKED LINKER/LOCATER V6.22.4.0 04/13/2025 00:35:53 PAGE 3
D:008EH PUBLIC AUXR
B:00A8H.1 PUBLIC ET0
B:0088H.5 PUBLIC TF0
D:008CH PUBLIC TH0
D:0020H PUBLIC Key_Up
D:008AH PUBLIC TL0
B:0088H.4 PUBLIC TR0
D:0021H PUBLIC ucLed
D:00D0H PUBLIC PSW
------- PROC KEY_PROC
C:025BH LINE# 29
C:025BH LINE# 30
C:025BH LINE# 31
C:025FH LINE# 32
C:0262H LINE# 34
C:0267H LINE# 35
C:0270H LINE# 36
C:0276H LINE# 37
C:0279H LINE# 39
C:027DH LINE# 40
C:027FH LINE# 41
------- ENDPROC KEY_PROC
------- PROC SEG_PROC
C:0280H LINE# 43
C:0280H LINE# 44
C:0280H LINE# 45
C:0286H LINE# 46
C:028BH LINE# 48
C:0298H LINE# 49
C:02A1H LINE# 50
------- ENDPROC SEG_PROC
------- PROC LED_PROC
C:0003H LINE# 52
C:0003H LINE# 53
C:0003H LINE# 55
------- ENDPROC LED_PROC
------- PROC TIMER0_INIT
C:02BFH LINE# 58
C:02BFH LINE# 59
C:02BFH LINE# 60
C:02C2H LINE# 61
C:02C5H LINE# 62
C:02C8H LINE# 63
C:02CBH LINE# 64
C:02CDH LINE# 65
C:02CFH LINE# 66
C:02D1H LINE# 67
C:02D3H LINE# 68
------- ENDPROC TIMER0_INIT
------- PROC TIMER0_SERVER
C:009AH LINE# 70
C:00B7H LINE# 72
C:00C1H LINE# 73
C:00D8H LINE# 74
C:00E2H LINE# 75
C:00F9H LINE# 76
C:0107H LINE# 78
BL51 BANKED LINKER/LOCATER V6.22.4.0 04/13/2025 00:35:53 PAGE 4
------- ENDPROC TIMER0_SERVER
------- PROC MAIN
C:02D4H LINE# 80
C:02D4H LINE# 81
C:02D4H LINE# 82
C:02D7H LINE# 83
C:02DAH LINE# 84
C:02DAH LINE# 85
C:02DAH LINE# 86
C:02DDH LINE# 87
C:02E0H LINE# 88
C:02E3H LINE# 89
------- ENDPROC MAIN
------- ENDMOD MAIN
------- MODULE INIT
C:0000H SYMBOL _ICE_DUMMY_
C:02A2H PUBLIC System_Init
D:0080H PUBLIC P0
D:0090H PUBLIC P1
D:00A0H PUBLIC P2
D:00B0H PUBLIC P3
D:00C0H PUBLIC P4
D:00C8H PUBLIC P5
D:00E8H PUBLIC P6
D:00F8H PUBLIC P7
D:00A8H PUBLIC IE
D:00B8H PUBLIC IP
D:00D8H PUBLIC CCON
D:0098H PUBLIC SCON
D:0088H PUBLIC TCON
D:00D0H PUBLIC PSW
------- PROC SYSTEM_INIT
C:02A2H LINE# 3
C:02A2H LINE# 4
C:02A2H LINE# 5
C:02AAH LINE# 6
C:02ADH LINE# 7
C:02B0H LINE# 9
C:02B8H LINE# 10
C:02BBH LINE# 11
C:02BEH LINE# 12
------- ENDPROC SYSTEM_INIT
------- ENDMOD INIT
------- MODULE LED
C:0000H SYMBOL _ICE_DUMMY_
D:0080H PUBLIC P0
D:0090H PUBLIC P1
D:00A0H PUBLIC P2
D:00B0H PUBLIC P3
D:00C0H PUBLIC P4
D:00C8H PUBLIC P5
D:00E8H PUBLIC P6
D:00F8H PUBLIC P7
C:0220H PUBLIC _Led_Disp
D:00A8H PUBLIC IE
BL51 BANKED LINKER/LOCATER V6.22.4.0 04/13/2025 00:35:53 PAGE 5
D:00B8H PUBLIC IP
D:00D8H PUBLIC CCON
D:0098H PUBLIC SCON
D:0088H PUBLIC TCON
D:00D0H PUBLIC PSW
------- PROC _LED_DISP
D:0007H SYMBOL addr
D:0004H SYMBOL enable
------- DO
D:0042H SYMBOL temp
D:0043H SYMBOL temp_old
------- ENDDO
C:0220H LINE# 3
C:0220H LINE# 4
C:0220H LINE# 7
C:0224H LINE# 8
C:0233H LINE# 10
C:0241H LINE# 11
C:0247H LINE# 12
C:0247H LINE# 13
C:024FH LINE# 14
C:0254H LINE# 15
C:0257H LINE# 17
C:025AH LINE# 18
C:025AH LINE# 20
------- ENDPROC _LED_DISP
------- ENDMOD LED
------- MODULE SEG
C:0000H SYMBOL _ICE_DUMMY_
D:0080H PUBLIC P0
D:0090H PUBLIC P1
D:00A0H PUBLIC P2
D:00B0H PUBLIC P3
D:00C0H PUBLIC P4
D:00C8H PUBLIC P5
D:00E8H PUBLIC P6
D:00F8H PUBLIC P7
D:0029H PUBLIC Seg_Dula
D:003AH PUBLIC Seg_Wela
D:00A8H PUBLIC IE
C:01DEH PUBLIC _Seg_Disp
D:00B8H PUBLIC IP
D:00D8H PUBLIC CCON
D:0098H PUBLIC SCON
D:0088H PUBLIC TCON
D:00D0H PUBLIC PSW
------- PROC _SEG_DISP
D:0007H SYMBOL Wela
D:0004H SYMBOL Dula
D:0002H SYMBOL Point
C:01DEH LINE# 15
C:01DEH LINE# 16
C:01DEH LINE# 17
C:01E6H LINE# 18
C:01E9H LINE# 19
C:01ECH LINE# 21
BL51 BANKED LINKER/LOCATER V6.22.4.0 04/13/2025 00:35:53 PAGE 6
C:01F4H LINE# 22
C:01FBH LINE# 23
C:01FEH LINE# 25
C:0202H LINE# 26
C:020DH LINE# 28
C:0214H LINE# 29
C:021CH LINE# 30
C:021FH LINE# 31
------- ENDPROC _SEG_DISP
------- ENDMOD SEG
------- MODULE KEY
C:0000H SYMBOL _ICE_DUMMY_
D:0080H PUBLIC P0
D:0090H PUBLIC P1
D:00A0H PUBLIC P2
D:00B0H PUBLIC P3
D:00C0H PUBLIC P4
D:00C8H PUBLIC P5
D:00E8H PUBLIC P6
D:00F8H PUBLIC P7
C:0122H PUBLIC Key_Read
D:00A8H PUBLIC IE
D:00B8H PUBLIC IP
D:00D8H PUBLIC CCON
B:00B0H.0 PUBLIC P30
B:00B0H.1 PUBLIC P31
D:0098H PUBLIC SCON
B:00B0H.2 PUBLIC P32
D:0088H PUBLIC TCON
B:00C0H.2 PUBLIC P42
B:00B0H.3 PUBLIC P33
B:00B0H.4 PUBLIC P34
B:00C0H.4 PUBLIC P44
B:00B0H.5 PUBLIC P35
B:00A8H.1 PUBLIC ET0
D:00D0H PUBLIC PSW
------- PROC KEY_READ
------- DO
D:0007H SYMBOL temp
------- ENDDO
C:0122H LINE# 3
C:0122H LINE# 4
C:0122H LINE# 5
C:0124H LINE# 6
C:0126H LINE# 8
C:012EH LINE# 9
C:0133H LINE# 10
C:0138H LINE# 11
C:013DH LINE# 12
C:0142H LINE# 14
C:014AH LINE# 15
C:014FH LINE# 16
C:0154H LINE# 17
C:0159H LINE# 18
C:015EH LINE# 20
C:0166H LINE# 21
BL51 BANKED LINKER/LOCATER V6.22.4.0 04/13/2025 00:35:53 PAGE 7
C:016BH LINE# 22
C:0170H LINE# 23
C:0175H LINE# 24
C:017AH LINE# 26
C:0182H LINE# 27
C:0187H LINE# 28
C:018CH LINE# 29
C:0191H LINE# 30
C:0196H LINE# 32
C:019BH LINE# 33
C:019BH LINE# 34
------- ENDPROC KEY_READ
------- ENDMOD KEY
Program Size: data=69.0 xdata=0 code=734
LINK/LOCATE RUN COMPLETE. 0 WARNING(S), 0 ERROR(S)

View File

@ -0,0 +1,36 @@
C51 COMPILER V9.60.7.0 INIT 04/13/2025 00:35:53 PAGE 1
C51 COMPILER V9.60.7.0, COMPILATION OF MODULE INIT
OBJECT MODULE PLACED IN .\Objects\Init.obj
COMPILER INVOKED BY: C:\Users\ZBright\AppData\Local\Keil_v5\C51\BIN\C51.EXE ..\Driver\Init.c OPTIMIZE(8,SPEED) BROWSE IN
-CDIR(..\Driver) DEBUG OBJECTEXTEND PRINT(.\Listings\Init.lst) OBJECT(.\Objects\Init.obj)
line level source
1 #include <Init.h>
2
3 void System_Init()
4 {
5 1 P2 = P2 & 0x1f | 0x80;
6 1 P0 = 0xff;
7 1 P2 &= 0x1f;
8 1
9 1 P2 = P2 & 0x1f | 0xA0;
10 1 P0 = 0x00;
11 1 P2 &= 0x1f;
12 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 29 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

View File

@ -0,0 +1,58 @@
C51 COMPILER V9.60.7.0 KEY 04/13/2025 00:35:53 PAGE 1
C51 COMPILER V9.60.7.0, COMPILATION OF MODULE KEY
OBJECT MODULE PLACED IN .\Objects\Key.obj
COMPILER INVOKED BY: C:\Users\ZBright\AppData\Local\Keil_v5\C51\BIN\C51.EXE ..\Driver\Key.c OPTIMIZE(8,SPEED) BROWSE INC
-DIR(..\Driver) DEBUG OBJECTEXTEND PRINT(.\Listings\Key.lst) OBJECT(.\Objects\Key.obj)
line level source
1 #include <Key.h>
2
3 unsigned char Key_Read()
4 {
5 1 unsigned char temp = 0;
6 1 ET0 = 0;
7 1
8 1 P44 = 0;P42 = 1;P35 = 1;P34 = 1;
9 1 if(P33 == 0) temp = 4;
10 1 if(P32 == 0) temp = 5;
11 1 if(P31 == 0) temp = 6;
12 1 if(P30 == 0) temp = 7;
13 1
14 1 P44 = 1;P42 = 0;P35 = 1;P34 = 1;
15 1 if(P33 == 0) temp = 8;
16 1 if(P32 == 0) temp = 9;
17 1 if(P31 == 0) temp = 10;
18 1 if(P30 == 0) temp = 11;
19 1
20 1 P44 = 1;P42 = 1;P35 = 0;P34 = 1;
21 1 if(P33 == 0) temp = 12;
22 1 if(P32 == 0) temp = 13;
23 1 if(P31 == 0) temp = 14;
24 1 if(P30 == 0) temp = 15;
25 1
26 1 P44 = 1;P42 = 1;P35 = 1;P34 = 0;
27 1 if(P33 == 0) temp = 16;
28 1 if(P32 == 0) temp = 17;
29 1 if(P31 == 0) temp = 18;
30 1 if(P30 == 0) temp = 19;
31 1
32 1 ET0 = 1;P3 = 0xff;
33 1 return temp;
34 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 122 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

View File

@ -0,0 +1,44 @@
C51 COMPILER V9.60.7.0 LED 04/13/2025 00:35:53 PAGE 1
C51 COMPILER V9.60.7.0, COMPILATION OF MODULE LED
OBJECT MODULE PLACED IN .\Objects\Led.obj
COMPILER INVOKED BY: C:\Users\ZBright\AppData\Local\Keil_v5\C51\BIN\C51.EXE ..\Driver\Led.c OPTIMIZE(8,SPEED) BROWSE INC
-DIR(..\Driver) DEBUG OBJECTEXTEND PRINT(.\Listings\Led.lst) OBJECT(.\Objects\Led.obj)
line level source
1 #include <Led.h>
2
3 void Led_Disp(unsigned char addr,enable)
4 {
5 1 static unsigned char temp = 0x00,temp_old = 0xff;
6 1
7 1 if(enable)
8 1 temp |= 0x01 << addr;
9 1 else
10 1 temp &= ~(0x01 << addr);
11 1 if(temp != temp_old)
12 1 {
13 2 P2 = P2 & 0x1f | 0x80;
14 2 P0 = ~temp;
15 2 P2 &= 0x1f;
16 2
17 2 temp_old = temp;
18 2 }
19 1
20 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 59 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 2 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

View File

@ -0,0 +1,55 @@
C51 COMPILER V9.60.7.0 SEG 04/13/2025 00:35:53 PAGE 1
C51 COMPILER V9.60.7.0, COMPILATION OF MODULE SEG
OBJECT MODULE PLACED IN .\Objects\Seg.obj
COMPILER INVOKED BY: C:\Users\ZBright\AppData\Local\Keil_v5\C51\BIN\C51.EXE ..\Driver\Seg.c OPTIMIZE(8,SPEED) BROWSE INC
-DIR(..\Driver) DEBUG OBJECTEXTEND PRINT(.\Listings\Seg.lst) OBJECT(.\Objects\Seg.obj)
line level source
1 #include <Seg.h>
2
3 unsigned char Seg_Dula[]={
4 0xc0,0xf9,0xa4,0xb0,
5 0x99,0x92,0x82,0xf8,
6 0x80,0x90,0x88,0x83,
7 0xc6,0xa1,0x86,0x8e,
8 0xff
9 };
10 unsigned char Seg_Wela[]={
11 0x01,0x02,0x04,0x08,
12 0x10,0x20,0x40,0x80
13 };
14
15 void Seg_Disp(unsigned char Wela,Dula,Point)
16 {
17 1 P2 = P2 & 0x1f | 0xe0;
18 1 P0 = 0xff;
19 1 P2 &= 0x1f;
20 1
21 1 P2 = P2 & 0x1f | 0xc0;
22 1 P0 = Seg_Wela[Wela];
23 1 P2 &= 0x1f;
24 1
25 1 if(Point)
26 1 P0 = Seg_Dula[Dula] & 0x7f;
27 1 else
28 1 P0 = Seg_Dula[Dula];
29 1 P2 = P2 & 0x1f | 0xe0;
30 1 P2 &= 0x1f;
31 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 66 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 25 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

129
2025/User/Listings/main.lst Normal file
View File

@ -0,0 +1,129 @@
C51 COMPILER V9.60.7.0 MAIN 04/13/2025 00:35:53 PAGE 1
C51 COMPILER V9.60.7.0, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\Objects\main.obj
COMPILER INVOKED BY: C:\Users\ZBright\AppData\Local\Keil_v5\C51\BIN\C51.EXE main.c OPTIMIZE(8,SPEED) BROWSE INCDIR(..\Dr
-iver) DEBUG OBJECTEXTEND PRINT(.\Listings\main.lst) OBJECT(.\Objects\main.obj)
line level source
1 /* 头文件申明*/
2 #include <STC15F2K60S2.H>
3 #include <Key.h>
4 #include <Seg.h>
5 #include <Led.h>
6 #include <Init.h>
7
8 /* 变量申明*/
9 unsigned char Key_Slow_Down;//按键减速变量
10 unsigned char Key_Val,Key_Old,Key_Down,Key_Up;
11 unsigned int Seg_Slow_Down;
12 unsigned char Seg_Pos;
13 unsigned char Seg_Buf[8]=
14 {
15 16,16,16,16,16,16,16,16
16 };
17 unsigned char Seg_Point[8]=
18 {
19 0,0,0,0,0,0,0,0
20 };
21 unsigned char ucLed[8]=
22 {
23 1,0,0,0,0,0,0,0
24 };
25
26 unsigned char Seg_Show;
27
28 /* 处理函数key,seg,led*/
29 void Key_Proc()
30 {
31 1 if(Key_Slow_Down) return;
32 1 Key_Slow_Down = 1;
33 1
34 1 Key_Val = Key_Read();
35 1 Key_Down = Key_Val & (Key_Old ^ Key_Val);
36 1 Key_Up = ~Key_Val & (Key_Old ^ Key_Val);
37 1 Key_Old = Key_Val;
38 1
39 1 if(Key_Down != 0)
40 1 Seg_Show = Key_Down;
41 1 }
42
43 void Seg_Proc()
44 {
45 1 if(Seg_Slow_Down) return;
46 1 Seg_Slow_Down = 1;
47 1
48 1 Seg_Buf[0] = Seg_Show /10 %10;
49 1 Seg_Buf[1] = Seg_Show %10;
50 1 }
51
52 void Led_Proc()
53 {
54 1
C51 COMPILER V9.60.7.0 MAIN 04/13/2025 00:35:53 PAGE 2
55 1 }
56
57 /* 定时器函数(初始化、中断函数)*/
58 void Timer0_Init(void) //1毫秒@12.000MHz
59 {
60 1 AUXR &= 0x7F; //定时器时钟12T模式
61 1 TMOD &= 0xF0; //设置定时器模式
62 1 TL0 = 0x18; //设置定时初始值
63 1 TH0 = 0xFC; //设置定时初始值
64 1 TF0 = 0; //清除TF0标志
65 1 TR0 = 1; //定时器0开始计时
66 1 ET0 = 1;
67 1 EA = 1;
68 1 }
69
70 void Timer0_Server() interrupt 1
71 {
72 1 if(++Key_Slow_Down == 10) Key_Slow_Down = 0;
73 1 if(++Seg_Slow_Down == 500) Seg_Slow_Down = 0;
74 1 if(++Seg_Pos == 8) Seg_Pos = 0;
75 1 Seg_Disp(Seg_Pos,Seg_Buf[Seg_Pos],Seg_Point[Seg_Pos]);
76 1 Led_Disp(Seg_Pos,ucLed[Seg_Pos]);
77 1
78 1 }
79 /* 主函数*/
80 void main()
81 {
82 1 System_Init();
83 1 Timer0_Init();
84 1 while(1)
85 1 {
86 2 Key_Proc();
87 2 Seg_Proc();
88 2 Led_Proc();
89 2 }
90 1 }
91
92
93
94
95
96
97
98
99
100
101
102
103
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 246 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 33 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

BIN
2025/User/Objects/2025 Normal file

Binary file not shown.

View File

@ -0,0 +1,38 @@
<html>
<body>
<pre>
<h1>µVision Build Log</h1>
<h2>Tool Versions:</h2>
IDE-Version: ¦ÌVision V5.38.0.0
Copyright (C) 2022 ARM Ltd and ARM Germany GmbH. All rights reserved.
License Information: 123 123, 123, LIC=GM82M-XP6U2-D8NFM-XY9N7-MY3SU-RZV4P
Tool Versions:
Toolchain: PK51 Prof. Developers Kit Version: 9.60.7.0
Toolchain Path: C:\Users\ZBright\AppData\Local\Keil_v5\C51\BIN
C Compiler: C51.exe V9.60.7.0
Assembler: A51.exe V8.2.7.0
Linker/Locator: BL51.exe V6.22.4.0
Library Manager: LIB51.exe V4.30.1.0
Hex Converter: OH51.exe V2.7.0.0
CPU DLL: S8051.DLL V3.125.1.0
Dialog DLL: DP51.DLL V2.69.0.0
<h2>Project:</h2>
D:\Git\2025\User\2025.uvproj
Project File Date: 04/12/2025
<h2>Output:</h2>
Rebuild target '2025'
compiling main.c...
compiling Init.c...
compiling Led.c...
compiling Seg.c...
compiling Key.c...
linking...
Program Size: data=69.0 xdata=0 code=734
creating hex file from ".\Objects\2025"...
".\Objects\2025" - 0 Error(s), 0 Warning(s).
Build Time Elapsed: 00:00:00
</pre>
</body>
</html>

View File

@ -0,0 +1,59 @@
:10019C0008101010101010101010080800000000AB
:0E01AC0000000000082101000000000000001B
:10025B00E51D7020751D011201228F1EE51C651E08
:10026B00FF551EF51BE51EF45FF520851E1CE51BD7
:05027B006002F51A22EB
:10028000E5194518701BF518751901E51A75F00A7E
:100290008475F00A8485F010E51A75F00A8485F0FB
:0202A000112229
:0100030022DA
:1002BF00538E7F5389F0758A18758CFCC28DD28C42
:0502CF00D2A9D2AF220C
:03000B0002009A56
:10009A00C0E0C0F0C083C082C0D075D000C000C02C
:1000AA0001C002C003C004C005C006C007051DE5A3
:1000BA001DB40A03751D000519E51970020518FF1C
:1000CA00AE18BE0109BFF406751800751900051FA0
:1000DA00E51FB40803751F007410251FF8E6FD7CA0
:1000EA00007408251FF8E6FB7A00AF1F1201DE74C0
:1000FA0021251FF8E6FD7C00AF1F120220D007D091
:10010A0006D005D004D003D002D001D000D0D0D080
:08011A0082D083D0F0D0E03266
:1002D4001202A21202BF12025B12028012000380F9
:0102E400F524
:1002A200E5A0541F4480F5A07580FF53A01FE5A070
:0D02B200541F44A0F5A0E4F58053A01F22C6
:0601BA000142000143FFB9
:10022000ED4C600FA8077401088002C333D8FC426C
:1002300042800EA8077401088002C333D8FCF45230
:1002400042E54265436013E5A0541F4480F5A0E5F4
:0A02500042F4F58053A01F854243DD
:01025A002281
:1001C0001129C0F9A4B0999282F880908883C6A1C1
:0D01D000868EFF083A0102040810204080CE
:1001DE00E5A0541F44E0F5A07580FF53A01FE5A0D5
:1001EE00541F44C0F5A0743A2FF8E6F58053A01FB3
:1001FE00EB4A600B74292DF8E6547FF58080077466
:10020E00292DF8E6F580E5A0541F44E0F5A053A093
:02021E001F229D
:10012200E4FFC2A9C2C4D2C2D2B5D2B420B3027F04
:100132000420B2027F0520B1027F0620B0027F07B1
:10014200D2C4C2C2D2B5D2B420B3027F0820B20256
:100152007F0920B1027F0A20B0027F0BD2C4D2C233
:10016200C2B5D2B420B3027F0C20B2027F0D20B1FF
:10017200027F0E20B0027F0FD2C4D2C2D2B5C2B467
:1001820020B3027F1020B2027F1120B1027F122021
:09019200B0027F13D2A975B0FF81
:01019B002241
:0300000002000EED
:0C000E00787FE4F6D8FD758143020055B0
:10001A000202D4E493A3F8E493A34003F68001F226
:10002A0008DFF48029E493A3F85407240CC8C333E7
:10003A00C4540F4420C8834004F456800146F6DFB6
:10004A00E4800B010204081020408090019CE47EA9
:10005A00019360BCA3FF543F30E509541FFEE493AB
:10006A00A360010ECF54C025E060A840B8E493A372
:10007A00FAE493A3F8E493A3C8C582C8CAC583CA9D
:10008A00F0A3C8C582C8CAC583CADFE9DEE780BE55
:0101DD000021
:00000001FF

View File

@ -0,0 +1,7 @@
".\Objects\main.obj",
".\Objects\Init.obj",
".\Objects\Led.obj",
".\Objects\Seg.obj",
".\Objects\Key.obj"
TO ".\Objects\2025"
PRINT(".\Listings\2025.m51") RAMSIZE(256)

BIN
2025/User/Objects/Init.obj Normal file

Binary file not shown.

BIN
2025/User/Objects/Key.obj Normal file

Binary file not shown.

BIN
2025/User/Objects/Led.obj Normal file

Binary file not shown.

BIN
2025/User/Objects/Seg.obj Normal file

Binary file not shown.

BIN
2025/User/Objects/main.obj Normal file

Binary file not shown.

103
2025/User/main.c Normal file
View File

@ -0,0 +1,103 @@
/* 头文件申明*/
#include <STC15F2K60S2.H>
#include <Key.h>
#include <Seg.h>
#include <Led.h>
#include <Init.h>
/* 变量申明*/
unsigned char Key_Slow_Down;//按键减速变量
unsigned char Key_Val,Key_Old,Key_Down,Key_Up;
unsigned int Seg_Slow_Down;
unsigned char Seg_Pos;
unsigned char Seg_Buf[8]=
{
16,16,16,16,16,16,16,16
};
unsigned char Seg_Point[8]=
{
0,0,0,0,0,0,0,0
};
unsigned char ucLed[8]=
{
1,0,0,0,0,0,0,0
};
unsigned char Seg_Show;
/* 处理函数key,seg,led*/
void Key_Proc()
{
if(Key_Slow_Down) return;
Key_Slow_Down = 1;
Key_Val = Key_Read();
Key_Down = Key_Val & (Key_Old ^ Key_Val);
Key_Up = ~Key_Val & (Key_Old ^ Key_Val);
Key_Old = Key_Val;
if(Key_Down != 0)
Seg_Show = Key_Down;
}
void Seg_Proc()
{
if(Seg_Slow_Down) return;
Seg_Slow_Down = 1;
Seg_Buf[0] = Seg_Show /10 %10;
Seg_Buf[1] = Seg_Show %10;
}
void Led_Proc()
{
}
/* 定时器函数(初始化、中断函数)*/
void Timer0_Init(void) //1毫秒@12.000MHz
{
AUXR &= 0x7F; //定时器时钟12T模式
TMOD &= 0xF0; //设置定时器模式
TL0 = 0x18; //设置定时初始值
TH0 = 0xFC; //设置定时初始值
TF0 = 0; //清除TF0标志
TR0 = 1; //定时器0开始计时
ET0 = 1;
EA = 1;
}
void Timer0_Server() interrupt 1
{
if(++Key_Slow_Down == 10) Key_Slow_Down = 0;
if(++Seg_Slow_Down == 500) Seg_Slow_Down = 0;
if(++Seg_Pos == 8) Seg_Pos = 0;
Seg_Disp(Seg_Pos,Seg_Buf[Seg_Pos],Seg_Point[Seg_Pos]);
Led_Disp(Seg_Pos,ucLed[Seg_Pos]);
}
/* 主函数*/
void main()
{
System_Init();
Timer0_Init();
while(1)
{
Key_Proc();
Seg_Proc();
Led_Proc();
}
}

View File

@ -0,0 +1,53 @@
/* # DS1302代码片段说明
1.
2.
*/
//
void Write_Ds1302(unsigned char temp)
{
unsigned char i;
for (i=0;i<8;i++)
{
SCK = 0;
SDA = temp&0x01;
temp>>=1;
SCK=1;
}
}
//
void Write_Ds1302_Byte( unsigned char address,unsigned char dat )
{
RST=0; _nop_();
SCK=0; _nop_();
RST=1; _nop_();
Write_Ds1302(address);
Write_Ds1302(dat);
RST=0;
}
//
unsigned char Read_Ds1302_Byte ( unsigned char address )
{
unsigned char i,temp=0x00;
RST=0; _nop_();
SCK=0; _nop_();
RST=1; _nop_();
Write_Ds1302(address);
for (i=0;i<8;i++)
{
SCK=0;
temp>>=1;
if(SDA)
temp|=0x80;
SCK=1;
}
RST=0; _nop_();
SCK=0; _nop_();
SCK=1; _nop_();
SDA=0; _nop_();
SDA=1; _nop_();
return (temp);
}

View File

@ -0,0 +1,108 @@
/* # I2C代码片段说明
1.
2.
*/
#define DELAY_TIME 10
//
static void I2C_Delay(unsigned char n)
{
do
{
_nop_();_nop_();_nop_();_nop_();_nop_();
_nop_();_nop_();_nop_();_nop_();_nop_();
_nop_();_nop_();_nop_();_nop_();_nop_();
}
while(n--);
}
//
void I2CStart(void)
{
sda = 1;
scl = 1;
I2C_Delay(DELAY_TIME);
sda = 0;
I2C_Delay(DELAY_TIME);
scl = 0;
}
//
void I2CStop(void)
{
sda = 0;
scl = 1;
I2C_Delay(DELAY_TIME);
sda = 1;
I2C_Delay(DELAY_TIME);
}
//
void I2CSendByte(unsigned char byt)
{
unsigned char i;
for(i=0; i<8; i++){
scl = 0;
I2C_Delay(DELAY_TIME);
if(byt & 0x80){
sda = 1;
}
else{
sda = 0;
}
I2C_Delay(DELAY_TIME);
scl = 1;
byt <<= 1;
I2C_Delay(DELAY_TIME);
}
scl = 0;
}
//
unsigned char I2CReceiveByte(void)
{
unsigned char da;
unsigned char i;
for(i=0;i<8;i++){
scl = 1;
I2C_Delay(DELAY_TIME);
da <<= 1;
if(sda)
da |= 0x01;
scl = 0;
I2C_Delay(DELAY_TIME);
}
return da;
}
//
unsigned char I2CWaitAck(void)
{
unsigned char ackbit;
scl = 1;
I2C_Delay(DELAY_TIME);
ackbit = sda;
scl = 0;
I2C_Delay(DELAY_TIME);
return ackbit;
}
//
void I2CSendAck(unsigned char ackbit)
{
scl = 0;
sda = ackbit;
I2C_Delay(DELAY_TIME);
scl = 1;
I2C_Delay(DELAY_TIME);
scl = 0;
sda = 1;
I2C_Delay(DELAY_TIME);
}

View File

@ -0,0 +1,66 @@
/* # 单总线代码片段说明
1.
2.
*/
//
void Delay_OneWire(unsigned int t)
{
unsigned char i;
while(t--){
for(i=0;i<12;i++);
}
}
//
void Write_DS18B20(unsigned char dat)
{
unsigned char i;
for(i=0;i<8;i++)
{
DQ = 0;
DQ = dat&0x01;
Delay_OneWire(5);
DQ = 1;
dat >>= 1;
}
Delay_OneWire(5);
}
//
unsigned char Read_DS18B20(void)
{
unsigned char i;
unsigned char dat;
for(i=0;i<8;i++)
{
DQ = 0;
dat >>= 1;
DQ = 1;
if(DQ)
{
dat |= 0x80;
}
Delay_OneWire(5);
}
return dat;
}
//
bit init_ds18b20(void)
{
bit initflag = 0;
DQ = 1;
Delay_OneWire(12);
DQ = 0;
Delay_OneWire(80);
DQ = 1;
Delay_OneWire(10);
initflag = DQ;
Delay_OneWire(5);
return initflag;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,226 @@
; CH341SER.INF
; Driver for CH340/CH341 (USB=>SERIAL chip) V3.5
; WDM&VXD for Windows 98/Me/2000/XP/Vista/7/8/8.1/10/SERVER 2003/2008/2012/2016
; Copyright (C) W.ch 2001-2019
;
[Version]
Signature = "$Chicago$"
Class = Ports
ClassGuid = {4D36E978-E325-11CE-BFC1-08002BE10318}
Provider = %WinChipHead%
DriverVer = 01/30/2019, 3.5.2019.1
CatalogFile = CH341SER.CAT
[ControlFlags]
ExcludeFromSelect = USB\VID_1A86&PID_7523
ExcludeFromSelect = USB\VID_1A86&PID_5523
ExcludeFromSelect = USB\VID_1A86&PID_7522
ExcludeFromSelect = USB\VID_1A86&PID_E523
ExcludeFromSelect = USB\VID_4348&PID_5523
ExcludeFromSelect = USB\VID_4348&PID_5523&REV_0250
ExcludeFromSelect = USBSERPORT\SER5523
ExcludeFromSelect = CH341PORT\SER5523
[Manufacturer]
%WinChipHead% = WinChipHead,NT,NTamd64,NTia64
[WinChipHead]
%CH340SER.DeviceDesc% = CH341SER_Install, USB\VID_1A86&PID_7523
%CH341ASER.DeviceDesc% = CH341SER_Install, USB\VID_1A86&PID_5523
%CH340KSER.DeviceDesc% = CH341SER_Install, USB\VID_1A86&PID_7522
%CH330SER.DeviceDesc% = CH341SER_Install, USB\VID_1A86&PID_E523
%CH341SER.DeviceDesc% = CH341SER_Install, USB\VID_4348&PID_5523
%CH340SER.DeviceDesc% = CH341SER_Install, USB\VID_4348&PID_5523&REV_0250
%CH341S98.DeviceDesc% = CH341S98_Install, USBSERPORT\SER5523
%CH341S98.DeviceDesc% = CH341S98_Install, CH341PORT\SER5523
[WinChipHead.NT]
%CH340SER.DeviceDesc% = CH341SER_Install.NT, USB\VID_1A86&PID_7523
%CH341ASER.DeviceDesc% = CH341SER_Install.NT, USB\VID_1A86&PID_5523
%CH340KSER.DeviceDesc% = CH341SER_Install.NT, USB\VID_1A86&PID_7522
%CH330SER.DeviceDesc% = CH341SER_Install.NT, USB\VID_1A86&PID_E523
%CH341SER.DeviceDesc% = CH341SER_Install.NT, USB\VID_4348&PID_5523
%CH340SER.DeviceDesc% = CH341SER_Install.NT, USB\VID_4348&PID_5523&REV_0250
[WinChipHead.NTamd64]
%CH340SER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_1A86&PID_7523
%CH341ASER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_1A86&PID_5523
%CH340KSER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_1A86&PID_7522
%CH330SER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_1A86&PID_E523
%CH341SER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_4348&PID_5523
%CH340SER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_4348&PID_5523&REV_0250
[WinChipHead.NTia64]
%CH340SER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_1A86&PID_7523
%CH341ASER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_1A86&PID_5523
%CH340KSER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_1A86&PID_7522
%CH330SER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_1A86&PID_E523
%CH341SER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_4348&PID_5523
%CH340SER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_4348&PID_5523&REV_0250
[CH341SER_Install]
DelFiles = CH341S98.DelFiles.SYS
CopyFiles = CH341SER.CopyFiles.SYS, CH341SER.CopyFiles.DLL
AddReg = CH341SER.9X.AddReg, CH341SER.AddReg
[CH341SER_Install.NT]
CopyFiles = CH341SER.NT.CopyFiles.SYS, CH341SER.CopyFiles.DLL
AddReg = CH341SER.NT.AddReg, CH341SER.AddReg
[CH341SER_Install.NT.HW]
AddReg = CH341SER.NT.HW.AddReg
[CH341SER_Inst.NTamd64]
CopyFiles = CH341SER.NT.CopyFiles.SYSA64
AddReg = CH341SER.NT.AddReg, CH341SER.AddReg
[CH341SER_Inst.NTamd64.HW]
AddReg = CH341SER.NT.HW.AddReg
[CH341SER_Inst.NTia64]
CopyFiles = CH341SER.NT.CopyFiles.SYSI64
AddReg = CH341SER.NT.AddReg, CH341SER.AddReg
[CH341SER_Inst.NTia64.HW]
AddReg = CH341SER.NT.HW.AddReg
[CH341S98_Install]
DelFiles = CH341S98.DelFiles.SYS
CopyFiles = CH341S98.CopyFiles.VXD, CH341SER.CopyFiles.SYS
AddReg = CH341S98.9X.AddReg, CH341S98.AddReg
;[CH341S98_Install.NT]
[CH341S98.DelFiles.SYS]
CH341S98.SYS, , , 1
[CH341SER.CopyFiles.SYS]
CH341S98.SYS, , , 2
[CH341SER.NT.CopyFiles.SYS]
CH341SER.SYS, , , 2
[CH341SER.NT.CopyFiles.SYSA64]
CH341S64.SYS, , , 2
[CH341SER.NT.CopyFiles.SYSI64]
;CH341I64.SYS, , , 2
[CH341S98.CopyFiles.VXD]
CH341SER.VXD, , , 2
[CH341SER.CopyFiles.DLL]
CH341PT.DLL, , , 2
;安装DLL是可选的,DLL可以用于识别CH341端口和监视CH341端口的插拔事件
[CH341SER.9X.AddReg]
HKR, , DevLoader, , *NTKERN
HKR, , NTMPDriver, , CH341S98.SYS
[CH341SER.NT.AddReg]
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[CH341SER.NT.HW.AddReg]
;HKR,,"UpperFilters",0x00010000,"serenum"
;上面这行用于枚举接在串口的即插即用设备,启动时将产生DTR和RTS信号,如果需要枚举,请将上面这行的分号去掉
[CH341S98.9X.AddReg]
HKR, , DevLoader, , *vcomm
HKR, , PortDriver, , CH341SER.VXD
HKR, , Contention, , *vcd
HKR, , ConfigDialog, , serialui.dll
HKR, , DCB, 3, 1C,00,00,00, 80,25,00,00, 11,00,00,00, 00,00,0A,00, 0A,00,08,00, 00,11,13,00, 00,00,00,00
HKR, , PortSubClass, 1, 01
HKR, , EnumPropPages, , "serialui.dll,EnumPropPages"
;HKR, , Enumerator, , serenum.vxd
;上面这行用于枚举接在串口的即插即用设备,启动时将产生DTR和RTS信号,如果需要枚举,请将上面这行的分号去掉
[CH341SER.AddReg]
HKLM, SOFTWARE\WinChipHead\IC\CH341SER, WDM, 0x00010001, 0x00000034
HKLM, SOFTWARE\WinChipHead\IC\CH341PORT, DLL, 0x00010001, 0x00000010
HKLM, SOFTWARE\WinChipHead\IC\CH341SER, Function, , "USB=>Serial"
;HKLM, SYSTEM\CurrentControlSet\Services\CH341SER, UserRemoval, 0x00010001, 0x00000001
;上面这行用于在系统托盘中显示“安全删除USB转SERIAL硬件设备”便于用户手工删除硬件
[CH341S98.AddReg]
HKLM, SOFTWARE\WinChipHead\IC\CH341SER, VXD, 0x00010001, 0x00000023
[CH341SER_Install.NT.Services]
AddService = CH341SER, 2, CH341SER.Service
AddService = Serenum, , Serenum_Service_Inst
[CH341SER_Inst.NTamd64.Services]
AddService = CH341SER_A64, 2, CH341SER.ServiceA64
AddService = Serenum, , Serenum_Service_Inst
[CH341SER_Inst.NTia64.Services]
AddService = CH341SER_I64, 2, CH341SER.ServiceI64
AddService = Serenum, , Serenum_Service_Inst
[CH341SER.Service]
DisplayName = "CH341SER"
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %10%\System32\Drivers\CH341SER.SYS
[CH341SER.ServiceA64]
DisplayName = "CH341SER_A64"
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %10%\System32\Drivers\CH341S64.SYS
[CH341SER.ServiceI64]
DisplayName = "CH341SER_I64"
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %10%\System32\Drivers\CH341I64.SYS
[Serenum_Service_Inst]
DisplayName = "SerEnum"
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\serenum.sys
LoadOrderGroup = PNP Filter
[DestinationDirs]
DefaultDestDir = 10, System32\Drivers
CH341S98.DelFiles.SYS = 11
CH341SER.CopyFiles.SYS = 10, System32\Drivers
CH341SER.NT.CopyFiles.SYS = 10, System32\Drivers
CH341S98.CopyFiles.VXD = 11
CH341SER.CopyFiles.DLL = 11
CH341SER.NT.CopyFiles.SYSA64 = 10, System32\Drivers
;CH341SER.NT.CopyFiles.SYSI64 = 10, System32\Drivers
[SourceDisksFiles]
CH341SER.SYS = 1
CH341S98.SYS = 1
CH341SER.VXD = 1
CH341PT.DLL = 1
CH341S64.SYS = 1
;CH341I64.SYS = 1
[SourceDisksNames]
1 = %DISK_NAME%, , ,
[SourceDisksNames.amd64]
1 = %DISK_NAME%, , ,
[SourceDisksNames.ia64]
1 = %DISK_NAME%, , ,
[Strings]
WinChipHead = "wch.cn"
CH341SER.DeviceDesc = "USB-SERIAL CH341"
CH341S98.DeviceDesc = "USB-SERIAL CH341"
CH340SER.DeviceDesc = "USB-SERIAL CH340"
CH341ASER.DeviceDesc = "USB-SERIAL CH341A"
CH340KSER.DeviceDesc = "USB-SERIAL CH340K"
CH330SER.DeviceDesc = "USB-SERIAL CH330"
DISK_NAME = "CH341 Serial Installation Disk"

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,4 @@
CH340/CH341USB转串口WINDOWS驱动程序
内含DLL动态库及非标准波特率的设置等使用说明
支持32/64位 Windows 10/8.1/8/7/VISTA/XPSERVER 2016/2012/2008/20032000/ME/98通过微软数字签名认证
支持USB转3线和9线串口。

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,23 @@
[Setting]
Language=Chinese(Simplified)
[AccessPort]
SerialPort=5
BaudRate=9600
ParityBit=N
DataBit=8
StopBit=0
FlowControl=0
BufferSize=8192
SendCycle=1000
BytesPerLine=16
CopyHexDumpMode=0
SelectCharMode=0
MaxLogSize_MB=6
TextColor=0
BgColor=16777215
SysParameter=18354801
SendFile=
PredefDataFile=
AutoAckDataFile=
Font_Desc=-11:0:0:0:400:0:0:0:0:1:2:0:34
Font_Name=Lucida Sans Unicode

View File

@ -0,0 +1,52 @@
==================================================
SUDT ACCESSPORT END-USER LICENSE AGREEMENT
Copyright (C) 2002-2011 SUDT Studio,
All Rights Reserved.
==================================================
END-USER LICENSE AGREEMENT
This End-User License Agreement ("EULA") is a legal agreement between you (either an individual or a single entity) and the mentioned author of this Software for the software product identified above, which includes computer software and may include associated media, printed materials, and "online"
or electronic documentation ("SOFTWARE PRODUCT"). By installing, copying, or otherwise using the SOFTWARE PRODUCT, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA, do not install or use the SOFTWARE PRODUCT.
SOFTWARE PRODUCT LICENSE
The SOFTWARE PRODUCT is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold.
1. GRANT OF LICENSE. This EULA grants you the following rights:
Installation and Use. You may install and use an unlimited number of copies of the SOFTWARE PRODUCT.
Reproduction and Distribution. You may reproduce and distribute an unlimited number of copies of the SOFTWARE PRODUCT; provided that each copy shall be a true and complete copy, including all copyright and trademark notices, and shall be accompanied by a copy of this EULA. Copies of the SOFTWARE PRODUCT may be distributed as a standalone product or included with your own product.
2. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS.
Limitations on Reverse Engineering, Decompilation, and Disassembly. You may not reverse engineer, decompile, or disassemble the SOFTWARE PRODUCT, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.
Separation of Components.
The SOFTWARE PRODUCT is licensed as a single product. Its component parts may not be separated for use on more than one computer.
Software Transfer.
You may permanently transfer all of your rights under this EULA, provided the recipient agrees to the terms of this EULA.
Termination.
Without prejudice to any other rights, the Author of this Software may terminate this EULA if you fail to comply with the terms and conditions of this EULA. In such event, you must destroy all copies of the SOFTWARE PRODUCT and all of its component parts.
Distribution.
The SOFTWARE PRODUCT may not be sold or be included in a product or package which intends to receive benefits through the inclusion of the SOFTWARE PRODUCT. The SOFTWARE PRODUCT may be included in any free or non-profit packages or products.
3. COPYRIGHT.
All title and copyrights in and to the SOFTWARE PRODUCT (including but not limited to any images, photographs, animations, video, audio, music, text, and "applets" incorporated into the SOFTWARE PRODUCT), the accompanying printed materials, and any copies of the SOFTWARE PRODUCT are owned by the Author of this Software. The SOFTWARE PRODUCT is protected by copyright laws
and international treaty provisions. Therefore, you must treat the SOFTWARE PRODUCT like any other copyrighted material except that you may install the SOFTWARE PRODUCT on a single computer provided you keep the original solely for backup or archival purposes.
LIMITED WARRANTY
NO WARRANTIES.
The Author of this Software expressly disclaims any warranty for the SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related documentation is provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties or merchantability, fitness for a particular purpose, or noninfringement. The entire risk arising out of use
or performance of the SOFTWARE PRODUCT remains with you.
NO LIABILITY FOR DAMAGES.
In no event shall the author of this Software be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of or inability to use this product, even if the Author of this Software has been advised of the possibility of such damages.
=============================================
Author : Fred Chow
Email : support@sudt.com
WebSite : http://www.sudt.com

3
README.en.md Normal file
View File

@ -0,0 +1,3 @@
# 蓝桥杯学习
I prepare the learning code of the 15th Blue Bridge Cup.

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# 蓝桥杯学习
本人准备第十五届蓝桥杯的学习代码

Binary file not shown.

View File

@ -0,0 +1,30 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<WORKSPACE>
<FRAME activewindow="0">
<PLACEMENT>2c0000000200000003000000ffffffffffffffffffffffffffffffffda0000001e000000a8060000d9030000</PLACEMENT>
<WINDOW type="default" module="ISIS">
<editor metric="0" gridmajor="25400000" mode="00000000" zoom="0" scale="72" flipped="0" gridminor="508000" gridmode="32" snapidx="2" snap="254000" xcursor="0" orgmode="0" snaprange="176388">
<world y1="-12700000" x1="-25400000" y2="12700000" x2="25400000"/>
<centre x="2794000" y="-1778000"/>
<origin x="0" y="0"/>
</editor>
</WINDOW>
</FRAME>
<MODULE name="ARES">
<editor metric="0" gridmajor="0" mode="00000000" zoom="10" scale="10" flipped="0" gridminor="0" gridmode="32" snapidx="3" snap="0" xcursor="0" orgmode="0" snaprange="0">
<world y1="-12700000" x1="-15240000" y2="12700000" x2="15240000"/>
<centre x="0" y="0"/>
<origin x="0" y="0"/>
</editor>
</MODULE>
<MODULE name="ISIS">
<editor metric="0" gridmajor="25400000" mode="00000000" zoom="0" scale="72" flipped="0" gridminor="508000" gridmode="32" snapidx="2" snap="254000" xcursor="0" orgmode="0" snaprange="176388">
<world y1="-12700000" x1="-25400000" y2="12700000" x2="25400000"/>
<centre x="2794000" y="-1778000"/>
<origin x="0" y="0"/>
</editor>
</MODULE>
<MODULE name="VSMDEBUG">
<PWI/>
</MODULE>
</WORKSPACE>

View File

@ -0,0 +1,124 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<WORKSPACE>
<FRAME activewindow="0">
<PLACEMENT>2c00000002000000020000000083ffff0083ffffffffffffffffffffe400000018000000f2060000fc030000</PLACEMENT>
<WINDOW type="default" module="ISIS">
<editor metric="0" gridmajor="2540000" mode="00000000" zoom="0" scale="186" flipped="0" gridminor="254000" gridmode="32" snapidx="2" snap="254000" xcursor="0" orgmode="0" snaprange="127000">
<world y1="-12700000" x1="-25400000" y2="12700000" x2="25400000"/>
<centre x="-3556000" y="8128000"/>
<origin x="0" y="0"/>
</editor>
</WINDOW>
</FRAME>
<MODULE name="ARES">
<editor metric="0" gridmajor="0" mode="00000000" zoom="10" scale="10" flipped="0" gridminor="0" gridmode="32" snapidx="3" snap="0" xcursor="0" orgmode="0" snaprange="0">
<world y1="-12700000" x1="-15240000" y2="12700000" x2="15240000"/>
<centre x="0" y="0"/>
<origin x="0" y="0"/>
</editor>
</MODULE>
<MODULE name="ISIS">
<editor metric="0" gridmajor="2540000" mode="00000000" zoom="0" scale="186" flipped="0" gridminor="254000" gridmode="32" snapidx="2" snap="254000" xcursor="0" orgmode="0" snaprange="127000">
<world y1="-12700000" x1="-25400000" y2="12700000" x2="25400000"/>
<centre x="-3556000" y="8128000"/>
<origin x="0" y="0"/>
</editor>
</MODULE>
<MODULE name="VSMDEBUG">
<PWI>
<POPUP w="800" x="48" flags="00000002" y="160" h="200" pid="0" iid="-1">
<PROPERTIES>
<ITEM name="Message Column Width">-22</ITEM>
<ITEM name="ShowGrid">No</ITEM>
<ITEM name="Source Column Width">100</ITEM>
<ITEM name="Version">100</ITEM>
</PROPERTIES>
</POPUP>
<POPUP w="350" x="68" flags="00000032" y="180" h="200" pid="1" iid="-1">
<PROPERTIES>
<ITEM name="Address Column Width">100</ITEM>
<ITEM name="AutoResize">No</ITEM>
<ITEM name="Gridlines">Yes</ITEM>
<ITEM name="Name Column Width">100</ITEM>
<ITEM name="Previous Value Column Width">100</ITEM>
<ITEM name="ShowAddresses">Yes</ITEM>
<ITEM name="ShowPreviousValues">Yes</ITEM>
<ITEM name="ShowTypes">Yes</ITEM>
<ITEM name="ShowWatchPoint">Yes</ITEM>
<ITEM name="TriggerMode">0</ITEM>
<ITEM name="Type Column Width">100</ITEM>
<ITEM name="Value Column Width">100</ITEM>
<ITEM name="Version">100</ITEM>
<ITEM name="Watch Expression Column Width">100</ITEM>
<ITEM name="nItems">0</ITEM>
</PROPERTIES>
</POPUP>
<POPUP w="24" x="88" flags="00000008" y="200" h="17" pid="1" iid="1">
<PROPERTIES/>
</POPUP>
<POPUP w="8" x="108" flags="0000000a" y="220" h="16" pid="3" iid="1">
<PROPERTIES>
<ITEM name="DataType">2</ITEM>
<ITEM name="DispChars">Yes</ITEM>
<ITEM name="DispFormat">2</ITEM>
<ITEM name="ShowChanges">Yes</ITEM>
<ITEM name="ShowToolTips">Yes</ITEM>
<ITEM name="TopLineAddress">00000000</ITEM>
</PROPERTIES>
</POPUP>
<POPUP w="8" x="128" flags="0000000a" y="240" h="16" pid="2" iid="1">
<PROPERTIES>
<ITEM name="DataType">2</ITEM>
<ITEM name="DispChars">Yes</ITEM>
<ITEM name="DispFormat">2</ITEM>
<ITEM name="ShowChanges">Yes</ITEM>
<ITEM name="ShowToolTips">Yes</ITEM>
<ITEM name="TopLineAddress">00000080</ITEM>
</PROPERTIES>
</POPUP>
<POPUP w="8" x="148" flags="0000000a" y="260" h="32" pid="101" iid="43">
<PROPERTIES>
<ITEM name="DataType">2</ITEM>
<ITEM name="DispChars">Yes</ITEM>
<ITEM name="DispFormat">2</ITEM>
<ITEM name="ShowChanges">Yes</ITEM>
<ITEM name="ShowToolTips">Yes</ITEM>
<ITEM name="TopLineAddress">00000000</ITEM>
</PROPERTIES>
</POPUP>
<POPUP w="8" x="168" flags="00000008" y="280" h="1" pid="1" iid="37">
<PROPERTIES>
<ITEM name="DataType">2</ITEM>
<ITEM name="DispChars">Yes</ITEM>
<ITEM name="DispFormat">2</ITEM>
<ITEM name="ShowChanges">Yes</ITEM>
<ITEM name="ShowToolTips">Yes</ITEM>
<ITEM name="TopLineAddress">00000000</ITEM>
</PROPERTIES>
</POPUP>
<POPUP w="8" x="188" flags="00000008" y="300" h="1" pid="2" iid="37">
<PROPERTIES>
<ITEM name="DataType">2</ITEM>
<ITEM name="DispChars">Yes</ITEM>
<ITEM name="DispFormat">2</ITEM>
<ITEM name="ShowChanges">Yes</ITEM>
<ITEM name="ShowToolTips">Yes</ITEM>
<ITEM name="TopLineAddress">00000000</ITEM>
</PROPERTIES>
</POPUP>
<POPUP w="20" x="1210" flags="00000000" y="189" h="3" pid="1" iid="9">
<PROPERTIES/>
</POPUP>
<POPUP w="8" x="228" flags="00000008" y="340" h="4" pid="2" iid="9">
<PROPERTIES>
<ITEM name="DataType">2</ITEM>
<ITEM name="DispChars">Yes</ITEM>
<ITEM name="DispFormat">2</ITEM>
<ITEM name="ShowChanges">Yes</ITEM>
<ITEM name="ShowToolTips">Yes</ITEM>
<ITEM name="TopLineAddress">00000000</ITEM>
</PROPERTIES>
</POPUP>
</PWI>
</MODULE>
</WORKSPACE>

Binary file not shown.

View File

@ -0,0 +1,18 @@
{
"files.associations": {
"main.h": "c",
"onewire.h": "c",
"string.h": "c",
"led.h": "c",
"stc15f2k60s2.h": "c",
"STC15F2K60S2.H": "cpp",
"key.h": "c",
"seg.h": "c",
"intrins.h": "c",
"iic.h": "c",
"uart.h": "c",
"INTRINS.H": "cpp",
"ul.h": "c",
"init.h": "c"
}
}

View File

@ -0,0 +1,96 @@
/* # DS1302代码片段说明
1.
2.
*/
#include "ds1302.h"
#include "intrins.h"
sbit SDA = P2 ^ 3;
sbit RST = P1 ^ 3;
sbit SCK = P1 ^ 7;
//
void Write_Ds1302(unsigned char temp)
{
unsigned char i;
for (i = 0; i < 8; i++)
{
SCK = 0;
SDA = temp & 0x01;
temp >>= 1;
SCK = 1;
}
}
//
void Write_Ds1302_Byte(unsigned char address, unsigned char dat)
{
RST = 0;
_nop_();
SCK = 0;
_nop_();
RST = 1;
_nop_();
Write_Ds1302(address);
Write_Ds1302(dat);
RST = 0;
}
//
unsigned char Read_Ds1302_Byte(unsigned char address)
{
unsigned char i, temp = 0x00;
RST = 0;
_nop_();
SCK = 0;
_nop_();
RST = 1;
_nop_();
Write_Ds1302(address);
for (i = 0; i < 8; i++)
{
SCK = 0;
temp >>= 1;
if (SDA)
temp |= 0x80;
SCK = 1;
}
RST = 0;
_nop_();
SCK = 0;
_nop_();
SCK = 1;
_nop_();
SDA = 0;
_nop_();
SDA = 1;
_nop_();
return (temp);
}
// 十进制 11 -> 0x11
void Set_Rtc(unsigned char *ucRtc)
{
unsigned char i;
unsigned char temp;
Write_Ds1302_Byte(0x8e, 0x00);
Write_Ds1302_Byte(0x80, 0x80);
for (i = 0; i < 3; i++)
{
temp = (ucRtc[i] / 10) * 16 + ucRtc[i] % 10;
Write_Ds1302_Byte(0x84 - 2 * i, temp);
}
Write_Ds1302_Byte(0x8e, 0x80);
}
// 十进制 0x11 -> 11
void Read_Rtc(unsigned char *ucRtc)
{
unsigned char i;
unsigned char temp;
for (i = 0; i < 3; i++)
{
temp = Read_Ds1302_Byte(0x85 - 2 * i);
ucRtc[i] = temp / 16 * 10 + temp % 16;
}
}

View File

@ -0,0 +1,3 @@
#include <STC15F2K60S2.H>
void Set_Rtc(unsigned char *ucRtc);
void Read_Rtc(unsigned char *ucRtc);

View File

@ -0,0 +1,178 @@
/* # I2C代码片段说明
1.
2.
*/
#include "iic.h"
#include "intrins.h"
#define DELAY_TIME 5
sbit scl = P2 ^ 0;
sbit sda = P2 ^ 1;
//
static void I2C_Delay(unsigned char n) {
do {
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
} while (n--);
}
//
void I2CStart(void) {
sda = 1;
scl = 1;
I2C_Delay(DELAY_TIME);
sda = 0;
I2C_Delay(DELAY_TIME);
scl = 0;
}
//
void I2CStop(void) {
sda = 0;
scl = 1;
I2C_Delay(DELAY_TIME);
sda = 1;
I2C_Delay(DELAY_TIME);
}
//
void I2CSendByte(unsigned char byt) {
unsigned char i;
for (i = 0; i < 8; i++) {
scl = 0;
I2C_Delay(DELAY_TIME);
if (byt & 0x80) {
sda = 1;
} else {
sda = 0;
}
I2C_Delay(DELAY_TIME);
scl = 1;
byt <<= 1;
I2C_Delay(DELAY_TIME);
}
scl = 0;
}
//
unsigned char I2CReceiveByte(void) {
unsigned char da;
unsigned char i;
for (i = 0; i < 8; i++) {
scl = 1;
I2C_Delay(DELAY_TIME);
da <<= 1;
if (sda) da |= 0x01;
scl = 0;
I2C_Delay(DELAY_TIME);
}
return da;
}
//
unsigned char I2CWaitAck(void) {
unsigned char ackbit;
scl = 1;
I2C_Delay(DELAY_TIME);
ackbit = sda;
scl = 0;
I2C_Delay(DELAY_TIME);
return ackbit;
}
//
void I2CSendAck(unsigned char ackbit) {
scl = 0;
sda = ackbit;
I2C_Delay(DELAY_TIME);
scl = 1;
I2C_Delay(DELAY_TIME);
scl = 0;
sda = 1;
I2C_Delay(DELAY_TIME);
}
unsigned char Ad_Read(unsigned char addr) {
unsigned char temp;
// 选择芯片为PCF
I2CStart();
I2CSendByte(0x90);
I2CWaitAck();
I2CSendByte(addr);
I2CWaitAck();
I2CStart();
I2CSendByte(0x91);
I2CWaitAck();
temp = I2CReceiveByte();
I2CSendAck(1);
I2CStop();
return temp;
}
// 数字电压255->5V
void Da_Write(unsigned char dat) {
// 选择芯片为PCF
I2CStart();
I2CSendByte(0x90);
I2CWaitAck();
I2CSendByte(0x41);
I2CWaitAck();
I2CSendByte(dat);
I2CWaitAck();
}
void EEPROM_Write(unsigned char *str, unsigned char addr, unsigned char num) {
I2CStart();
I2CSendByte(0xa0);
I2CWaitAck();
I2CSendByte(addr);
I2CWaitAck();
while (num--) {
I2CSendByte(*str++);
I2CWaitAck();
I2C_Delay(200);
}
I2CStop();
I2C_Delay(255);
I2C_Delay(255);
I2C_Delay(255);
I2C_Delay(255);
}
void EEPROM_Read(unsigned char *str, unsigned char addr, unsigned char num) {
I2CStart();
I2CSendByte(0xa0);
I2CWaitAck();
I2CSendByte(addr);
I2CWaitAck();
I2CStart();
I2CSendByte(0xa1);
I2CWaitAck();
while (num--) {
*str++ = I2CReceiveByte();
if (num)
I2CSendAck(0);
else
I2CSendAck(1);
}
I2CStop();
}

View File

@ -0,0 +1,5 @@
#include <STC15F2K60S2.H>
unsigned char Ad_Read(unsigned char addr);
void Da_Write(unsigned char dat);
void EEPROM_Write(unsigned char *str, unsigned char addr, unsigned char num);
void EEPROM_Read(unsigned char *str, unsigned char addr, unsigned char num);

View File

@ -0,0 +1,10 @@
#include "init.h"
void System_Init() {
P0 = 0xff;
P2 = P2 & 0x1f | 0x80;
P2 &= 0x1f;
P0 = 0x00;
P2 = P2 & 0x1f | 0xa0;
P2 &= 0x1f;
}

View File

@ -0,0 +1,2 @@
#include <STC15F2K60S2.H>
void System_Init();

View File

@ -0,0 +1,45 @@
#include "key.h"
unsigned char Key_Read() {
unsigned char temp = 0;
ET1 = 0;
P44 = 0;
P42 = 1;
P35 = 1;
P34 = 1;
if (P33 == 0) temp = 4;
if (P32 == 0) temp = 5;
if (P31 == 0) temp = 6;
if (P30 == 0) temp = 7;
P44 = 1;
P42 = 0;
P35 = 1;
P34 = 1;
if (P33 == 0) temp = 8;
if (P32 == 0) temp = 9;
if (P31 == 0) temp = 10;
if (P30 == 0) temp = 11;
P44 = 1;
P42 = 1;
P35 = 0;
P34 = 1;
if (P33 == 0) temp = 12;
if (P32 == 0) temp = 13;
if (P31 == 0) temp = 14;
if (P30 == 0) temp = 15;
P44 = 1;
P42 = 1;
P35 = 1;
P34 = 0;
if (P33 == 0) temp = 16;
if (P32 == 0) temp = 17;
if (P31 == 0) temp = 18;
if (P30 == 0) temp = 19;
P3 = 0xff;
ET1 = 1;
return temp;
}

View File

@ -0,0 +1,2 @@
#include <STC15F2K60S2.H>
unsigned char Key_Read();

View File

@ -0,0 +1,63 @@
#include "led.h"
/// @brief Led扫描
/// @param addr 需要控制的Led的地址0-7
/// @param enable 控制该地址的Led是否点亮
void Led_Disp(unsigned char addr, unsigned char enable) {
static unsigned char temp = 0x00;
static unsigned char temp_old = 0xff;
if (enable)
temp |= 0x01 << addr;
else
temp &= ~(0x01 << addr);
if (temp != temp_old) {
P0 = ~temp;
P2 = P2 & 0x1f | 0x80;
P2 &= 0x1f;
temp_old = temp;
}
}
unsigned char temp_0 = 0x00;
unsigned char temp_old_0 = 0xff;
/// @brief 蜂鸣器控制
/// @param enable
void Beep(bit enable) {
if (enable)
temp_0 |= 0x40;
else
temp_0 &= ~(0x40);
if (temp_0 != temp_old_0) {
P0 = temp_0;
P2 = P2 & 0x1f | 0xa0;
P2 &= 0x1f;
temp_old_0 = temp_0;
}
}
/// @brief 继电器控制
/// @param enable
void Relay(bit enable) {
if (enable)
temp_0 |= 0x10;
else
temp_0 &= ~(0x10);
if (temp_0 != temp_old_0) {
P0 = temp_0;
P2 = P2 & 0x1f | 0xa0;
P2 &= 0x1f;
temp_old_0 = temp_0;
}
}
/// @brief MOTOR控制
/// @param enable
void MOTOR(bit enable) {
if (enable)
temp_0 |= 0x20;
else
temp_0 &= ~(0x20);
if (temp_0 != temp_old_0) {
P0 = temp_0;
P2 = P2 & 0x1f | 0xa0;
P2 &= 0x1f;
temp_old_0 = temp_0;
}
}

View File

@ -0,0 +1,5 @@
#include <STC15F2K60S2.H>
void Led_Disp(unsigned char addr, unsigned char enable);
void Beep(bit enable);
void Relay(bit enable);
void MOTOR(bit enable);

View File

@ -0,0 +1,77 @@
/* # 单总线代码片段说明
1.
2.
*/
#include "onewire.h"
sbit DQ = P1 ^ 4;
//
void Delay_OneWire(unsigned int t) {
unsigned char i;
while (t--) {
for (i = 0; i < 12; i++);
}
}
//
void Write_DS18B20(unsigned char dat) {
unsigned char i;
for (i = 0; i < 8; i++) {
DQ = 0;
DQ = dat & 0x01;
Delay_OneWire(5);
DQ = 1;
dat >>= 1;
}
Delay_OneWire(5);
}
//
unsigned char Read_DS18B20(void) {
unsigned char i;
unsigned char dat;
for (i = 0; i < 8; i++) {
DQ = 0;
dat >>= 1;
DQ = 1;
if (DQ) {
dat |= 0x80;
}
Delay_OneWire(5);
}
return dat;
}
//
bit init_ds18b20(void) {
bit initflag = 0;
DQ = 1;
Delay_OneWire(12);
DQ = 0;
Delay_OneWire(80);
DQ = 1;
Delay_OneWire(10);
initflag = DQ;
Delay_OneWire(5);
return initflag;
}
float rd_temperature() {
unsigned char low, high;
init_ds18b20();
Write_DS18B20(0xcc);
Write_DS18B20(0x44);
Delay_OneWire(200);
init_ds18b20();
Write_DS18B20(0xcc);
Write_DS18B20(0xbe);
low = Read_DS18B20();
high = Read_DS18B20();
return (float)(high << 8 | low) * 0.0625;
}

View File

@ -0,0 +1,2 @@
#include <STC15F2K60S2.H>
float rd_temperature();

View File

@ -0,0 +1,22 @@
#include "seg.h"
// 0-9 Ãð
// A
code unsigned char seg_dula[] = {0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92,
0x82, 0xf8, 0x80, 0x90, 0xff, 0x88};
void Seg_Disp(unsigned char wela, unsigned char dula, unsigned char point) {
// ÏûÒþ
P0 = 0xff;
P2 = P2 & 0x1f | 0xe0;
P2 &= 0x1f;
// λѡ
P0 = 0x01 << wela;
P2 = P2 & 0x1f | 0xc0;
P2 &= 0x1f;
// ¶ÎÑ¡
P0 = seg_dula[dula];
if (point) P0 &= 0x7f;
P2 = P2 & 0x1f | 0xe0;
P2 &= 0x1f;
}

View File

@ -0,0 +1,2 @@
#include <STC15F2K60S2.H>
void Seg_Disp(unsigned char wela, unsigned char dula, unsigned char point);

View File

@ -0,0 +1,18 @@
#include "uart.h"
void Uart1_Init(void) // 9600bps@12.000MHz
{
SCON = 0x50; // 8位数据,可变波特率
AUXR |= 0x01; // 串口1选择定时器2为波特率发生器
AUXR |= 0x04; // 定时器时钟1T模式
T2L = 0xC7; // 设置定时初始值
T2H = 0xFE; // 设置定时初始值
AUXR |= 0x10; // 定时器2开始计时
ES = 1; // 使能串口1中断
EA = 1;
}
extern char putchar(char ch) {
SBUF = ch;
while (TI == 0);
TI = 0;
return ch;
}

View File

@ -0,0 +1,4 @@
#include <STC15F2K60S2.H>
#include "stdio.h"
void Uart1_Init(void);

Some files were not shown because too many files have changed in this diff Show More