STC15W4K32S4 series MCU d. Data Sheet -...
Transcript of STC15W4K32S4 series MCU d. Data Sheet -...
-
STC15W4K32S4 series MCU Data Sheet
Website:www.STCMCU.comwww.GXWMCU.com
UpdateDate:2015/2/6
STC MC
U Limite
d.
STCtheglobalfirstbrandof8051MCU,thebiggestdesigncompanyof8051MCUintheworld
STC15W4K32S4seriesMCUManual TemporaryTechnicalAdviser:(86)13922829991 QQofR&D:800003751
www.GXWMCU.comwww.STCMCU.com
TelofR&D:(86)13922805190
-
STC MC
U Limite
d
CONTENTSChapter1GeneralOverviewofSTC15W4K32S4series..............12
1.1IntroductionofSTC15W4K32S4seriesMCU................................. 121.2BlockdiagramofSTC15W4K32S4seriesMCU............................. 151.3PinConfigurationsofSTC15W4K32S4seriesMCU...................... 161.4STC15W4K32S4seriesSelectionandPriceTable........................... 211.5NamingrulesofSTC15W4K32S4seriesMCU............................... 221.6ApplicationCircuitDiagramforISPofSTC15W4Kseries.............. 23
1.6.1ApplicationCircuitDiagramforISPusingRS-232Converter................... 231.6.2ApplicationCircuitDiagramforISPusingUSBtoconvertSerialPort..... 241.6.3ApplicationCircuitDiagramforISPdirectlyusingUSBport.................... 25
P3.0/P3.1ofSTC15W4KseriesandIAP15W4K58S4connectdirectlywithD-/D+ofUSB......25
1.7PinDescriptionsofSTC15W4K32S4seriesMCU.......................... 261.8PackageDimensionDrawingsofSTC15seriesMCU..................... 33
1.8.1DimensionDrawingsofDFN8..................................................................... 331.8.2DimensionDrawingsofSOP8..................................................................... 341.8.3DimensionDrawingsofDIP8...................................................................... 351.8.4DimensionDrawingsofSOP16................................................................... 361.8.5DimensionDrawingsofDIP16.................................................................... 371.8.6DimensionDrawingsofSOP20................................................................... 381.8.7DimensionDrawingsofTSSOP20............................................................... 391.8.8DimensionDrawingsofLSSOP20............................................................... 401.8.9DimensionDrawingsofDIP20.................................................................... 411.8.10DimensionDrawingsofSOP28................................................................. 421.8.11DimensionDrawingsofTSSOP28............................................................. 431.8.12DimensionDrawingsofSKDIP28............................................................. 441.8.13DimensionDrawingsofQFN28................................................................. 451.8.14DimensionDrawingsofLQFP32............................................................... 461.8.15DimensionDrawingsofSOP32................................................................. 471.8.16DimensionDrawingsofQFN32................................................................. 481.8.17DimensionDrawingsofPDIP40................................................................ 491.8.18DimensionDrawingsofLQFP44............................................................... 501.8.19DimensionDrawingsofPLCC44............................................................... 51
-
STC MC
U Limite
d
1.8.20DimensionDrawingsofPQFP44............................................................... 521.8.21DimensionDrawingsofLQFP48............................................................... 531.8.22DimensionDrawingsofQFN48................................................................. 541.8.23DimensionDrawingsofLQFP64S............................................................. 551.8.24DimensionDrawingsofLQFP64L............................................................. 561.8.25DimensionDrawingsofQFN64................................................................. 57
1.9SpecialPeripheralFunction(CCP/SPI,UART1/2/3/4)Switch........... 581.9.1TestPorgramthatSwitchCCP/PWM/PCA(CandASM).......................... 601.9.2TestPorgramthatSwitchPWM2/3/4/5/PWMFLT(CandASM)............... 621.9.3TestPorgramthatSwitchPWM6/PWM7(CandASM).............................. 641.9.4TestPorgramthatSwitchSPI(CandASM)............................................... 661.9.5TestPorgramthatSwitchUART1(CandASM)........................................ 681.9.6TestPorgramthatSwitchUART2(CandASM)........................................ 701.9.7TestPorgramthatSwitchUART3(CandASM)........................................ 721.9.8TestPorgramthatSwitchUART4(CandASM)........................................ 74
1.10GlobalUniqueIdentificationNumber(ID).................................... 76Chapter2Clock,ResetandPowerManagement...........................81
2.1Clock................................................................................................. 812.1.1On-ChipConfigurableClock...................................................................... 812.1.2DividerforSystemClock............................................................................ 822.1.3ProgrammableClockOutput(orasFrequencyDivider)............................ 83
2.1.3.1SpecialFunctionRegistersRelatedtoProgrammableClockOutput..................832.1.3.2MasterClockOutputandDemoProgram(CandASM)......................................882.1.3.3Timer0ProgrammableClockOutputandDemoProgram(CandASM)............912.1.3.4Timer1ProgrammableClockOutputandDemoProgram(CandASM)............952.1.3.5Timer2ProgrammableClockOutputandDemoProgram(CandASM)...........992.1.3.6Timer3ProgrammableClockOutputandDemoProgram(CandASM).........1032.1.3.7Timer4ProgrammableClockOutputandDemoProgram(CandASM).........104
2.2RESETSources............................................................................... 1052.2.1ExternalRSTpinReset............................................................................. 1052.2.2SoftwareResetandDemoProgram(CandASM).................................... 1062.2.3Power-Off/Power-OnReset(POR)......................................................... 1092.2.4MAX810SpeicalCircuitReset(Power-Off/Power-OnResetDelay)..... 1092.2.5InternalLowVoltageDetectionReset....................................................... 1102.2.6Watch-Dog-TimerReset............................................................................ 1132.2.7ResetCausedbyProgramAccessinganInvalidAddress......................... 1172.2.8WarmBootandColdBootReset.............................................................. 118
-
2.3PowerManagementModes..............................................................1192.3.1SlowDownModeandDemoProgram(CandASM)............................... 1202.3.2IdleModeandDemoProgram(CandASM)............................................ 1232.2.3Stop/PowerDown(PD)ModeandDemoProgram(CandASM).......... 125
2.3.3.1DemoProgramUsingPower-DownWake-UpTimertoWakeUpStop/PDMode....1272.3.3.2DemoProgramUsingExternalInterruptINT0toWakeUpStop/PDMode.....1292.3.3.3DemoProgramUsingExternalInterruptINT1toWakeUpStop/PDMode.....1312.3.3.4DemoProgramUsingExternalInterruptINT2toWakeUpStop/PDMode.....1332.3.3.5DemoProgramUsingExternalInterruptINT3toWakeUpStop/PDMode.....1352.3.3.6DemoProgramUsingExternalInterruptINT4toWakeUpStop/PDMode.....1372.3.3.7ProgramUsingExternalInterruptExtendedbyCCP/PCAtoWakeUpPDMode..1392.3.3.8ProgramUsingtheLevelChangeofRxDpintoWakeUpStop/PDMode.......1432.3.3.9ProgramUsingtheLevelChangeofRxD2pintoWakeUpStop/PDMode.....147
Chapter3MemoryOrganizationandSFRs.................................1513.1ProgramMemory............................................................................ 1513.2DataMemory(SRAM)................................................................... 152
3.2.1On-chipScratch-PadRAM....................................................................... 1523.2.2On-ChipExpandedRAM/XRAM/AUX-RAM...................................... 1543.2.3ExternalExpandable64KBRAM(Off-ChipRAM)................................. 160
3.3SpecialFunctionRegisters.............................................................. 1633.3.1SpecialFunctionRegistersAddressMap.................................................. 1633.3.2SpecialFunctionRegistersBitsDescription............................................. 1643.3.3DualDataPointerRegister(DPTR).......................................................... 170
Chapter4ConfigurableI/OPortsofSTC15seriesMCU...........1714.1I/OPortsConfigurations................................................................. 1714.2SpecialExplanationofP1.7/XTAL1andP1.6/XTAL2pin............ 1744.3SpecialExplanationofRSTpin...................................................... 1744.4SpecialExplanationofRSTOUT_LOWpin.................................. 1744.5SFRsrelatedtoI/OportsandItsAddressStatement...................... 1754.6DemoProgramofSTC15seriesP0/P1/P2/P3/P4/P5..................... 1794.7I/OportsModes.............................................................................. 185
4.7.1Quasi-BidirectionalI/O............................................................................. 1854.7.2Push-PullOutput....................................................................................... 1854.7.3Input-Only(High-Impedance)Mode......................................................... 1864.7.4Open-DrainOutput.................................................................................... 186
-
4.8I/OPortApplicationNotes.............................................................. 1864.9TypicalTransistorControlCircuit.................................................. 1874.10TypicalDiodeControlCircuit....................................................... 1874.11HowtoMakeI/OPortLowafterMCUReset.............................. 1874.12KeyboardScanningCircuitusingI/Oports.................................. 1884.13PinFunctionandLogicTurthTableof74HC595......................... 1894.14CircuitExpandingI/Oportsusing74HC595................................ 1904.15CircuitDriving8-segmentDigitronusing74HC595.................... 1914.16DemoProgramofDriving8-SegmentDigitron........................... 192UsingcommonI/OportstoControl74HC595.................... 1924.17ApplicationCircuitusingA/DConversiontoScanKey............. 1994.18DemoProgramusingI/OportstoSimulateI2CInterface............ 200
4.18.1MasterModeusingI/OportstoSimulateI2CInterfacebySoftware..... 2004.18.2SlaveModeusingI/OportstoSimulateI2CInterfacebySoftware........ 203
Chapter5.InstructionSystem......................................................2065.1AddressingModes........................................................................... 206
5.1.1ImmediateAddressing............................................................................... 2065.1.2DirectAddressing...................................................................................... 2065.1.3IndirectAddressing.................................................................................... 2065.1.4RegisterAddressing................................................................................... 2075.1.5InherentAddressing................................................................................... 2075.1.6IndexAddressing....................................................................................... 2075.1.7BitAddressing........................................................................................... 207
5.2InstructionSetSummary................................................................. 2085.3InstructionDefinitionsofTraditional8051MCU.......................... 214
Chapter6InterruptSystem..........................................................2516.1InterruptStructure........................................................................... 2526.2InterruptVectorAddress/Priority/RequestFlagTable.................... 2556.3HowtoDeclareInterruptFunctioninKeilC................................. 2566.4InterruptRegisters........................................................................... 2576.5InterruptPriorities........................................................................... 2666.6InterruptHandling........................................................................... 2686.7InterruptNesting............................................................................. 270
-
6.8ExternalInterrupts......................................................................... 2706.9InterruptDemoProgram(CandASM).......................................... 271
6.9.1ExternalInterrupt0(INT0)DemoProgram.............................................. 2716.9.1.1ExternalInteruptINT0(rising+fallingedge)DemoProgram(CandASM)...2716.9.1.2ExternalInterruptINT0(fallingedge)DemoProgram(CandASM)...............273
6.9.2ExternalInterrupt1(INT1)DemoProgram............................................... 2756.9.2.1ExternalInterruptINT1(rising+fallingedge)DemoProgram(CandASM)..2756.9.2.2ExternalInterruptINT1(fallingedge)DemoProgram(CandASM)...............277
6.9.3ExternalInterrupt2(INT2)(falling)DemoProgram(CandASM)......... 2796.9.4ExternalInterrupt3(INT3)(falling)DemoProgram(CandASM)......... 2816.9.5ExternalInterrupt4(INT4)(falling)DemoProgram(CandASM)......... 2836.9.6DemoProgramusingT0toexpandExternalInterrupt(Falling).............. 285T0asCounter(CandASM)............................................................. 2856.9.7DemoProgramusingT1toexpandExternalInterrupt(Falling).............. 287T1asCounter(CandASM)............................................................. 2876.9.8DemoProgramusingT2toexpandExternalInterrupt(Falling).............. 289T2asCounter(CandASM)............................................................. 2896.9.9DemoProgramusingCCP/PCAtoexpandExternalInterrupt................. 292
Chapter7Timer/Counter.............................................................2967.1SpecialFunctionRegistersaboutTimer/Counter........................... 2977.2Timer/Counter0Modes.................................................................. 305
7.2.1Mode0(16-BitAuto-RelaodTimer/Counter)andDemoProgram.......... 3057.2.1.1DemoProgramof16-bitAuto-ReloadTimer/Counter0(CandASM).............3067.2.1.2DemoProgramofT0ProgrammableClockOutput(CandASM)....................309T0as16-bitAuto-ReloadTimer/Counter....................3097.2.1.3DemoProgramusing16-bitauto-reloadTimer0toSimulate10or16bitsPWM..3127.2.1.4DemoProgramusingT0toexpandExternalInterrupt(Fallingedge)...............315T0as16-bitAuto-RelaodCounter(CandASM)...............315
7.2.2Mode1(16-bitTimer/Counter)andDemoProgram(CandASM).......... 3177.2.3Mode2(8-bitAuto-ReloadTimer/Counter)andDemoProgram............. 3217.2.4Mode3(16-bitAuto-RelaodTimer/CouterwhoseInterruptcannotbedisabled)324
7.3Timer/Counter1Modes.................................................................. 3257.3.1Mode0(16-BitAuto-RelaodTimer/Counter)andDemoProgram.......... 325
7.3.1.1DemoProgramof16-bitAuto-ReloadTimer/Counter1(CandASM).............3267.3.1.2DemoProgramofT1ProgrammableClockOutput(CandASM)....................329T1as16-bitAuto-ReloadTimer/Counter.....................3297.3.1.3DemoProgramusing16-bitauto-reloadTimer1asUART1baud-rateGenerator..332
-
7.3.1.4DemoProgramusingT1toexpandExternalInterrupt(Fallingedge)...............338T1as16-bitAuto-RelaodCounter(CandASM)...............338
7.3.2Mode1(16-bitTimer/Counter)andDemoPrograms(CandASM)........ 3407.3.3Mode2(8-bitAuto-ReloadTimer/Counter)andDemoProgram............. 344
7.3.3.1DemoProgramusing8-bitauto-reloadTimer1asUART1baud-rateGenerator....3457.3.3.2DemoProgramusingT1toexpandExternalInterrupt(Fallingedge)...............350T1as8-bitAuto-RelaodCounter(CandASM)...............350
7.4Timer/Counter2.............................................................................. 3527.4.1SpecialFunctionRegistersaboutTimer/Counter2................................... 3527.4.2Timer/Counter2as16-BitAuto-ReloadTimer/Counter........................... 355
7.5.2.1DemoProgramof16-bitAuto-ReloadTimer/Counter2(CandASM).............3567.5.2.2DemoProgramusingT2toexpandExternalInterrupt(Fallingedge)...............359T2as16-bitAuto-RelaodCounter(CandASM)...............359
7.4.3Timer/Counter2ProgrammableClockOutputandDemoProgram......... 3627.4.4Timer/Counter2asBaud-RateGeneratorofSerialPort(UART)............ 366
7.5.4.1DemoProgramusingTimer/Counter2asUART1Baud-RateGenerator.........3677.5.4.2DemoProgramusingTimer/Counter2asUART2Baud-RateGenerator.........373
7.5Timer/Counter3andTimer/Counter4............................................ 3797.5.1SpecialFunctionRegistersaboutTimer/Counter3and4......................... 3797.5.2Timer/Counter3........................................................................................ 381
7.5.2.1Timer/Counter3as16-BitAuto-ReloadTimer/Counter....................................3817.5.2.2Timer/Counter3ProgrammableClockOutput..................................................3827.5.2.3Timer/Counter3asBaud-RateGeneratorofSerialPort3(UART3)................383
7.5.3Timer/Counter4........................................................................................ 3847.5.3.1Timer/Counter4as16-BitAuto-ReloadTimer/Counter....................................3847.5.3.2Timer/Counter4ProgrammableClockOutput..................................................3857.5.3.3Timer/Counter4asBaud-RateGeneratorofSerialPort4(UART4)................386
7.6HowtoIncreaseT0/T1/T2/T3/T4Speedby12times.................... 3877.7ProgrammableClockOutput(orasFrequencyDivider)................ 389
7.7.1SpecialFunctionRegistersRelatedtoProgrammableClockOutput........ 3897.7.2MasterClockOutputandDemoProgram(CandASM)........................... 3947.7.3Timer0ProgrammableClockOutputandDemoProgram....................... 3977.7.4Timer1ProgrammableClockOutputandDemoProgram....................... 4017.7.5Timer2ProgrammableClockOutputandDemoProgram....................... 4057.7.6Timer3ProgrammableClockOutputandDemoProgram....................... 4097.7.7Timer4ProgrammableClockOutputandDemoProgram....................... 410
7.8Power-DownWake-UpSpecialTimerandDemoProgram............4117.9ApplicationNotesforTimerinpractice.......................................... 416
-
STC MC
U Limite
d
Chapter8SerialPort(UART)Communication..........................4178.1SpecialFunctionRegistersaboutSerialPort1(UART1).............. 4188.2UART1OperationModes.............................................................. 423
8.2.1Mode0:8-BitShiftRegister.................................................................... 4238.2.2Mode1:8-BitUARTwithVariableBaudRate......................................... 4258.2.3Mode2:9-BitUARTwithFixedBaudRate............................................. 4288.2.4Mode3:9-BitUARTwithVariableBaudRate......................................... 430
8.3BuadRatesSettingofUART1andDemoProgram........................ 4328.4DemoProgramofUART1(CandASM)....................................... 434
8.4.1DemoProgramusingT2asUART1Baud-RateGenerator(C&ASM).... 4348.4.2DemoProgramusingT1asUART1Baud-RateGenerator(C&ASM)..... 440T1inMode0(16-bitAuto-ReloadTimer/Counter)... 4408.4.3DemoProgramusingT1asUART1Baud-RateGenerator(C&ASM)..... 446T1inMode2(8-bitAuto-ReloadTimer/Counter)..... 446
8.5FrameErrorDetection.................................................................... 4528.6MultiprocessorCommunications.................................................... 4528.7AutomaticAddressRecognitionofUART1................................... 453
8.7.1SpecialFucntionRegistersaboutAutomaticAddressRecognition.......... 4538.7.2InstructionofAutomaticAddressRecognition......................................... 4558.7.3DemoProgramofAutomaticAddressRecognition(CandASM)........... 458
8.8SpecialFunctionRegistersaboutSerialPort2(UART2).............. 4648.9UART2OperationModes............................................................... 467
8.9.1Mode0:8-bitUART2withVariableBaud-Rate..................................... 4678.9.2Mode3:9-bitUART2withVariableBaud-Rate....................................... 467
8.10DemoProgramofUART2(CandASM)..................................... 468-----UsingTimer2asUART2Baud-RateGenerator................... 4688.11SpecialFunctionRegistersaboutSerialPort3(UART3)............. 4748.12UART3OperationModes............................................................. 478
8.12.1Mode0:8-bitUART3withVariableBaud-Rate................................... 4788.12.2Mode3:9-bitUART3withVariableBaud-Rate..................................... 479
8.13SpecialFunctionRegistersaboutSerialPort4(UART4)............ 4808.14UART4OperationModes............................................................. 484
8.14.1Mode0:8-bitUART4withVariableBaud-Rate................................... 4848.14.2Mode3:9-bitUART4withVariableBaud-Rate..................................... 485
-
STC MC
U Limite
d
Chapter9IAP/EEPROMFunctionofSTC15Series..................4869.1IAP/EEPROMSpecialFunctionRegisters................................... 4879.2STC15W4K32S4SeriesInternalEEPROMAllocationTable....... 4919.3IAP/EEPROMAssemblyProgramIntroduction............................ 4949.4EEPROMDemoProgram(CandASM)........................................ 497
9.4.1EEPROMDemoProgram(notTransmitdatabyUART)......................... 4979.4.2EEPROMDemoProgram(TransmitdatabyUART)(CandASM)........ 505
Chapter10AnalogtoDigitalConverter......................................51510.1A/DConverterStructure............................................................... 51510.2RegistersforADC......................................................................... 51710.3ADCTypicalApplicationCircuit.................................................. 52010.4ApplicationCircuitusingA/DConversiontoScanKey............. 52110.5ADCReferenceVoltageSource.................................................... 52210.6ADCDemoProgram(CandASM)............................................. 523
10.6.1DemoProgram(DemonstrateinADCInterruptMode).......................... 52310.6.2DemoProgram(DemonstrateinPollingMode).................................... 529
10.7CircuitDiagramusingSPItoExtend12-bitADC(TLC2543)....... 537Chapter11ApplicationofCCP/PCA/PWM/DAC......................538
11.1SpecialFunctionRegistersrelatedwithCCP/PCA/PWM............ 53811.2CCP/PCA/PWMStructure............................................................ 54411.3CCP/PCAModulesOperationMode............................................ 546
11.3.1CCP/PCACaptureMode......................................................................... 54711.3.216-bitSoftwareTimerMode................................................................... 54711.3.3HighSpeedOutputMode........................................................................ 54811.3.4PulseWidthModulatorMode(PWMmode).......................................... 549
11.3.4.18-bitPulseWidthModulator(PWMmode).....................................................54911.3.4.27-bitPulseWidthModulator(PWMmode).....................................................55011.3.4.36-bitPulseWidthModulator(PWMmode).....................................................552
11.4ProgramusingCCP/PCAtoExtendExternalInterrupt................ 55311.5DemoProgramforCCP/PCAactedas16-bitTimer.................... 55711.6DemoProgramusingCCP/PCAtooutputHighSpeedPulse....... 56211.7DemoProgramforCCP/PCAOutputingPWM(6+7+8bit)........ 56711.8Programachieving9~16bitPWMOutputbyCCP/PCA............. 571
-
11.9DemoProgramofCCP/PCA16-bitCaptureMode...................... 57511.10DemoProgramusingT0toSimulate10or16bitsPWM.......... 581T0as16-bitAuto-ReloadTimer/Counter.......... 58111.11CircuitDiagramusingCCP/PCAtoachieve8~16bitDAC...... 584
Chapter12New6ChannelsofPWMofSTC15W4Kseries......585High-PrecisionPWMwithDeathTimeControl.......585
12.1SpecialFunctionRegistersofNewPWMGenerators................... 58612.2InterruptsofNewEnhancedPWMGenerators............................. 594
Chapter13ComparatorofSTC15WseriesMCU.......................60513.1ComparatorDemoProgramusingInterrupt(CandASM)............. 60813.2ComparatorDemoProgramusingPolling(CandASM)............... 612
Chapter14CapacitiveSensingTouchKey..................................616AchievedbyADCofSTC15Wseries.............616Chapter15SysnchronousSerialPeripheralInterface.................637
15.1SpecialFunctionRegistersrelatedwithSPI................................. 63715.2SPIStructure................................................................................. 64015.3SPIDataCommunication............................................................. 641
15.3.1SPIDataCommunicationModes............................................................ 64215.3.2SPIConfiguration.................................................................................... 64415.3.3AdditionalConsiderationsforaSlave.................................................... 64515.3.4AdditionalConsiderationsforaMaster.................................................. 64515.3.5ModeChangeonSS-pin....................................................................... 64515.3.6WriteCollision........................................................................................ 64615.3.7SPIClockRateSelect............................................................................. 64615.3.8SPIDataMode........................................................................................ 647
15.4SPIFunctionDemoProgram(SingleMasterSingleSlave)....... 64915.4.1SPIFunctionDemoProgramusingInterrupt(CandASM).................... 64915.4.2SPIFunctionDemoProgramsusingPollingmode(CandASM).......... 655
15.5SPIFunctionDemoProgram(EachotherasMaster-Slave).......... 66115.5.1SPIFunctionDemoProgramsusingInterrupts(CandASM)................ 66115.5.2SPIFunctionDemoProgramsusingPolling........................................... 667
15.6SPIDemo(SingleMasterMultipleSlave).................................. 673
-
Chapter16Compiler/ISPProgrammer/Emulator....................68316.1Compiler/AssemblerandHeadFile.............................................. 68316.2USBDownloadToolOn-Line/Off-LineU8/U8-Mini........ 691
16.2.1IntroducetheMainModulesofU8(RMB100yuan).............................. 69316.2.2InstalltheDriverofU8Tool.................................................................... 694
16.3ISPProgrammer/Burner.............................................................. 69616.3.1In-System-Programming(ISP)principle................................................. 69616.3.2ApplicationCircuitDiagramforISPofSTC15W4K32S4series............ 697
16.3.2.1ApplicationCircuitDiagramforISPusingRS-232Converter........................69716.3.2.2ApplicationCircuitDiagramforISPusingUSBtoconvertSerialPort..........69916.3.2.3ApplicationCircuitDiagramforISPdirectlyusingUSBport.........................700P3.0/P3.1ofSTC15W4KseriesandIAP15W4K58S4connectdirectlywithD-/D+ofUSB....700
16.3.3PackageRealDiagramofSTCMCU..................................................... 70116.3.4HowtoUtilizeTransitionSockettoinstallSMD................................... 70416.3.5PCSideControlSoftwareUsage............................................................ 70916.3.6HowtoReleaseProject........................................................................... 71816.3.7HowtoEncryptUserCodebySoftwareSTC15-ISP-Ver6.82................ 72216.3.8Self-DefinedDownloadandDemoProgram.......................................... 723
16.4EmulatorofSTC15seriesMCU................................................... 726Chapter17HowtoProgramSlaveChipbyMasterChip............731theSlaveChipisonlyforSTC15seriesMCU.........731AppendixA:AssemblyLanguageProgramming........................742AppendixB:8051CProgramming.............................................764AppendixC:Indirectaddressinginner256BRAM....................774AppendixD:UsingSerialporttoExpandI/OPorts....................775AppendixE:LEDDrivenbyanI/OportandKeyScan..............777AppendixF:NotesofSTC15replacingStandard8051..............778AppendixG:InstructionSpeedBoostSummary.........................780AppendixH:HowtoreducetheCodeLengthbyKeilC............786AppendixI:CircuitDiagramofSTC15DemoBoard.................787
-
STC MC
U Limite
d.
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/296612
STC15W4K32S4seriesMCUManual www.GXWMCU.com TemporaryTechnicalAdviser:(86)13922829991 TelofR&DAdviser:(86)13922805190
Fax:0513-55012969/2956/2947
Chapter 1. General Overview of STC15W4K32S4 series
1.1 Introduction of STC15W4K32S4 series MCUSTC15W4K32S4seriesMCUisasingle-chipmicrocontrollerbasedonahighperformance1Tarchitecture
8051CPU,whichisproducedbySTCMCULimited.It isanewgenerationof8051MCUwithhighspeed,highstability,widevoltagerange,lowpowerconsumptionandsuperstronganti-disturbance.Withtheenhancedkernel,STC15W4K32S4seriesMCUisfaster than the traditional8051one inexecuting instructions(about8~12timestherateofthetraditional8051MCU),andhasafullycompatibleinstructionsetwithtraditional8051seriesmicrocontroller.Externalexpensivecrystalcanberemovedbybeingintegratedinternalhigh-preciseR/Cclock(0.3%)with1%temperaturedrift(-40 ~+85 )while0.6%innormaltemperature(-20 ~+65 ).Externalresetcurcuitalsocanberemovedbybeingintegratedinternalhighlyreliableonewith16levelsoptionalthresholdvoltageofreset.TheSTC15W4K32S4seriesMCUretainsallfeaturesofthetraditional8051one.Inaddition,ithas8-channelsand10-bitsPWM,8-channelsand10-bitsA/DConverter(300thousandtimespersec.),Comparator, largecapacityof4KbytesSRAM,fourhigh-speedasynchronousserialports----UARTs(UART1/UART2/UART3/UART4)andahigh-speedsynchronousserialperipheralinterface----SPI.
InKeilCdevelopmentenvironment,pleasechoosetheIntel8052tocompilingandonlycontainasheaderfile.
STC15familywithsuperhigh-speedCPUcoreofSTC-Y5works20%fasterthanSTCearly1Tseries(suchasSTC12/STC11/STC10series)insameclockfrequency.
Enhanced8051CentralProcessingUnit,1T,singleclockpermachinecycle,faster8~12timesthantherateofatraditional8051.
Operatingvoltagerange:5.5V~2.5V.
On-chip16K/32K/40K/48K/56K/58K/61K/63.5KFLASHprogrammemorywithflexibleISP/IAPcapability,canberepeatedlyerasedmorethan100thousandtimes.
Largecapacityofon-chip4096bytesSRAM:256bytescratch-padRAMand3840bytesofauxiliaryRAM
Becapableofaddressingupto64KbyteofexternalRAM
On-chipEEPROMwithlargecapacitycanberepeatedlyerasedmorethan100thousandtimes.
DualDataPointer(DPTR)tospeedupdatamovement
ISP/IAP,In-System-ProgrammingandIn-Application-Programming,noneedforprogrammerandemulator.
8channelsand10bitsAnalog-to-DigitalConverter(ADC),thespeedupto300thousandtimespersecond,3channelsPWMalsocanbeusedas3channelsD/AConverter(DAC).
6channels15bitshigh-precisionPWM(withadead-sectioncontroller)and2channelsCCP(Thehigh-speedpulsefunctionofwhichcanbeutilizedtorealize11~16bitsPWM)----canbeusedas8channelsD/AConverteror2Timesor2externalInterrupts(whichcanbegeneratedon
risingorfallingedge).
InternalhghlyreliableResetwith16levelsoptionalthresholdvoltageofreset,sothatexternalresetcurcuitcanbecompletelyremoved.
-
STC MC
U Limite
d.
13
STC15W4K32S4seriesMCUManual STCthebiggestdesigncompanyof8051MCUintheworld
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/2966 Fax:0513-55012969/2956/2947
QQofR&D:800003751www.STCMCU.com
Internalhigh-preciseR/Cclock(0.3%)with1%temperaturedrift(-40 ~+85 )while0.6%(-20~+65 )innormaltemperatureandwidefrenquencyadjustablebetween5MHzand35MHz(5.5296MHz/11.0592MHz/22.1184MHz/33.1776MHz).
Operatingfrequencyrange:5-35MHz,isequivalenttotraditional8051:60~420MHz.
Fourhigh-speedasynchronous serial ports----UARTs (UART1/UART2/UART3/UART4can beusedsimultaneouslyandregardedas9serialportsbyshiftingamong9groupsofpins):
UART1(RxD/P3.0,TxD/P3.1)canbeswitchedto(RxD_2/P3.6,TxD_2/P3.7), alsocanbeswitchedto(RxD_3/P1.6,TxD_3/P1.7);UART2(RxD2/P1.0,TxD2/P1.1)canbeswitchedto(RxD2_2/P4.6,TxD2_2/P4.7);UART3(RxD3/P0.0,TxD3/P0.1)canbeswitchedto(RxD3_2/P5.0,TxD3_2/P5.1)UART4(RxD4/P0.2,TxD4/P0.3)canbeswitchedto(RxD4_2/P5.2,TxD4_2/P5.3)
Ahigh-speedsynchronousserialperipheralinterface----SPI.
SupportthefunctionofEncryptionDownload(toprotectyourcodefrombeingintercepted).
SupportthefunctionofRS485Control
Codeprotectionforflashmemoryaccess,excellentnoiseimmunity,verylowpowerconsumption
Powermanagementmode:Slow-Downmode,Idlemode(all interruptcanwakeupIdlemode),Stop/Power-Downmode.
Timerswhichcanwakeupstop/power-downmode:haveinternallow-powerspecialwake-upTimer.
Resourcewhichcanwakeupstop/power-downmodeare: INT0/P3.2, INT1/P3.3 (INT0/INT1,maybegeneratedonboth risingand fallingedges),INT2/P3.6, INT3/P3.7, INT4/P3.0 ( INT2/INT3/INT4, only be generated on fallingedge); pinsCCP0/CCP1; pinsRxD/RxD2/RxD3/RxD4; pinsT0/T1/T2/T3/T4(theirfallingedgecanwakeup ifT0/T1/T2/T3/T4havebeenenabledbeforepower-downmode,butno interruptscanbegeneratetd); internallow-powerspecialwake-upTimer.
7Timers/Counters:five16-bitreloadableTimers/Counters(T0/T1/T2/T3/T4,T0andT1arecompatiblewithTimer0/Timer1oftraditional8051)and2Timerswhichmayberealizedby2channelsCCP.T0/T1/T2/T3/T4allcanindependentlyachieveexternalprogrammableclockoutput(5channels).
Programmableclockoutputfunction(outputbydividingthefrequencyof the internalsystemclockor theinputclockofexternalpin):
TheProgrammableclockoutputofT0isonP3.5/T0CLKO(outputbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT0/P3.4)
TheProgrammableclockoutputofT1isonP3.4/T1CLKO(outputbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT1/P3.5)
TheProgrammableclockoutputofT2isonP3.0/T2CLKO(outputbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT2/P3.1)
TheProgrammableclockoutputofT3isonP0.4/T3CLKO(outputbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT3/P0.5)
-
STC MC
U Limite
d.
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/296614
STC15W4K32S4seriesMCUManual www.GXWMCU.com TemporaryTechnicalAdviser:(86)13922829991 TelofR&DAdviser:(86)13922805190
Fax:0513-55012969/2956/2947
TheProgrammableclockoutputofT4isonP0.6/T4CLKO(outputbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT4/P0.7)Fivetimers/countersinaboveallcanbeoutputbydividingthefrequencyfrom1to65536.
TheProgrammableclockoutputofmasterclockisonP5.4/MCLKO,anditsfrequencycanbedividedintoMCLK/1, MCLK/2, MCLK/4, MCLK/16./1, MCLK/2, MCLK/4, MCLK/16.,MCLK/2,MCLK/4,MCLK/16.
Themasterclockcaneitherbe internalR/Cclockor theexternal inputclockor theexternalcrystaloscillator.
MCLKisthefrequencyofmasterclock.MCLKOistheoutputofmasterclock.Comparator,whichcanbeusedas1channelADCorbrownoutdetectfunctionandsupportcomparingbyexternalpinCMP+andCMP-orinternalreferencevoltageandgeneratingoutputsignal(itspolaritycanbeconfigured)onCMPOpin.
One15bitsWatch-Dog-Timerwith8-bitpre-scaler(one-time-enabled)
advancedinstructionset,whichisfullycompatiblewithtraditional8051MCU,havehardwaremultiplication/divisioncommand.
62/46/42/38/30/26commonI/Oportsareavailable,theirmodeisquasi_bidirectional/weakpull-up(traditional8051I/Oportsmode)afterreset,andcanbesettofourmodes:quasi_bidirectional/weakpull-up,strongpush-pull/strongpull-up,input-only/high-impedanceandopendrain.
thedrivingabilityofeachI/Oportcanbeupto20mA,but itdontexceedthismaximum120mAthat thecurrentofthewholechipof40-pinormorethan40-pinMCU,while90mAthatthecurrentofthewholechipof16-pinormorethan16-pinMCUor32-pinorlessthan32-pinMCU.
IfI/Oportsarenotenough,itcanbeextendedbyconnectinga74HC595(referenceprice:RMB0.21yuan).Besides,cascadingseveralchipsalsocanextendtodozensofI/Oports.
Package:LQFP64L(16mmx16mm),LQFP64S(12mmx12mm),LQFP48(9mmx9mm),LQFP44(12mmx12mm),LQFP32(9mmx9mm),SOP28,SKDIP28,PDIP40.
Allproductsarebaked8hoursinhigh-temperature175 afterbepackaged,Manufactureguaranteegoodquality.
InKeilCdevelopmentenvironment,selecttheIntel8052tocompilingandonlycontainasheaderfile.
-
STC MC
U Limite
d.
15
STC15W4K32S4seriesMCUManual STCthebiggestdesigncompanyof8051MCUintheworld
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/2966 Fax:0513-55012969/2956/2947
QQofR&D:800003751www.STCMCU.com
1.2 Block diagram of STC15W4K32S4 series MCUTheinternalstructureofSTC15W4K32S4seriesMCUisshownintheblockdiagrambelow.STC15W4K32S4seriesMCUincludescentralprocessorunit(CPU),programmemory(Flash),datamemory(SRAM),Timers/Counters, I/Oports,high-speedA/Dconverter(ADC),Comparator,Watchdog,high-speedasynchronousserialcommunicationports---UART(UART1/UART2/UART3/UART4),CCP/PWM/PCA,agroupofhigh-speedsynchronousserialperipheralinterface(SPI),internalhigh-preciseR/Cclock,internalhghlyreliableResetandsoon.STC15W4K32S4seriesMCUalmostincludesallofthemodulesrequiredindataacquisitionandcontrol,socanberegardedasanon-chipsystem(SysTemChiporSysTemonChip,abbreviatedasSTC,thisisthenameoriginofHongjingtechnologySTCLimited).
STC15W4K32S4seriesBlockDiagram
RAM256Bytes
RAMADDRRegister
ProgramMemory(Flash)8~63.5K
ProgramCounter(PC)
CCP/PCA/PWM
SPI
BRegister
ACC
TMP2 TMP1
StackPointer
ALU
PSW WDT
ControlUnit
XTAL2XTAL1
AUX-RAM3840Bytes
ISP/IAP
AddressGenerator
Timer/Counter0/1
EnhancedUART1
Port0,2,3,4,5,6,7Latch
Port0,2,3,4,5,6,7Driver
P0,P2,P3,P4,P5,P6,P7
Port1Latch
Port1Driver
P1.0~P1.7
ADC
P1.0~P1.7
8
Timer/Counter2
Power-DownWake-upSpecialTimer
InternalhghlyreliableReset(16levelsoptionalthreshold
voltageofreset)
Timer/Counter3/4
UART2(S2)
UART3(S3)
UART4(S4)Comparator
Internalhigh-preciseR/Cclock(0.3%)1%temperaturedrift(-40 ~+85 )while0.6%innormaltemperature(-20 ~+65 )
-
STC MC
U Limite
d.
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/296616
STC15W4K32S4seriesMCUManual www.GXWMCU.com TemporaryTechnicalAdviser:(86)13922829991 TelofR&DAdviser:(86)13922805190
Fax:0513-55012969/2956/2947
1.3 Pin Configurations of STC15W4K32S4 series MCUAllpackagesmeetEURoHSstandards
CCPisabbreviationforCapture,Compare,PWM
Note P0portscanbemultiplexedasAddress/Databus notasA/DConverter.8channelsofA/DConverterareonP1.
Consequently P0.x/ADxmeansthatP0.xcanbeusedasAddress/Databus,whileP1.x/ADCxmeansP1.xcanbeusedasA/Dconversionchannelinthepinmap.
T0CLKOreferstotheprogrammableclockoutputofTimer/Counter0(outputbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT0/P3.4);
T1CLKOreferstotheprogrammableclockoutputofTimer/Counter1(outputbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT1/P3.5);
T2CLKOreferstotheprogrammableclockoutputofTimer/Counter2(outputbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT2/P3.1);
T3CLKOreferstotheprogrammableclockoutputofTimer/Counter3(outputbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT3/P0.5);
T4CLKOreferstotheprogrammableclockoutputofTimer/Counter4(outputbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT4/P0.7).
Inadditiontoprogrammableoutputontheinternalsystemclock,T0CLKO/T1CLKO/T2CLKO/T3CLKO/T4CLKOalsocanbeusedasdividerbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT0/T1/T2/T3/T4.
MCLKOistheoutputofmasterclockwhosefrequencycanbedividedintoMCLK/1,/1,,MCLK/2,MCLK/4,MCLK/16ThemasterclockcaneitherbeinternalR/Cclockortheexternalinputclockortheexternalcrystaloscillator.MCLKisthefrequencyofmasterclock.
RecommendUART1on[P3.6/RxD_2,P3.7/TxD_2]or[P1.6/RxD_3/XTAL2,P1.7/TxD_3/XTAL1]
33 32 31 30 29 28 27 26 25 24 23
1 2 3 4 5 6 7 8 9 10 11
RxD
2/C
CP1
/AD
C0/
P1.0
CM
PO/E
CI/S
S/A
DC
2/P1
.2
TxD
2/C
CP0
/AD
C1/
P1.1
MO
SI/A
DC
3/P1
.3M
ISO
/AD
C4/
P1.4
SCLK
/AD
C5/
P1.5
PWM
6/M
CLK
O_2
/XTA
L2/R
xD_3
/AD
C6/
P1.6
P4.1
/MIS
O_3
PWM3_2/ALE/P4.5
VccP5.5/CMP+Gnd
P1.7/ADC7/TxD_3/XTAL1/PWM7P5.4/RST/MCLKO/SS_3/CMP-
P2.3
/A11
/MO
SI_2
/PW
M5
P2.2
/A10
/MIS
O_2
/PW
M4
P2.1
/A9/
SCLK
_2/P
WM
3
P4.3
/SC
LK_3
P3.5
/T1/
T0C
LKO
/CC
P0_2
P2.0
/A8/
RST
OU
T_LO
W
PWM
FLT_
2/T3
/AD
5/P0
.5PW
M7_
2/T4
CLK
O/A
D6/
P0.6
PWM
6_2/
T4/A
D7/
P0.7
TxD
2_2/
P4.7
T3CLKO/AD4/P0.4TxD4/AD3/P0.3RxD4/AD2/P0.2TxD3/AD1/P0.1RxD3/AD0/P0.0
PWM2_2/A15/P2.7CCP1_3/A14/P2.6CCP0_3/A13/P2.5
PWMFLT/SS_2/ECI_3/A12/P2.4
RxD2_2/P4.6 P4.0/MOSI_3
P3.1/TxD/T2P3.2/INT0P3.3/INT1P3.4/T0/T1CLKO/ECI_2
LQFP4442 I/O ports
3435363738394041424344
2221201918171615141312
1234567891011121314151617181920
4039383736353433323130292827262524232221
P4.5/ALE/PWM3_2
P4.1/MISO_3
RxD2/CCP1/ADC0/P1.0
CMPO/ECI/SS/ADC2/P1.2
VccCMP+/P5.5
Gnd
PWM7/XTAL1/TxD_3/ADC7/P1.7CMP-/SS_3/MCLKO/RST/P5.4
TxD2/CCP0/ADC1/P1.1
SCLK/ADC5/P1.5PWM6/MCLKO_2/XTAL2/RxD_3/ADC6/P1.6
MISO/ADC4/P1.4MOSI/ADC3/P1.3
P2.7/A15/PWM2_2P2.6/A14/CCP1_3P2.5/A13/CCP0_3P2.4/A12/ECI_3/SS_2/PWMFLTP2.3/A11/MOSI_2/PWM5P2.2/A10/MISO_2/PWM4P2.1/A9/SCLK_2/PWM3P2.0/A8/RSTOUT_LOW
P3.4/T0/T1CLKO/ECI_2P3.3/INT1P3.2/INT0P3.1/TxD/T2
RxD3/AD0/P0.0TxD3/AD1/P0.1RxD4/AD2/P0.2TxD4/AD3/P0.3
T3CLKO/AD4/P0.4PWMFLT_2/T3/AD5/P0.5
PWM7_2/T4CLKO/AD6/P0.6PWM6_2/T4/AD7/P0.7
PDIP40 38 I/O
ports
P3.0/RxD/INT4/T2CLKO
P4.2
/WR
/PW
M5_
2
P4.4
/RD
/PW
M4_
2
P3.6
/INT2
/RxD
_2/C
CP1
_2P3
.7/IN
T3/T
xD_2
/PW
M2
P4.2/WR/PWM5_2P4.4/RD/PWM4_2
P3.5/T1/T0CLKO/CCP0_2P3.6/INT2/RxD_2/CCP1_2P3.7/INT3/TxD_2/PWM2
P3.0/RxD/INT4/T2CLKO
P5.1
/TxD
3_2
P1.7/ADC7/TxD_3/XTAL1/PWM7P5.4/RST/MCLKO/SS_3/CMP-
PWM
6//X
TAL2
/RxD
_3/A
DC
6/P1
.6SC
LK/A
DC
5/P1
.5M
ISO
/AD
C4/
P1.4
MO
SI/A
DC
3/P1
.3C
MPO
/EC
I/SS/
AD
C2/
P1.2
TxD
2_2/
P4.7
TxD
2/C
CP0
/AD
C1/
P1.1
RxD
2/C
CP1
/AD
C0/
P1.0
PWM
6_2/
T4/A
D7/
P0.7
PWM
7_2/
T4C
LKO
/AD
6/P0
.6PW
MFL
T_2/
T3/A
D5/
P0.5
TxD
4_2/
P5.3
P5.0/RxD3_2
1 2 3 4 5 6 7 8 9 10 11 12
36 35 34 33 32 31 30 29 28 27 26 25
LQFP4846 I/O ports
373839404142434445464748
242322212019181716151413
VccP5.5/CMP+GndP4.0//MOSI_3
P3.1/TxD/T2P3.2/INT0P3.3/INT1P3.4/T0/T1CLKO/ECI_2
P3.0/RxD/INT4/T2CLKO
P4.1
/MIS
O_3
P2.3
/A11
/MO
SI_2
/PW
M5
P2.2
/A10
/MIS
O_2
/PW
M4
P2.1
/A9/
SCLK
_2/P
WM
3
P4.3
/SC
LK_3
P3.5
/T1/
T0C
LKO
/CC
P0_2
P2.0
/A8/
RST
OU
T_LO
W
P4.2
/WR
/PW
M5_
2
P4.4
/RD
/PW
M4_
2
P3.6
/INT2
/RxD
_2/C
CP1
_2P3
.7/IN
T3/T
xD_2
/PW
M2
PWM3_2/ALE/P4.5
T3CLKO/AD4/P0.4TxD4/AD3/P0.3RxD4/AD2/P0.2TxD3/AD1/P0.1RxD3/AD0/P0.0
PWM2_2/A15/P2.7CCP1_3/A14/P2.6CCP0_3/A13/P2.5
PWMFLT/SS_2/ECI_3/A12/P2.4
RxD2_2/P4.6
RxD4_2/P5.2
LQFP44(12x12mm)
LQFP48(9x9mm)
Thespeedofexternalprogrammableclockoutputof5VMCUisalsonotmorethan13.5MHz,becausetheoutputspeedofI/OportofSTC15series5VMCUisnotmorethan13.5MHz.Thespeedofexternalprogrammableclockoutputof3.3VMCUisalsonotmorethan8MHz,becausetheoutputspeedofI/OportofSTC15series3.3VMCUisnotmorethan8MHz.
-
STC MC
U Limite
d.
17
STC15W4K32S4seriesMCUManual STCthebiggestdesigncompanyof8051MCUintheworld
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/2966 Fax:0513-55012969/2956/2947
QQofR&D:800003751www.STCMCU.com
LQFP3230 I/O ports
24 23 22 21 20 19 18 17
1 2 3 4 5 6 7 8
161514131211109
2526272829303132
PWM
7/X
TAL1
/TxD
_3/A
DC
7/P1
.7
RxD
2/C
CP1
/AD
C0/
P1.0
CM
PO/E
CI/S
S/A
DC
2/P1
.2Tx
D2/
CC
P0/A
DC
1/P1
.1
MO
SI/A
DC
3/P1
.3M
ISO
/AD
C4/
P1.4
SCLK
/AD
C5/
P1.5
PWM
6/M
CLK
O_2
/XTA
L2/R
xD_3
/AD
C6/
P1.6
VccP5.5/CMP+Gnd
P5.4/RST/MCLKO/CMP-
P3.1/TxD/T2P3.2/INT0P3.3/INT1
P3.4
/T0/
T1C
LKO
/EC
I_2
P3.0/RxD/INT4/T2CLKO
P2.3
/MO
SI_2
/PW
M5
P2.2
/MIS
O_2
/PW
M4
P2.1
/SC
LK_2
/PW
M3
P3.5
/T1/
T0C
LKO
/CC
P0_2
P2.0
/RST
OU
T_LO
W
P3.6
/INT2
/ RxD
_2/C
CP1
_2P3
.7/IN
T3/ T
xD_2
/PW
M2
RxD4/P0.2TxD3/P0.1RxD3/P0.0
P2.7CCP1_3/P2.6CCP0_3/P2.5
PWMFLT/SS_2/ECI_3/P2.4
TxD4/P0.3
28
27
26
25
24
23
22
21
20
19
18
17
16
15
CCP1_3/P2.6
P2.7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
26 I/O ports
SOP28/SK
DIP28
RxD2/CCP1/ADC0/P1.0
CMPO/ECI/SS/ADC2/P1.2
Vcc
CMP+/P5.5
Gnd
PWM7/XTAL1/TxD_3/ADC7/P1.7
CMP-/MCLKO/RST/P5.4
TxD2/CCP0/ADC1/P1.1
SCLK/ADC5/P1.5
PWM6/MCLKO_2/XTAL2/RxD_3/ADC6/P1.6
MISO/ADC4/P1.4MOSI/ADC3/P1.3
P2.5/CCP0_3
P2.4/ECI_3/SS_2/PWMFLT
P2.3/MOSI_2/PWM5
P2.2/MISO_2/PWM4
P2.1/SCLK_2/PWM3
P2.0/RSTOUT_LOW
P3.4/T0/T1CLKO/ECI_2
P3.3/INT1
P3.2/INT0P3.1/TxD/T2
P3.5/T1/T0CLKO/CCP0_2
P3.6/INT2/RxD_2/CCP1_2P3.7/INT3/TxD_2/PWM2
P3.0/RxD/INT4/T2CLKO
LQFP32(9x9mm)P5
.1/T
xD3_
2
P1.7/ADC7/TxD_3/XTAL1/PWM7P5.4/RST/MCLKO/SS_3/CMP-
PWM
6/M
CLK
O_2
/XTA
L2/R
xD_3
/AD
C6/
P1.6
SCLK
/AD
C5/
P1.5
MIS
O/A
DC
4/P1
.4M
OSI
/AD
C3/
P1.3
CM
PO/E
CI/S
S/A
DC
2/P1
.2Tx
D2_
2/P4
.7Tx
D2/
CC
P0/A
DC
1/P1
.1R
xD2/
CC
P1/A
DC
0/P1
.0
PWM
6_2/
T4/A
D7/
P0.7
PWM
7_2/
T4C
LKO
/AD
6/P0
.6PW
MFL
T_2/
T3/A
D5/
P0.5
TxD
4_2/
P5.3
P5.0/RxD3_2
VccP5.5/CMP+GndP4.0//MOSI_3
P3.1/TxD/T2P3.2/INT0P3.3/INT1P3.4/T0/T1CLKO/ECI_2
P3.0/RxD/INT4/T2CLKO
P4.1
/MIS
O_3
P2.3
/A11
/MO
SI_2
/PW
M5
P2.2
/A10
/MIS
O_2
/PW
M4
P2.1
/A9/
SCLK
_2/P
WM
3
P4.3
/SC
LK_3
P3.5
/T1/
T0C
LKO
/CC
P0_2
P2.0
/A8/
RST
OU
T_LO
W
P4.2
/WR
/PW
M5_
2
P4.4
/RD
/PW
M4_
2
P3.6
/INT2
/RxD
_2/C
CP1
_2P3
.7/IN
T3/T
xD_2
/PW
M2
PWM3_2/ALE/P4.5
T3CLKO/AD4/P0.4TxD4/AD3/P0.3RxD4/AD2/P0.2TxD3/AD1/P0.1RxD3/AD0/P0.0
PWM2_2/A15/P2.7CCP1_3/A14/P2.6CCP0_3/A13/P2.5
PWMFLT/SS_2/ECI_3/A12/P2.4
RxD2_2/P4.6
RxD4_2/P5.2
32313029282726252423222120191817
49505152535455565758596061626364
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33
P6.0
P6.1
P6.2
P6.3
P6.4P6.5P6.6P6.7
P7.3
P7.2
P7.1
P7.0
P7.4P7.5P7.6P7.7
LQFP64LLQFP64S62 I/O ports
LQFP64L(16x16mm)LQFP64S(12x12mm)
AllpackagesmeetEURoHSstandardsCCPisabbreviationforCapture,Compare,PWM
T0CLKOreferstotheprogrammableclockoutputofTimer/Counter0(outputbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT0/P3.4);
T1CLKOreferstotheprogrammableclockoutputofTimer/Counter1(outputbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT1/P3.5);
T2CLKOreferstotheprogrammableclockoutputofTimer/Counter2(outputbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT2/P3.1);
T3CLKOreferstotheprogrammableclockoutputofTimer/Counter3(outputbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT3/P0.5);
T4CLKOreferstotheprogrammableclockoutputofTimer/Counter4(outputbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT4/P0.7).
Inadditiontoprogrammableoutputontheinternalsystemclock,T0CLKO/T1CLKO/T2CLKO/T3CLKO/T4CLKOalsocanbeusedasdividerbydividingthefrequencyoftheinternalsystemclockortheinputclockofexternalpinT0/T1/T2/T3/T4.
Thespeedofexternalprogrammableclockoutputof5VMCUisalsonotmorethan13.5MHz,becausetheoutputspeedofI/OportofSTC15series5VMCUisnotmorethan13.5MHz.Thespeedofexternalprogrammableclockoutputof3.3VMCUisalsonotmorethan8MHz,becausetheoutputspeedofI/OportofSTC15series3.3VMCUisnotmorethan8MHz.
RecommendUART1on[P3.6/RxD_2,P3.7/TxD_2]or[P1.6/RxD_3/XTAL2,P1.7/TxD_3/XTAL1]
MCLKOistheoutputofmasterclockwhosefrequencycanbedividedintoMCLK/1, MCLK/2,/1, MCLK/2,,MCLK/2,MCLK/4,MCLK/16ThemasterclockcaneitherbeinternalR/Cclockortheexternalinputclockortheexternalcrystaloscillator.MCLKisthefrequencyofmasterclock.
8channelsofA/DConverterareonP1.
P1.x/ADCxmeansP1.xcanbeusedasA/Dconversionchannelinthepinmap.
-
STC MC
U Limite
d.
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/296618
STC15W4K32S4seriesMCUManual www.GXWMCU.com TemporaryTechnicalAdviser:(86)13922829991 TelofR&DAdviser:(86)13922805190
Fax:0513-55012969/2956/2947
Mnemonic Add Name 7 6 5 4 3 2 1 0 ResetValueAUXR1P_SW1 A2H Auxiliaryregister1 S1_S1 S1_S0 CCP_S1 CCP_S0 SPI_S1 SPI_S0 0 DPS
00000000
P_SW2 BAH Peripheralfunctionswitch PWM67_S PWM2345_S S4_S S3_S S2_Sxxxxx000
CLK_DIV(PCON2) 97H ClockDivisionregister MCKO_S1MCKO_S0 ADRJ Tx_Rx MCLKO_2 CLKS2 CLKS1 CLKS0
00000000
INT_CLKO(AUXR2) 8FH
ExternalInterruptenableandClockoutputregister - EX4 EX3 EX2 MCKO_S2 T2CLKO T1CLKO T0CLKO
x0000000
UART1/S1 can be switched in 3 groups of pins by selecting the control bits S1_S0 and S1_S1.S1canbeswitchedin3 groups of pins by selecting the control bits S1_S0 and S1_S1.3groupsofpinsbyselectingthecontrolbitsS1_S0andS1_S1.S1_S1 S1_S0 UART1/S1canbeswitchedbetweenP1andP3
0 0 UART1/S1on[P3.0/RxD,P3.1/TxD]0 1 UART1/S1on[P3.6/RxD_2,P3.7/TxD_2]
1 0 UART1/S1on[P1.6/RxD_3/XTAL2,P1.7/TxD_3/XTAL1]whenUART1isonP1,pleaseusinginternalR/Cclock.1 1 Invalid
RecommedUART1on[P3.6/RxD_2,P3.7/TxD_2]or[P1.6/RxD_3/XTAL2,P1.7/TxD_3/XTAL1].
UART2/S2 can be switched in 2 groups of pins by selecting the control bit S2_S.S2canbeswitchedin2 groups of pins by selecting the control bit S2_S.2groupsofpinsbyselectingthecontrolbitS2_S.S2_S UART2/S2canbeswitchedbetweenP1andP4
0 UART2/S2on[P1.0/RxD2,P1.1/TxD2]1 UART2/S2on[P4.6/RxD2_2,P4.7/TxD2_2]
UART3/S3 can be switched in 2 groups of pins by selecting the control bit S3_S.S3canbeswitchedin2 groups of pins by selecting the control bit S3_S.2groupsofpinsbyselectingthecontrolbitS3_S.S3_S UART3/S3canbeswitchedbetweenP0andP5
0 UART3/S3on[P0.0/RxD3,P0.1/TxD3]1 UART3/S3on[P5.0/RxD3_2,P5.1/TxD3_2]
UART4/S4 can be switched in 2 groups of pins by selecting the control bit S4_S.S4canbeswitchedin2 groups of pins by selecting the control bit S4_S.2groupsofpinsbyselectingthecontrolbitS4_S.S4_S UART4/S4canbeswitchedbetweenP0andP5
0 UART4/S4on[P0.2/RxD4,P0.3/TxD4]1 UART4/S4on[P5.2/RxD4_2,P5.3/TxD4_2]
SPIcanbeswitchedin3 groups of pins by selecting the control bits SPI_S1 and SPI_S03groupsofpinsbyselectingthecontrolbitsSPI_S1andSPI_S0SPI_S1 SPI_S0 SPIcanbeswitchedinP1andP2andP4
0 0 SPIon[P1.2/SS,P1.3/MOSI,P1.4/MISO,P1.5/SCLK]0 1 SPIon[P2.4/SS_2,P2.3/MOSI_2,P2.2/MISO_2,P2.1/SCLK_2]1 0 SPIon[P5.4/SS_3,P4.0/MOSI_3,P4.1/MISO_3,P4.3/SCLK_3]1 1 Invalid
-
STC MC
U Limite
d.
19
STC15W4K32S4seriesMCUManual STCthebiggestdesigncompanyof8051MCUintheworld
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/2966 Fax:0513-55012969/2956/2947
QQofR&D:800003751www.STCMCU.com
Mnemonic Add Name 7 6 5 4 3 2 1 0 ResetValueAUXR1P_SW1 A2H
Auxiliaryregister1 S1_S1 S1_S0 CCP_S1 CCP_S0 SPI_S1 SPI_S0 0 DPS
00000000
P_SW2 BAH Peripheralfunctionswitch PWM67_S PWM2345_S S4_S S3_S S2_Sxxxxx000
CLK_DIV(PCON2) 97H
ClockDivisionregister MCKO_S1MCKO_S0 ADRJ Tx_Rx MCLKO_2 CLKS2 CLKS1 CLKS0
00000000
CCPcanbeswitchedin3 groups of pins by selecting the control bits CCP_S1 and CCP_S0.3groupsofpinsbyselectingthecontrolbitsCCP_S1andCCP_S0.CCP_S1 CCP_S0 CCPcanbeswitchedinP1andP2andP3
0 0 CCPon[P1.2/ECI,P1.1/CCP0,P1.0/CCP1]0 1 CCPon[P3.4/ECI_2,P3.5/CCP0_2,P3.6/CCP1_2]1 0 CCPon[P2.4/ECI_3,P2.5/CCP0_3,P2.6/CCP1_3]1 1 Invalid
PWM2/PWM3/PWM4/PWM5/PWMFLT can be switched in 2 groups of pins by selecting the control bitcanbeswitched in2 groups of pins by selecting the control bit2groupsofpinsbyselecting thecontrolbitPWM2345_S.
PWM2345_S PWM2/PWM3/PWM4/PWM5/PWMFLTcanbeswitchedbetweenP2,P3,andP40 PWM2/PWM3/PWM4/PWM5/PWMFLTon[P3.7/PWM2,P2.1/PWM3,P2.2/PWM4,
P2.3/PWM5,P2.4/PWMFLT]1 PWM2/PWM3/PWM4/PWM5/PWMFLTon[P2.7/PWM2_2,P4.5/PWM3_2,P4.4/
PWM4_2,P4.2/PWM5_2,P0.5/PWMFLT_2]
PWM6/PWM7 can be switched in 2 groups of pins by selecting the control bit PWM67_S.canbeswitchedin2 groups of pins by selecting the control bit PWM67_S.2groupsofpinsbyselectingthecontrolbitPWM67_S.PWM67_S PWM2/PWM3/PWM4/PWM5/PWMFLT can be switched between P0 and P1can be switched between P0 and P1canbeswitchedbetweenP0andP1
0 PWM6/PWM7on[P1.6/PWM6,P1.7/PWM7]1 PWM6/PWM7on[P0.7/PWM6_2,P0.6/PWM7_2]
DPS DPTRregistersselectbit.0 DPTR0isselected1 DPTR1isselected
ADRJ theadjustmentbitofADCresult0 ADC_RES[7:0]storehigh8-bitADCresult ADC_RESL[1:0]storelow2-bitADCresult1 ADC_RES[1:0]storehigh2-bitADCresult ADC_RESL[7:0]storelow8-bitADCresult
Tx_Rx thesetbitofrelayandbroadcastmodeofUART10 UART1worksonnormalmode1 UART1worksonrelayandbroadcastmode thattosayoutputtheinputlevelstateofRxDporttotheoutside
TxDpininrealtime,namelytheexternaloutputofTxDpincanreflecttheinputlevelstateofRxDport.
theRxDandTxDofUART1canbeswitchedin3groupsofpins:[RxD/P3.0,TxD/P3.1]; [RxD_2/P3.6,TxD_2/P3.7]; [RxD_3/P1.6,TxD_3/P1.7].
-
STC MC
U Limite
d.
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/296620
STC15W4K32S4seriesMCUManual www.GXWMCU.com TemporaryTechnicalAdviser:(86)13922829991 TelofR&DAdviser:(86)13922805190
Fax:0513-55012969/2956/2947
CLKS2 CLKS1 CLKS0thecontrolbitofsystemclock
(Systemclockreferstothemasterclockthathasbeendividedfrequency,whichisofferedtoCPU,UARTs,SPI,Timers,CCP/PWM/PCAandA/DConverter)
0 0 0 Masterclockfrequency/1,Nodivision0 0 1 Masterclockfrequency/20 1 0 Masterclockfrequency/40 1 1 Masterclockfrequency/81 0 0 Masterclockfrequency/161 0 1 Masterclockfrequency/321 1 0 Masterclockfrequency/641 1 1 Masterclockfrequency/128
ThemasterclockcaneitherbeinternalR/Cclockortheexternalinputclockortheexternalcrystaloscillator.
MCKO_S2 MCKO_S1 MCKO_S0thecontrolbitofmasterclockoutputbydividingthefrequency
(ThemasterclockcaneitherbeinternalR/Cclockortheexternalinputclockortheexternalcrystaloscillator)
0 0 0 Masterclockdonotoutputexternalclock
0 0 1Masterclockoutputexternalclock butitsfrequencydonotbedividedandtheoutputclockfrequency=MCLK/1
0 1 0Masterclockoutputexternalclock butitsfrequencyisdividedby2 andtheoutputclockfrequency=MCLK/2
0 1 1Masterclockoutputexternalclock butitsfrequencyisdividedby4 andtheoutputclockfrequency=MCLK/4
1 0 0Masterclockoutputexternalclock butitsfrequencyisdividedby4 andtheoutputclockfrequency=MCLK/16
ThemasterclockcaneitherbeinternalR/Cclockortheexternalinputclockortheexternalcrystaloscillator.MCLKisthefrequencyofmasterclock.STC15W4K32S4seriesMCUoutputmasterclockonMCLKO/P5.4
MCLKO_2 toselectMasterClockoutputonwhere0 MasterClockoutputonMCLKO/P5.41 MasterClockoutputonMCLKO_2/XTAL2/P1.6ThemasterclockcaneitherbeinternalR/Cclockortheexternalinputclockortheexternalcrystaloscillator.
Mnemonic Add Name 7 6 5 4 3 2 1 0 ResetValueCLK_DIV(PCON2) 97H ClockDivisionregister MCKO_S1MCKO_S0 ADRJ Tx_Rx MCLKO_2 CLKS2 CLKS1 CLKS0
00000000
INT_CLKO(AUXR2) 8FH
ExternalInterruptenableandClockoutputregister - EX4 EX3 EX2 MCKO_S2 T2CLKO T1CLKO T0CLKO
x0000000
-
STC MC
U Limite
d.
21
STC15W4K32S4seriesMCUManual STCthebiggestdesigncompanyof8051MCUintheworld
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/2966 Fax:0513-55012969/2956/2947
QQofR&D:800003751www.STCMCU.com
Conclusion:STC15W4K32S4seriesMCUhave:Five16-bitrelaodableTimers/CountersthatareTimer/Counter0,Timer/Counter1,Timer/Counter2,Timer/Counter3andTimer/Counter4;8channelsand10bitsPWM(canachieve8D/Aconvertersor2timersor2externalinterruptsagain);specialpower-downwake-uptimer;5externalinterruptsINT0/INT1/INT2/INT3/INT4;4high-speedasynchronousserialports----UARTs(UART1/UART2/UART3/UART4canbeusedsimultaneously);ahigh-speedsynchronousserialperipheralinterface----SPI;8channelsand10bitshigh-speedA/Dconverter;agroupofComparator,2datapointers----DPTR;externaldatabusandsoon.
ToprovidecustomizedICservices
Ifuserwantstouse40-pinandaboveMCU,LQFP-44issuggested,whilePDIP-40isstillsuppliednormal;ifuserwantstousethe32-pinMCU,LQFP-32isrecommeded;ifuserwantstousethe28-pinMCU,SOP-28isrecommended.
Becausethelast7bytesoftheprogramareaisstoredmandatorilythecontentsofonlyglobalID,theprogramspacetheusercanactuallyuseis7bytessmallerthanthespaceshownintheselectiontable.
1.4 STC15W4K32S4 series Selection and Price Table
Type1T8051MCU
OperatingVoltage
(V)
Flash(byte)
SRAM(byte)
UART
SPI
commonTimersT0-T4
8channelsPWM Speical
Power-downWake-
upTimer
StandardExternalInterrupts
A/D8-channel
COMPARATOR
DPTR
EEPROM
InternalLow-
VoltageDetectionInterrupt
WDT
InternalHigh-
reliableReset(with
optionalthresholdvoltage)
InternalHigh-PreciseClock
OutputclockandresetsignalfromMCU
EncryptionDownload(toprotectyourcodefrombeingintercepted)
RS485Control
AllPackagesLQFP64/LQFP48/LQFP44/PDIP40LQFP32/SOP28/
SKDIP2815-bitspecialPWM(withadead-
sectioncontroller)
10-bitCCP
Priceofapartofpackages(RMB)
PDIP40
LQFP44
LQFP48
LQFP64S
STC15W4K32S4seriesMCUSelectionandPriceTableNote:8channelsPWMcanbeusedas8channelsDAC,2channelsCCPcanbeusedas2Timersor2externalinterrupts.
STC15W4K16S4 5.5-2.5 16K 4K 4 Y 5 6-ch 2-ch Y 5 10bits Y 2 45K Y Y 16-level Y Y Y Y 5.7 5.2 5.2 5.4STC15W4K32S4 5.5-2.5 32K 4K 4 Y 5 6-ch 2-ch Y 5 10bits Y 2 29K Y Y 16-level Y Y Y Y 5.9 5.5 5.5 5.7STC15W4K40S4 5.5-2.5 40K 4K 4 Y 5 6-ch 2-ch Y 5 10bits Y 2 21K Y Y 16-level Y Y Y Y 5.9 5.6 5.6 5.8STC15W4K48S4 5.5-2.5 48K 4K 4 Y 5 6-ch 2-ch Y 5 10bits Y 2 13K Y Y 16-level Y Y Y Y 5.9 5.6 5.6 5.8STC15W4K56S4 5.5-2.5 56K 4K 4 Y 5 6-ch 2-ch Y 5 10bits Y 2 5K Y Y 16-level Y Y Y Y 5.9 5.6 5.6 5.8
IAP15W4K58S4(whichitselfisaemluator)
5.5-2.5 58K 4K 4 Y 5 6-ch 2-ch Y 5 10bits Y 2 IAP Y Y 16-level Y Y Y Y
5.9 5.6 5.6 5.8TheprogramFlashinuserprogramareacanbeusedasEEPROM.
IAP15W4K61S4(whichitselfisaemluator)
5.5-2.5 61K 4K 4 Y 5 6-ch 2-ch Y 5 10bits Y 2 IAP Y Y 16-level Y Y Y Y
5.9 5.6 5.6 5.8TheprogramFlashinuserprogramareacanbeusedasEEPROM.
IRC15W4K63S4(Usingexternalcrystalorinternal24MHzclock)
5.5-2.5 63.5K 4K 4 Y 5 6-ch 2-ch Y 5 10bits Y 2 IAP Y Y Fixed Y Y N N
5.9 5.6 5.6 5.8TheprogramFlashinuserprogramareacanbeusedasEEPROM.
EncryptionDownload:pleaseburnsourcecodewithencryptionkeyontoMCUinthefactory.Then,youcanmakeasimpleupdatesoftwarejustwithone"update"buttonbyfisrtlyusingthefuction"encrytiondownload"andthen"releaseproject"toupdateyourselfcodeunabledtobeinterceptedwhenyouneedtoupgradeyourcode.
-
STC MC
U Limite
d.
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/296622
STC15W4K32S4seriesMCUManual www.GXWMCU.com TemporaryTechnicalAdviser:(86)13922829991 TelofR&DAdviser:(86)13922805190
Fax:0513-55012969/2956/2947
1.5 Naming rules of STC15W4K32S4 series MCUxxx15 x4Kxxxx--35x-xxxxxxx
PinNumbere.g.64,48,44,40,32,28
Packagetypee.g.LQFP,PDIP,SOP,SKDIP
TemperaturerangeI:Industrial,-40 -85C:Commercial,0 -70
Operatingfrequency35:Upto35MHz
Programspace,e.g.08:8KB16:16KB24:24KB32:32KB48:48KB56:56KB58:58KB61:61KB63:63.5KBetc.
OperatingVoltageW:5.5V~2.5V
SRAM:4K=4096bytes
S4 4UARTs(canbeusedsimultaneously)SPIInternalEEPROMA/DConverter(PWMalsocanbeusedasDAC)CCP/PWM/PCA
STC:TheprogramFlashinuserprogramareacannotbeusedasEEPROM.,buttherearespecialEEPROM.
IAP:TheprogramFlashinuserprogramareacanbeusedasEEPROM.IRC:TheprogramFlashinuserprogramareacanbeusedasEEPROM,andtouse
externalcrystalorinternal24MHzclock
STC1T8051MCU,Speedis8~12timesfasterthanthetraditional8051inthesameworkingfrequency
-
STC MC
U Limite
d.
23
STC15W4K32S4seriesMCUManual STCthebiggestdesigncompanyof8051MCUintheworld
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/2966 Fax:0513-55012969/2956/2947
QQofR&D:800003751www.STCMCU.com
1.6 Application Circuit Diagram for ISP of STC15W4K series
Note P0portscanbemultiplexedasAddress/Databus notasA/DConverter.8channelsofA/DConverterareonP1.
Consequently P0.x/ADxmeansthatP0.xcanbeusedasAddress/Databus,whileP1.x/ADCxmeansP1.xcanbeusedasA/Dconversionchannelinthepinmap.
1
2
3
4
5
6
7
8
16
15
14
13
12
11
10
9
Vcc
Gnd
T1OUT
R1IN
R1OUT
T1IN
T2IN
R2OUT
C1+
V+
C1-
C2+
C2-
V-
T2OUT
R2IN
0.1F
Vcc
Vcc
GndPC_RxD(COMPin2)
PC_TxD(COMPin3)
23
5
10K
STC3232,STC232,MAX232,SP232 PCCOM
Vcc
MCU_RxD(P3.0)
MCU_TxD(P3.1)
10K
31
30
29
28
27
26
25
24
23
22
21
40
39
38
37
36
35
34
33
32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
PWM3_2/ALE/P4.5
MISO_3/P4.1
P1.0/ADC0/CCP1/RxD2
P1.2/ADC2/SS/ECI/CMPO
Vcc
P5.5/CMP+
Gnd
P1.7/ADC7/TxD_3/XTAL1/PWM7
P5.4/RST/MCLKO/SS_3/CMP-
P1.1/ADC1/CCP0/TxD2
P1.5/ADC5/SCLK
P1.6/ADC6/RxD_3/XTAL2/MCLKO_2/PWM6
P1.4/ADC4/MISO
P1.3/ADC3/MOSI
PWM2_2/A15/P2.7
CCP1_3/A14/P2.6
CCP0_3/A13/P2.5
PWMFLT/SS_2/ECI_3/A12/P2.4
PWM5/MOSI_2/A11/P2.3
PWM4/MISO_2/A10/P2.2
PWM3/SCLK_2/A9/P2.1
RSTOUT_LOW/A8/P2.0
ECI_2/T1CLKO/T0/P3.4
INT1/P3.3
INT0/P3.2
T2/TxD/P3.1
P0.0/AD0/RxD3
P0.1/AD1/TxD3
P0.2/AD2/RxD4
P0.3/AD3/TxD4
P0.4/AD4/T3CLKO
P0.5/AD5/T3/PWMFLT_2
P0.6/AD6/T4CLKO/PWM7_2
P0.7/AD7/T4/PWM6_2
PWM5_2/WR/P4.2
PWM4_2/RD/P4.4
CCP0_2/T0CLKO/T1/P3.5
CCP1_2/RxD_2/INT2/P3.6
PWM2/TxD_2/INT3/P3.7
T2CLKO/INT4/RxD/P3.0
10F
0.1F
0.1F
0.1F
Vin
SW1PowerOn
47F 0.1F
Vcc
C1 C2
CircuitdiagramforISPofSTC MCU,STCRS-232Converter
ThispartofthecircuithasnothingtodowiththeISPdownloads
SystemPower(canbefromUSB
portofPC)
InternalhghlyreliableReset,soexternalresetcircuitcanbecompletelyremoved.
P5.4/RST/MCLKOpinfactorydefaultstotheI/Oport,whichcanbesetasRSTresetpin(activehigh)throughtheSTC-ISPprogrammer.
Internalhigh-preciseR/Cclock(3%),1%temperaturedrift(-40 ~+85 )while0.6%innormaltemperature(-20 ~+65 ),soexternalexpensivecrysalcanbecompletelyremoved.
Recommend to add decoupling capacitor C1(47F) and C2(0.1F) between Vcc and Gnd that can remove power noiseandimprovetheanti-interferenceability.
PleasepoweronthetargetMCUafterpressdown thebutton"Download/Program"onSTC-ISP.exewhenburningcodetoMCU.
thelinewidthmaybeonly30~50mil
thelinewidthmaybeonly100~200mil
1.6.1 Application Circuit Diagram for ISP using RS-232 Converter
-
STC MC
U Limite
d.
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/296624
STC15W4K32S4seriesMCUManual www.GXWMCU.com TemporaryTechnicalAdviser:(86)13922829991 TelofR&DAdviser:(86)13922805190
Fax:0513-55012969/2956/2947
CH340G
300
1
2
3
4
5
6
7
8
16
15
14
13
12
11
10
9
Vcc
RS232
RTS#
DTR#
DCD#
RI#
DSR#
CTS#
GND
TxD
RxD
V3
UD+
UD-
XI
XO
1234
C3
0.01uF
USB
USB+5V
D-
D+
X612MHz
C422pF
C522pF
C60.1uF 10F
C7
USB+5V
10K
Vcc
10K
31
30
29
28
27
26
25
24
23
22
21
40
39
38
37
36
35
34
33
32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
PWM3_2/ALE/P4.5
MISO_3/P4.1
P1.0/ADC0/CCP1/RxD2
P1.2/ADC2/SS/ECI/CMPO
Vcc
P5.5/CMP+
Gnd
P1.7/ADC7/TxD_3/XTAL1/PWM7
P5.4/RST/MCLKO/SS_3/CMP-
P1.1/ADC1/CCP0/TxD2
P1.5/ADC5/SCLK
P1.6/ADC6/RxD_3/XTAL2/MCLKO_2/PWM6
P1.4/ADC4/MISO
P1.3/ADC3/MOSI
PWM2_2/A15/P2.7
CCP1_3/A14/P2.6
CCP0_3/A13/P2.5
PWMFLT/SS_2/ECI_3/A12/P2.4
PWM5/MOSI_2/A11/P2.3
PWM4/MISO_2/A10/P2.2
PWM3/SCLK_2/A9/P2.1
RSTOUT_LOW/A8/P2.0
ECI_2/T1CLKO/T0/P3.4
INT1/P3.3
INT0/P3.2
T2/TxD/P3.1
P0.0/AD0/RxD3
P0.1/AD1/TxD3
P0.2/AD2/RxD4
P0.3/AD3/TxD4
P0.4/AD4/T3CLKO
P0.5/AD5/T3/PWMFLT_2
P0.6/AD6/T4CLKO/PWM7_2
P0.7/AD7/T4/PWM6_2
PWM5_2/WR/P4.2
PWM4_2/RD/P4.4
CCP0_2/T0CLKO/T1/P3.5
CCP1_2/RxD_2/INT2/P3.6
PWM2//TxD_2/INT3/P3.7
T2CLKO/INT4/RxD/P3.0
Vin
SW1PowerOn
47F 0.1F
Vcc
C1 C2
Note P0portscanbemultiplexedasAddress/Databus notasA/DConverter.8channelsofA/DConverterareonP1.
Consequently P0.x/ADxmeansthatP0.xcanbeusedasAddress/Databus,whileP1.x/ADCxmeansP1.xcanbeusedasA/Dconversionchannelinthepinmap.
ThispartofthecircuithasnothingtodowiththeISPdownloads
SystemPower(canbefromUSB
portofPC)
InternalhghlyreliableReset,soexternalresetcircuitcanbecompletelyremoved.
P5.4/RST/MCLKOpinfactorydefaultstotheI/Oport,whichcanbesetasRSTresetpin(activehigh)throughtheSTC-ISPprogrammer.
Internalhigh-preciseR/Cclock(3%),1%temperaturedrift(-40 ~+85 )while0.6%innormaltemperature(-20 ~+65 ),soexternalexpensivecrysalcanbecompletelyremoved.
Recommend to add decoupling capacitor C1(47F) and C2(0.1F) between Vcc and Gnd that can remove power noiseandimprovetheanti-interferenceability.
thelinewidthmaybeonly30~50mil
thelinewidthmaybeonly100~200mil
TheresistoranddiodearetoavoidUSBdevicetopowerthetargetMCU
RecommendtochooseCH340G(ItspinsarenotcompatiblewithCH341's,butwhosepricelessthanRMB1.1yuanismorecheap),alsoyoucanchoosePL2303(itspriceislessthanRMB1.0yuan),refertowww.wch.cnformoredetail.
CircuitdiagramforISPofSTC MCUUSB convert Serial Port
1.6.2 Application Circuit Diagram for ISP using USB to convert Serial
-
STC MC
U Limite
d.
25
STC15W4K32S4seriesMCUManual STCthebiggestdesigncompanyof8051MCUintheworld
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/2966 Fax:0513-55012969/2956/2947
QQofR&D:800003751www.STCMCU.com
22
1.6.3 Application Circuit Diagram for ISP directly using USB portP3.0/P3.1 of STC15W4K series and IAP15W4K58S4 connect directly with D-/D+ of USB
1234
USB+5V
D-D+
31
30
29
28
27
26
25
24
23
22
21
40
39
38
37
36
35
34
33
32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
PWM3_2/ALE/P4.5
MISO_3/P4.1
P1.0/ADC0/CCP1/RxD2
P1.2/ADC2/SS/ECI/CMPO
Vcc
P5.5/CMP+
Gnd
P1.7/ADC7/TxD_3/XTAL1/PWM7
P5.4/RST/MCLKO/SS_3/CMP-
P1.1/ADC1/CCP0/TxD2
P1.5/ADC5/SCLK
P1.6/ADC6/RxD_3/XTAL2/MCLKO_2/PWM6
P1.4/ADC4/MISO
P1.3/ADC3/MOSI
PWM2_2/A15/P2.7
CCP1_3/A14/P2.6
CCP0_3/A13/P2.5
PWMFLT/SS_2/ECI_3/A12/P2.4
PWM5/MOSI_2/A11/P2.3
PWM4/MISO_2/A10/P2.2
PWM3/SCLK_2/A9/P2.1
RSTOUT_LOW/A8/P2.0
ECI_2/T1CLKO/T0/P3.4
INT1/P3.3
INT0/P3.2
T2/TxD/P3.1
P0.0/AD0/RxD3
P0.1/AD1/TxD3
P0.2/AD2/RxD4
P0.3/AD3/TxD4
P0.4/AD4/T3CLKO
P0.5/AD5/T3/PWMFLT_2
P0.6/AD6/T4CLKO/PWM7_2
P0.7/AD7/T4/PWM6_2
PWM5_2/WR/P4.2
PWM4_2/RD/P4.4
CCP0_2/T0CLKO/T1/P3.5
CCP1_2/RxD_2/INT2/P3.6
PWM2//TxD_2/INT3/P3.7
T2CLKO/INT4/RxD/P3.0
SystemPower
47F 0.01F
Vcc
C1 C2
47pF
47pF24MHz
22
USB+5V
5
USB-Micro 1N4729-3.6VV
R-tube,RMB0.03yuan
USB-Micro
thelinewidthmaybeonly30~50mil
thelinewidthmaybeonly100~200mil
TheMCUcanbepoweredbyUSBportorsystempower
ApplicationCircuitDiagramforISPdirectlyusingUSBport,USB-ISP.MCUP3.0/P3.1connectdirectlywithD-/D+ofUSB
Note P0portscanbemultiplexedasAddress/DatabusnotasA/DConverter.8channelsofA/DConverterareonP1.
Consequently P0.x/ADxmeansthatP0.xcanbeusedasAddress/Databus,whileP1.x/ADCxmeansP1.xcanbeusedasA/Dconversionchannelinthepinmap.
TheApplicationCircuitDiagramappliestoSTC15W4KseriesandIAP15W4K58S4MCUonly.
-
STC MC
U Limite
d.
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/296626
STC15W4K32S4seriesMCUManual www.GXWMCU.com TemporaryTechnicalAdviser:(86)13922829991 TelofR&DAdviser:(86)13922805190
Fax:0513-55012969/2956/2947
1.7 Pin Descriptions of STC15W4K32S4 series MCU
MNEMONICPin Number
DESCRIPTIONLQFP64 LQFP48LQFP44 PDIP40 SOP32 LQFP32 SOP28SKDIP28P0.0/AD0/
RxD3 59 43 40 1 1 29 -P0.0 commonI/OportPORT0[0]AD0 Address/DataBusRxD3 ReceiveDataPortofUART3
P0.1/AD1/TxD3 60 44 41 2 2 30 -
P0.1 commonI/OportPORT0[1]AD1 Address/DataBusTxD3 TransitDataPortofUART3
P0.2/AD2/RxD4 61 45 42 3 3 31 -
P0.2 commonI/OportPORT0[2]AD2 Address/DataBusRxD4 ReceiveDataPortofUART4
P0.3/AD3/TxD4 62 46 43 4 4 32 -
P0.3 commonI/OportPORT0[3]AD3 Address/DataBusTxD4 TransitDataPortofUART4
P0.4/AD4/T3CLKO 63 47 44 5 - - -
P0.4 commonI/OportPORT0[4]
AD4 Address/DataBus
T3CLKO
T3ClockOutputThepincanbeconfiguredforT3CLKObysettingT4T3M[0]bit/T3CLKO
P0.5/AD5/T3/PWMFLT_2 2 2 1 6 - - -
P0.5 commonI/OportPORT0[5]AD5 Address/DataBusT3 ExternalinputofTimer/Counter3
PWMFLT_2ControlPWMtoemergencystop
P0.6/AD6/T4CLKO/PWM7_2
3 3 2 7 - - -
P0.6 commonI/OportPORT0[6]AD6 Address/DataBus
T4CLKO
T4ClockOutputThepincanbeconfiguredforT4CLKObysettingT4T3M[4]bit/T4CLKO
PWM7_2
TheseventhoutputchannelofPulseWidthModulation.Theportmodedefautstoinput-only(high-impedance)modeafterpower-onorreset
P0.7/AD7/T4/PWM6_2 4 4 3 8 - - -
P0.7 commonI/OportPORT0[7]AD7 Address/DataBusT4 ExternalinputofTimer/Counter4
PWM6_2
ThesixthoutputchannelofPulseWidthModulation.Theportmodedefautstoinput-only(high-impedance)modeafterpower-onorreset
P1.0/ADC0/CCP1/RxD2 9 5 4 9 5 1 3
P1.0 commonI/OportPORT1[0]ADC0 ADCinputchannel-0
CCP1
Captureofexternalsignal(measurefrequencyorbeusedasexternalinterrupts) high-speedPulseandPulse-WidthModulationoutputchannel-1
RxD2 ReceiveDataPortofUART2
-
STC MC
U Limite
d.
27
STC15W4K32S4seriesMCUManual STCthebiggestdesigncompanyof8051MCUintheworld
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/2966 Fax:0513-55012969/2956/2947
QQofR&D:800003751www.STCMCU.com
MNEMONICPin Number
DESCRIPTIONLQFP64 LQFP48 LQFP44 PDIP40 SOP32 LQFP32 SOP28SKDIP28
P1.1/ADC1/CCP0/TxD2 10 6 5 10 6 2 4
P1.1 commonI/OportPORT1[1]ADC1 ADCinputchannel-1
CCP0
Captureofexternalsignal(measurefrequencyorbeusedasexternalinterrupts) high-speedPulseandPulse-WidthModulationoutputchannel-0
TxD2 TransitDataPortofUART2
P1.2/ADC2/SS/ECI/CMPO
12 8 7 11 7 3 5
P1.2 commonI/OportPORT1[2]ADC2 ADCinputchannel-2
SSSlaveselectionsignalofsynchronousserialperipheralinterface----SPI
ECI ExternalpulseinputpinofCCP/PCAcounter
CMPOTheoutputportofreslutcomparedbycomparator
P1.3/ADC3/MOSI 13 9 8 12 8 4 6
P1.3 commonI/OportPORT1[3]ADC3 ADCinputchannel-3MOSI MasterOutputSlaveInputofSPI
P1.4/ADC4/MISO 14 10 9 13 9 5 7
P1.4 commonI/OportPORT1[4]ADC4 ADCinputchannel-4MISO MasterIutputSlaveOnputofSPI
P1.5/ADC5/SCLK 15 11 10 14 10 6 8
P1.5 commonI/OportPORT1[5]ADC5 ADCinputchannel-5
SCLK ClockSignalofsynchronousserialperipheralinterface----SPI
P1.6/ADC6/RxD_3/XTAL2/
MCLKO_2/PWM6
16 12 11 15 11 7 9
P1.6 commonI/OportPORT1[6]ADC6 ADCinputchannel--6RxD_3 ReceiveDataPortofUART1
MCLKO_2
Masterclockoutput;theoutputfrequencycanbeMCLK/1,MCLK/2andMCLK/4.Themaster clock can either beinternalR/Cclockor theexternalinputclockor theexternalcrystaloscillator.
XTAL2
Outputfromtheinvertingamplifierofinternalclockcircuit.Thispinshouldbefloatedwhenanexternaloscillatorisused.
PWM6
ThesixthoutputchannelofPulseWidthModulation.Theportmodedefautstoinput-only(high-impedance)modeafterpower-onorreset
-
STC MC
U Limite
d.
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/296628
STC15W4K32S4seriesMCUManual www.GXWMCU.com TemporaryTechnicalAdviser:(86)13922829991 TelofR&DAdviser:(86)13922805190
Fax:0513-55012969/2956/2947
MNEMONICPin Number
DESCRIPTIONLQFP64 LQFP48 LQFP44 PDIP40 SOP32 LQFP32 SOP28SKDIP28
P1.7/ADC7/TxD_3/XTAL1/PWM7
17 13 12 16 12 8 10
P1.7 commonI/OportPORT1[7]ADC7 ADCinputchannel--7TxD_3 TransitDataPortofUART1
XTAL1
Inputtotheinvertingoscillatoramplifierofinternalclockcircuit.Receivestheexternaloscillatorsignalwhenanexternaloscillatorisused.
PWM7
TheseventhoutputchannelofPulseWidthModulation.Theportmodedefautstoinput-only(high-impedance)modeafterpower-onorreset
P2.0/A8/RSTOUT_LOW
45 33 30 32 25 21 23
P2.0 commonI/OportPORT2[0]A8 TheeighthbitofAddressbusA8
RSTOUT_LOWthepinoutputlowafterpower-onandduringreset,whichcanbesettooutputhighbysoftware
P2.1/A9/SCLK_2/PWM3
46 34 31 33 26 22 24
P2.1 commonI/OportPORT2[1]A9 TheninthbitofAddressbusA9
SCLK_2 ClockSignalofsynchronousserialperipheralinterface----SPI
PWM3
ThethirdoutputchannelofPulseWidthModulation.Theportmodedefautstoinput-only(high-impedance)modeafterpower-onorreset
P2.2/A10/MISO_2/PWM4
47 35 32 34 27 23 25
P2.2 commonI/OportPORT2[2]A10 ThetenthbitofAddressbusA10
MISO_2 MasterIutputSlaveOnputofSPI
PWM4
ThefourthoutputchannelofPulseWidthModulation.Theportmodedefautstoinput-only(high-impedance)modeafterpower-onorreset
P2.3/A11/MOSI_2/PWM5
48 36 33 35 28 24 26
P2.3 commonI/OportPORT2[3]A11 TheeleventhbitofAddressbusA11
MOSI_2 MasterOutputSlaveInputofSPI
PWM5
ThefifthoutputchannelofPulseWidthModulation.Theportmodedefautstoinput-only(high-impedance)modeafterpower-onorreset
P2.4/A12/ECI_3/SS_2/
PWMFLT49 37 34 36 29 25 27
P2.4 commonI/OportPORT2[4]A12 ThetwelfthbitofAddressbusA12
ECI_3 ExternalpulseinputpinofCCP/PCAcounter
SS_2 Slaveselectionsignalofsynchronousserialperipheralinterface----SPIPWMFLT ControlPWMtoemergencystop
P2.5/A13/CCP0_3
50 38 35 37 30 26 28
P2.5 commonI/OportPORT2[5]A13 ThethirteenthbitofAddressbusA13
CCP0_3
Captureofexternalsignal(measurefrequencyorbeusedasexternalinterrupts) high-speedPulseandPulse-WidthModulationoutputchannel-0
-
STC MC
U Limite
d.
29
STC15W4K32S4seriesMCUManual STCthebiggestdesigncompanyof8051MCUintheworld
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/2966 Fax:0513-55012969/2956/2947
QQofR&D:800003751www.STCMCU.com
MNEMONICPin Number
DESCRIPTIONLQFP64 LQFP48LQFP44 PDIP40SOP32LQFP32 SOP28SKDIP28
P2.6/A14/CCP1_3
51 39 36 38 31 27 1
P2.6 commonI/OportPORT2[6]A14 ThefourteenthbitofAddressbusA14
CCP1_3
Captureofexternalsignal(measurefrequencyorbeusedasexternalinterrupts) high-speedPulseandPulse-WidthModulationoutputchannel-1
P2.7/A15/PWM2_2
52 40 37 39 32 28 2
P2.7 commonI/OportPORT2[7]A15 ThefifteenthbitofAddressbusA15
PWM2_2
ThesecondoutputchannelofPulseWidthModulation.Theportmodedefautstoinput-only(high-impedance)modeafterpower-onorreset
P3.0/RxD/INT4
/T2CLKO27 19 18 21 17 13 15
P3.0 commonI/OportPORT3[0]RxD ReceiveDataPortofUART1
INT4Externalinterrupt4,whichonlycanbegeneratedonfallingedge./INT4supportspower-downwaking-up
T2CLKOT2ClockOutputThepincanbeconfiguredforT2CLKObysettingINT_CLKO[2]bit/T2CLKO
P3.1/TxD/T2 28 20 19 22 18 14 16P3.1 commonI/OportPORT3[1]TxD TransitDataPortofUART1T2 ExternalinputofTimer/Counter2
P3.2/INT0 29 21 20 23 19 15 17
P3.2 commonI/OportPORT3[2]
INT0
Externalinterrupt0,whichbothcanbegeneratedonrisingandfallingedge.INT0onlycangenerateinterruptonfallingedgeifIT0(TCON.0)issetto1.And,INT0bothcangenerateinterruptonrisingandfallingedgeifIT0(TCON.0)issetto0.
P3.3/INT1 30 22 21 24 20 16 18
P3.3 commonI/OportPORT3[3]
INT1
Externalinterrupt1,whichbothcanbegeneratedonrisingandfallingedge.INT1onlycangenerateinterruptonfallingedgeifIT1(TCON.2)issetto1.And,INT1bothcangenerateinterruptonrisingandfallingedgeifIT1(TCON.2)issetto0.INT1supportspower-downwaking-up
P3.4/T0/T1CLKO/
ECI_231 23 22 25 21 17 19
P3.4 commonI/OportPORT3[4]T0 ExternalinputofTimer/Counter0
T1CLKOT1ClockOutputThepincanbeconfiguredforT1CLKObysettingINT_CLKO[1]bit/T1CLKO
ECI_2 ExternalpulseinputpinofCCP/PCAcounter
-
STC MC
U Limite
d.
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/296630
STC15W4K32S4seriesMCUManual www.GXWMCU.com TemporaryTechnicalAdviser:(86)13922829991 TelofR&DAdviser:(86)13922805190
Fax:0513-55012969/2956/2947
MNEMONICPin Number
DESCRIPTIONLQFP64 LQFP48 LQFP44 PDIP40 SOP32 LQFP32 SOP28SKDIP28
P3.5/T1/T0CLKO/CCP0_2
34 26 23 26 22 18 20
P3.5 commonI/OportPORT3[5]T1 ExternalinputofTimer/Counter1
T0CLKO
T0ClockOutputThepincanbeconfiguredforT0CLKObysettingINT_CLKO[0]bit/T0CLKO
CCP0_2
Captureofexternalsignal(measurefrequencyorbeusedasexternalinterrupts) high-speedPulseandPulse-WidthModulationoutputchannel-0
P3.6/INT2/RxD_2/CCP1_2
35 27 24 27 23 19 21
P3.6 commonI/OportPORT3[6]
INT2
Externalinterrupt2,whichonlycanbegeneratedonfallingedge./INT2supportspower-downwaking-up
RxD_2 ReceiveDataPortofUART1
CCP1_2
Captureofexternalsignal(measurefrequencyorbeusedasexternalinterrupts) high-speedPulseandPulse-WidthModulationoutputchannel-1
P3.7/INT3/TxD_2/PWM2
36 28 25 28 24 20 22
P3.7 commonI/OportPORT3[7]
INT3
Externalinterrupt3,whichonlycanbegeneratedonfallingedge./INT3supportspower-downwaking-up
TxD_2 TransitDataPortofUART1
PWM2
ThesecondoutputchannelofPulseWidthModulation.Theportmodedefautstoinput-only(high-impedance)modeafterpower-onorreset
P4.0/MOSI_3 22 18 17 - - - -P4.0 commonI/OportPORT4[0]
MISO_3 MasterIutputSlaveOnputofSPI
P4.1/MISO_3 41 29 26 29 - - -P4.1 commonI/OportPORT4[1]
MOSI_3 MasterOutputSlaveInputofSPI
P4.2/WR/PWM5_2
42 30 27 30 - - -
P4.2 commonI/OportPORT4[2]
WR Writepulseofexternaldatamemory
PWM5_2
ThefifthoutputchannelofPulseWidthModulation.Theportmodedefautstoinput-only(high-impedance)modeafterpower-onorreset
P4.3/SCLK_3 43 31 28 - - - -P4.3 PORT4[3]
SCLK_3 ClockSignalofsynchronousserialperipheralinterface----SPI
-
STC MC
U Limite
d.
31
STC15W4K32S4seriesMCUManual STCthebiggestdesigncompanyof8051MCUintheworld
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/2966 Fax:0513-55012969/2956/2947
QQofR&D:800003751www.STCMCU.com
MNEMONICPin Number
DESCRIPTIONLQFP64 LQFP48 LQFP44 PDIP40 SOP32LQFP32 SOP28SKDIP28
P4.4/RD/PWM4_2
44 32 29 31 - - -
P4.4 commonI/OportPORT4[4]
RD Readpulseofexternaldatamemory
PWM4_2
ThefourthoutputchannelofPulseWidthModulation.Theportmodedefautstoinput-only(high-impedance)modeafterpower-onorreset
P4.5/ALE/PWM3_2 57 41 38 40 - - -
P4.5 commonI/OportPORT4[5]
ALEAddressLatchEnable.Itisusedforexternaldatamemorycycles(MOVX)
PWM3_2
ThethirdoutputchannelofPulseWidthModulation.Theportmodedefautstoinput-only(high-impedance)modeafterpower-onorreset
P4.6/RxD2_2 58 42 39 - - - -
P4.6 commonI/OportPORT4[6]
RxD2_2 ReceiveDataPortofUART2
P4.7/TxD2_2 11 7 6 - - - -
P4.7 commonI/OportPORT4[7]
TxD2_2 TransitDataPortofUART2
P5.0/RxD3_2 32 24 - - - - -
P5.0 commonI/OportPORT5[0]RxD3_2 ReceiveDataPortofUART3
P5.1/TxD3_2 33 25 - - - - -
P5.1 commonI/OportPORT5[1]TxD3_2 TransitDataPortofUART3
P5.2/RxD4_2 64 48 - - - - -
P5.2 commonI/OportPORT5[2]RxD4_2 ReceiveDataPortofUART4
P5.3/TxD4_2 1 1 - - - - -
P5.3 commonI/OportPORT5[3]TxD4_2 TransitDataPortofUART4
P5.4/RST/MCLKO/
SS_3/CMP-18 14 13 17 13 9 11
P5.4 commonI/OportPORT5[4]
RSTResetpin.Ahighonthispinforatleasttwomachinecycleswillresetthedevice.
MCLKO
Masterclockoutput;theoutputfrequencycanbeMCLK/1,MCLK/2andMCLK/4.The master clock can either beinternalR/Cclockor theexternalinput clockor theexternal crystaloscillator.
SS_3 Slaveselectionsignalofsynchronousserialperipheralinterface----SPICMP- Comparatornegativeinput
P5.5/CMP+ 20 16 15 19 15 11 13P5.5 commonI/OportPORT5[5]
CMP+ Comparatorpositiveinput
-
STC MC
U Limite
d.
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/296632
STC15W4K32S4seriesMCUManual www.GXWMCU.com TemporaryTechnicalAdviser:(86)13922829991 TelofR&DAdviser:(86)13922805190
Fax:0513-55012969/2956/2947
MNEMONICPin Number
DESCRIPTIONLQFP64 LQFP48 LQFP44 PDIP40 SOP32 LQFP32 SOP28SKDIP28
P6.0 5 commonI/OportPORT6[0]P6.1 6 commonI/OportPORT6[1]P6.2 7 commonI/OportPORT6[2]P6.3 8 commonI/OportPORT6[3]P6.4 23 commonI/OportPORT6[4]P6.5 24 commonI/OportPORT6[5]P6.6 25 commonI/OportPORT6[6]P6.7 26 commonI/OportPORT6[7]P7.0 37 commonI/OportPORT7[0]P7.1 38 commonI/OportPORT7[1]P7.2 39 commonI/OportPORT7[2]P7.3 40 commonI/OportPORT7[3]P7.4 53 commonI/OportPORT7[4]P7.5 54 commonI/OportPORT7[5]P7.6 55 commonI/OportPORT7[6]P7.7 56 commonI/OportPORT7[7]Vcc 19 15 14 18 14 10 12 ThepositivepoleofpowerGnd 21 17 16 20 16 12 14 Thenegativepoleofpower,Gound
-
STC MC
U Limite
d.
33
STC15W4K32S4seriesMCUManual STCthebiggestdesigncompanyof8051MCUintheworld
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/2966 Fax:0513-55012969/2956/2947
QQofR&D:800003751www.STCMCU.com
1.8 Package Dimension Drawings of STC15 series MCU
1.8.1 Dimension Drawings of DFN8
D
E
D2
E2
H
K
M0.
10
R
L
b
LASERMARKPIN1l.D.
(A3)A
A1
e
TOPVIEW SIDEVIEW BOTTOMVIEW
COMMONDIMENSIONSUNITSOFMEASURE=mm(MILLIMETER)SYMBOL MIN. NOM. MAX.
A 0.70 0.75 0.80A1 0.00 0.02 0.05A3 0.20REFb 0.25 0.30 0.35D 3.90 4.00 4.10E 3.90 4.00 4.10
D2 2.10 2.20 2.30E2 2.10 2.20 2.30e 0.55 0.65 0.75H 0.35REFK 0.35REFL 0.45 0.55 0.65R 0.13 - -
SIDEVIEW 0.08
Note:
Alldimensionsdonotincludemoldflashorprotrusions
-
STC MC
U Limite
d.
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/296634
STC15W4K32S4seriesMCUManual www.GXWMCU.com TemporaryTechnicalAdviser:(86)13922829991 TelofR&DAdviser:(86)13922805190
Fax:0513-55012969/2956/2947
8-PINSMALLOUTLINEPACKAGE(SOP8)DimensionsinInches
D
E1 E
A1
A
be50mil
LL1
COMMONDIMENSIONS(UNITSOFMEASURE=INCH)
SYMBOL MIN. NOM. MAX.A 0.053 - 0.069
A1 0.004 - 0.010b - 0.016 -D 0.189 - 0.196E 0.228 - 0.244E1 0.150 - 0.157e 0.050L 0.016 - 0.050L1 0.008 00 - 80
UNIT:INCH,1inch=1000mil
0.004max.
Dimension Drawings of SOP8
1.8.2 Dimension Drawings of SOP8
-
STC MC
U Limite
d.
35
STC15W4K32S4seriesMCUManual STCthebiggestdesigncompanyof8051MCUintheworld
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/2966 Fax:0513-55012969/2956/2947
QQofR&D:800003751www.STCMCU.com
D
E1
A
L
e
E eA
COMMONDIMENSIONS(UNITSOFMEASURE=INCH)
SYMBOL MIN. NOM. MAX.A - - 0.210
A1 0.015 - -A2 0.125 0.130 0.135b - 0.018 -b1 - 0.060 -D 0.355 0.365 0.400E - 0.300 -E1 0.245 0.250 0.255e - 0.100 -L 0.115 0.130 0.1500 0 7 15eA 0.335 0.355 0.375
UNIT:INCH,1inch=1000mil
b1
b
A1
8-Pin Plastic Dual Inline Package (DIP8)DimensionsinInches
0
A2
18mil
100mil
60mil
Dimension Drawings of DIP8
1.8.3 Dimension Drawings of DIP8
-
STC MC
U Limite
d.
NantongGuoxinMicro-ElectronicsCo.Ltd. Switchboard:0513-55012928/2929/296636
STC15W4K32S4seriesMCUManual www.GXWMCU.com TemporaryTechnicalAdviser:(86)13922829991 TelofR&DAdviser:(86)13922805190
Fax:0513-55012969/2956/2947
16-PINSMALLOUTLINEPACKAGE(SOP16)
D(9.9mm)
E1
E(6.
0mm
)
A3