用户手册STM8S-DISCOVERY
stm8l-discovery

UM0970User ManualSTM8L-DISCOVERYIntroductionThe STM8L-DISCOVERY helps you to discover the STM8L ultralow power features and todevelop and share your applications. It is based on an STM8L152C6T6 and includes an ST-Link embedded debug tool interface, LCD (24 segments, 4 commons), LEDs and pushbuttons.Figure 1.STM8L-DISCOVERY boardSeptember 2010Doc ID 17693 Rev 11/29Contents UM0970Contents1Quick start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.1Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2System requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.3Development toolchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.4Demonstration software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.5Order code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53Hardware and layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.1STM8L152C6T6 microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.2Embedded ST-Link . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.2.1Using the ST-Link to program/debug the STM8L on board . . . . . . . . . . 123.2.2Using the ST-Link to program/debug an external STM8L application . . 123.3Power supply and power selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.4LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.5Push buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.6Built-in IDD measurement circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.6.1Run mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.6.2Low power mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.6.3Low power mode I DD measurement principle . . . . . . . . . . . . . . . . . . . . 153.6.4Ibias current measurement procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 163.7Solder bridges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.8LCD (24 segments, 4 commons) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4Extension connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5Electrical schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 6Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282/29Doc ID 17693 Rev 1UM0970Quick startDoc ID 17693 Rev 13/291 Quick startThe STM8L-DISCOVERY is a low-cost and easy-to-use development kit to quickly evaluateand start a development with an STM8L ultralow power microcontroller.Before installing and using the product, please accept the Evaluation Product License Agreement from /stm8l-discovery.For more information on the STM8L-DISCOVERY and for demonstration software visit /stm8l-discovery.1.1 Getting started1.Check jumper positions on the board, JP1 and CN3 ON (Discovery selected).2. Connect the STM8L-DISCOVERY board to a PC with a USB cable to power the board.Red LED LD2 (PWR) then lights up.3.Function 1 is executed and each click on user button B2 changes the executed function as described in Table 1.To study or modify the DISCOVER project related to this demo, visit /stm8l-discovery and follow the tutorial. Discover the STM8L features, download and execute programs proposed in the list of projects. This site also contains examples from which you can develop your own applications.1.2 System requirements●Windows PC (2000, XP , Vista)●A/Mini-B USB cableTable 1.FunctionsFunction LED LD3/4BarsValue displayed1BlinkSTM8L V DD voltage measured2Off STM8L consumption measured in Run mode3Off STM8L consumption measured in Low power mode, LCD on4Off STM8L consumption measured in Low power mode, LCD off5Off STM8L consumption measured in Halt mode, LCD offQuick start UM09704/29Doc ID 17693 Rev 11.3 Development toolchain●IAR, Embedded Workbench® for STM8●STMicroelectronics, ST Visual Develop (STVD)1.4 Demonstration softwareDemonstration software is preloaded in the board's Flash memory. This demonstration usesthe built-in IDD measurement feature of the STM8L-DISCOVERY to automatically measure and display on the LCD the consumption of the MCU in run and low power modes. The latest versions of this demonstration source code and associated documentation can be downloaded from /stm8l-discovery.1.5 Order codeTo order the STM8L ultralow power Discovery, use the order code STM8L-DISCOVERY.UM0970FeaturesDoc ID 17693 Rev 15/292 FeaturesThe STM8L-DISCOVERY offers the following features:●STM8L152C6T6 microcontroller, 32 KB Flash, 2 KB RAM, 1KB EEPROM in 48-pin LQFP●On-board ST -Link with selection mode switch to use the kit as a stand-alone ST -Link (with SWIM connector for programming and debugging)●Two red LEDs; LD1 for USB communication, LD2 for 3.3 V power on ●Designed to be powered by USB or an external supply of 5 V or 3.3 V ●Can supply target application with 5 volts and 3 volts ●Two user LEDs, LD3 and LD4 (green and blue)●Two push buttons (User and Reset)●I DD current measurement●LCD 28-pin DIP (24 segments, 4 commons)●Extension header for all QFP48 I/Os for quick connection to prototyping board for easy probingHardware and layout UM0970 3 Hardware and layoutThe STM8L-DISCOVERY is designed around the STM8L152C6T6 microcontroller in a 48-pin LQFP package.Figure2 illustrates the connections between the STM8L152C6T6 and its peripherals (ST-Link, push button, LED, LCD and connectors).Figure3 and Figure4 help you to locate these features on the STM8L-DISCOVERY.6/29Doc ID 17693 Rev 1UM0970Hardware and layoutDoc ID 17693 Rev 17/29Figure 3.Top layoutST -LinkLCD 24 segmentsI DD measurement STM8L152C6T6B2CN2JP1LD3LD4B1CN3IDD moduleLD1LD2User buttonLED blueReset buttonLED greenSWIM connectorCOMpowerSB1,2X2 crystalD2 diode D1 diodeST -Link/Discovery selector+3.3V power supply input+5Vpower supply inputHardware and layoutUM09708/29Doc ID 17693 Rev 1Figure 4.Bottom layoutP1P2SB4,6,8,10PRG-32SB3,5,7,9DEFAULTSB11,12,14SB13,15SB16SB17P3IDD_MeasurementB2-USER B1-RESETX3 crystal connectorconnectorconnectorJP1IDD(RESERVED)UM0970Hardware and layoutDoc ID 17693 Rev 19/293.1 STM8L 152C6T6 microcontrollerThis 8-bit ultralow power MCU has 32 KB Flash, 2 KB RAM, 1 KB data EEPROM, RTC,LCD, timers, USART, I2C, SPI, ADC, DAC and comparators.Figure 5.STM8L152C6T6 packageThis device provides the following benefits:●Ultralow power proprietary 130 nm technology:Speed and power consumption independent of MCU power supply, Ultralow leakage ●Ultralow power design (clock gating, low-power Flash with power-off capability): Reduced overall Run and Wait mode current consumption by turning off clocks of unused peripherals or Flash●Sub 1µA hardware RTC and AWU system unit:Ultralow power modes for applications requesting regular wake up●Range of Low power modes (up to 4):Suitable for many applications from complete switch off to continuous monitoring at ultralow frequency●Advanced and flexible clock system (multiple internal and external clock sources): Switch and adjust frequency and clock sources on the fly depending on application needs●Direct memory access on board (4-channel DMA):Autonomy for peripherals, independent from core; can switch off Flash memory and CPU (large current consumption contributors) while keeping peripherals active ●Ultralow power and ultrasafe reset system POR/PDR; additional optional activationBOR:Integrated safety and security for application●Ultrafast wakeup from lowest Low power mode (4µs): Fast switching from Static and Dynamic power modes●Analog functional down to 1.8 V, programming down to 1.65 V: Full functionality over the complete V DD rangeFor more information see the STM8L152C6T6 datasheet (Doc ID 15962) on the ST website.The STM8L152C6T6 8-bit microcontroller offers: 2Kbytes RAM32Kbytes of Flash memory LQFP48 7 x 7 mm1Kbytes EEPROMHardware and layout UM0970 Figure 6.STM8L152C6T6 block diagram10/29Doc ID 17693 Rev 1UM0970Hardware and layoutDoc ID 17693 Rev 111/293.2 Embedded ST-LinkThe ST -Link programming and debugging tool is integrated on the STM8L-DISCOVERY.The embedded ST -Link can be used in 2 different ways according to the jumper states (see Table 2):●to program/debug the MCU on board,●to program/debug an MCU in an external application board using a cable connected to SWIM connector CN2.For information about debugging and programming features refer to ST -Link UM0627.Note:UM0627 contains information about all the ST -Link features. Usage in this situation is restricted to STM8 devices and SWIM support.Figure 7.Typical configurationTable 2.Jumper statesJumper stateDescriptionBoth CN3 jumpers ON ST -Link functions enabled for on board programming (default)Both CN3 jumpers OFFST -Link functions enabled for external application through CN2 connector (SWIM supported).Hardware requirements:- USB cable type A to mini-B- Computer with Windows 2000, XP or Vista OSDevelopment toolchain:- IAR, Embedded Workbench® for STM8L- STMicroelectronics, ST Visual Develop (STVD)Hardware and layout UM09703.2.1 Using the ST-Link to program/debug the STM8L on boardTo program the STM8L on board, simply plug in the two jumpers on CN3, as shown inFigure8 in red, but do not use the CN2 connector as that could disturb communication withthe STM8L152C6T6 of the STM8L-DISCOVERY.Figure 8.STM8L-DISCOVERY connections imageJumpers on CN33.2.2 Using the ST-Link to program/debug an external STM8L applicationIt is very easy to use the ST-Link to program the STM8L on an external application. Simplyremove the 2 jumpers from CN3 as shown in Figure9, and connect your application to theCN2 debug connector according to Table3.Table 3.Debug connector CN2 (SWIM)Pin CN2Designation1VDD_TARGET VDD from application2SWIM SWIM data input/output3GND Ground4SWIM_RST SWIM reset12/29Doc ID 17693 Rev 1UM0970Hardware and layoutDoc ID 17693 Rev 113/29Figure 9.ST-Link connections image3.3 Power supply and power selectionThe power supply is provided either by the host PC through the USB cable, or by external power supply (5V or 3.3V). The D1 and D2 protection diodes allow the 5V and 3V3 pins to be used independently as input or output power supplies (see Figure 3). The 5V and 3V3 pins can be used as an output power supply for use by an application board connected on pin headers (P1 to P3). In such a case, the 3V3 pin provides only a 3V power supply and the power consumption must be lower than 100mA. The 5V and 3V3 pins can also be used as an input power supply for the board when the USB connector is not connected to the PC.3.4 LEDs●LD1 COM: Red LED indicates communication in progress between PC and ST -Link.●LD2 PWR: Red LED indicates that the board is powered.●LD3 PE7: Green LED is a user LED connected to the I/O PE7 of the STM8L152C6T6.●LD4 PC7: Blue LED is a user LED connected to the I/O PC7 of the STM8L152C6T6.3.5 Push buttons●B1 RST: Push button is used to RESET the STM8L152C6T6.●B2 USER: User push button connected to the I/O PC1 of the STM8L152C6T6.No jumpers on CN3Hardware and layout UM097014/29Doc ID 17693 Rev 13.6 Built-in IDD measurement circuitThe STM8L-DISCOVERY built-in I DD measurement circuit allows the consumption of the STM8L152C6T6 to be measured and displayed on the LCD Glass while the MCU is in Run or Low power saving modes.●JP1 in ON position: STM8L152C6T6 is powered through I DD measurement circuit (default).●JP1 in OFF position: STM8L152C6T6 is powered directly by +3V3, I DD measurement circuit is bypassed.Note:When jumper JP1 is removed the current consumption of the STM8L152C6T6 can be measured by connecting an ammeter between jumper JP1 pin 1 and pin 2.For Imeasurement by the MCU itself, the circuit below is implemented on the STM8L-measurement timing according to Figure 11.UM0970Hardware and layout 3.6.3 Low power mode I DD measurement principleThe principle used to measure a current when the STM8L152C6T6 is in Low power mode is:1.Configure ADC to measure voltage on the IDD_Measurement pin.2. Configure PE6 to serve as wakeup pin.3. Enter Low power mode after setting IDD_CNT_EN (PC4) signal low.4. IDD_WAKEUP rising edge wakes up the MCU after around 300ms.5. Start ADC conversion as soon as possible after wakeup in order to measure thevoltage corresponding to Low power mode on capacitor C11.6. Reset the counter by programming IDD_CNT_EN high (in less than 70ms after thewakeup) to avoid the R21 2KΩ resistor being connected later in Run mode.The measurement timing is given in Figure11. In Low power modes, the 2KΩ resistor isconnected when T1 goes off after entering Low power mode. Q13 output of the counterallows connection of the 2KΩ resistor when the current I DD becomes very low.Figure11 shows how the counter and T1 ensure that, 150ms after IDD_CNT_EN fallingedge, the shunt resistor R21 is connected between VDD_MCU and the power supply inorder to reduce the measurement range to 30uA full scale. Then after another 150ms forcurrent stabilization, R21 is shorted, the IDD measurement is stored in C11, and the MCU iswoken up. After wakeup the MCU can measure the IDD current corresponding to the Lowpower mode stored in C11.Figure 11.STM8L-DISCOVERY I DD Low power mode measurement timing diagramThe Low power mode measurement procedure can be used in Halt or Active halt mode if theI DD current does not exceed 30uA, otherwise the I DD measurement procedure in Run modeshould be used up to 30mA.Doc ID 17693 Rev 115/29Hardware and layout UM097016/29Doc ID 17693 Rev 13.6.4 Ibias current measurement procedureIn Low power mode the bias current of operational amplifier input (U4 pin 4) is not negligiblecompared to I DD current (typical Ibias is ~240 nA). T o obtain a reliable STM8L152 I DD measurement it is mandatory to subtract the bias current from the I DD low power measurement since this current is not sinked by the MCU. Ibias is measured duringproduction test and stored in the MCU EPROM. The demonstration software, Discover, uses this value to display the correct I DD . The Ibias measurement procedure is part of the demonstration software and can be launched if required.The procedure for Ibias measurement (implemented in the Demo) is:1.Power off the board (disconnect the USB cable).2. Set jumper JP1 to OFF position (pins 1 and 2).3. Push down B2 (USER button), power on the board from the USB.4. Wait at least 1 second before releasing B2, the LCD displays the Ibias measurement.5. Power off the board (disconnect the USB cable).6.Set jumper JP1 to ON position (pins 2 and 3). The Ibias value is now stored. The bias current is then subtracted from the I DD measurement performed in Low power mode.3.7 Solder bridgesTable 4.Solder bridgeBridgeState (1)1.Default state is in bold type.DescriptionSB1,2(X2 crystal)Off P A2, P A3 are disconnected from P1X2, C19, C20 and R24 provide a clock as shown in schematics On P A2, P A3 are connected to P1 (X2, C19, C20, R24 must not be fitted)SB3,5,7,9 (DEFAULT)On Reserved, do not modify SB4,6,8,10(PRG-32)Off Reserved, do not modifySB11,12,14(IDD_Measurement)Off PFO, PE6, PC4 are available and IDD module cannot be used JP1 must be set to OFFOn PFO, PE6, PC4 are used by IDD module JP1 must be set to ONSB13,15(X3 crystal)Off PC5, PC6 are only connected to P2 (but do not remove X3, C21, C23, R27)On PC5, PC6 are connected to P2. X3, C21, C23 and R27 provide 32KHz clock SB16(B1-RESET)Off P A1/RESET signal is only connected to P1On P A1/RESET signal is used by ST_LINK as SWIM_RST and also connected to P1SB17(B2-USER)Off PC1 is only connected to P2OnPC1 is connected to P2 and push button B2 for userUM0970Hardware and layout3.8 LCD (24 segments, 4 commons)This LCD allows the STM8L152C6T6 to display any information on six 14-segment digitsand 4 BARs, using all COMs. (See the LCD segment mapping in Figure12 and pinconnections in Table5.)Note:This LCD also supports six 8-segment digits by only using COM0 and COM1.This configuration allows COM2 and COM3 to be used as I/O ports. In this case the 2 LCDpins must not be plugged into the LCD socket. To proceed with this configuration, removethe LCD carefully, slightly open the COM2 and COM3 pins (pin 13 and pin 14) of the LCD,then replug it in the socket.Characteristics overview:●24 segments and 4 commons●Drive method: multiplexed 1/4 duty, 1/3 bias●Operating voltage: 3V●Operating temperature: 0 to 50°C●Connector: 28-pin DIL 2.54mm pitchNote:When the LCD is plugged, all I/O ports listed in Table5 are unavailable. To use one of these as I/O, you must remove the LCD.Figure 12.LCD segment mappingDoc ID 17693 Rev 117/29Hardware and layout UM0970Table 5.LCD connectionsSTM8L152C6T6 LCDPin name Pin COM3COM2COM1COM0 P A7_LCDSEG011N1P1D1EPE0_LCDSEG121DP1COLON1C1MPE1_LCDSEG232N2P2D2EPE2_LCDSEG342DP2COLON2C2MPE3_LCDSEG453N3P3D3EPE4_LCDSEG563DP3COLON3C3MPE5_LCDSEG674N4P4D4EPD0_LCDSEG784DP4COLON4C4MPD2_LCDSEG895N5P5D5EPD3_LCDSEG910BAR2BAR35C5MPB0_LCDSEG10116N6P6D6EPB1_LCDSEG1112BAR0BAR16C6MPD1_LCDCOM313COM3P A6_LCDCOM214COM2P A5_LCDCOM115COM1P A4_LCDCOM016COM0PB2_LCDSEG12176J6K6A6BPB3_LCDSEG13186H6Q6F6GPB4_LCDSEG14195J5K5A5BPB5_LCDSEG15205H5Q5F5GPB6_LCDSEG16214J4K4A4BPB7_LCDSEG17224H4Q4F4GPD4_LCDSEG18233J3K3A3BPD5_LCDSEG19243H3Q3F3GPD6_LCDSEG20252J2K2A2BPD7_LCDSEG21262H2Q2F2GPC2_LCDSEG22271J1K1A1BPC3_LCDSEG23281H1Q1F1G18/29Doc ID 17693 Rev 1Extension connection UM097019/29Doc ID 17693 Rev 14 Extension connectionMale headers P1, P2 and P3 can connect the STM8L-DISCOVERY to a standardprototyping/wrapping board. All GPI/Os of STM8L152C6T6 are available on it.P1, P2 and P3 can also be probed by an oscilloscope, logical analyzer or voltmeter.Table 6.P1 pinoutPin number (P1)Pin number(STM8L)Board pin nameT y p eMain functionAlternate function LCD (U5)1+3V33.3 V board power supplied or supplyexternal application when USB connected21P A0I/O Port A0 P A0/[USART1_CK](3)/SWIM/BEEP/IR_TIM (7)39/40GND Ground42P A1I/O ResetNRST/P A1(1)53P A2I/O Port A2 P A2/OSC_IN/[USART1_TX](3)/[SPI1_MISO] (3) 64P A3I/O Port A3 P A3/OSC_OUT/[USART1 _RX](3)/[SPI1_MOSI](3) 75P A4I/O Port A4P A4/TIM2_BKIN/ LCD_COM0(2)/ADC1_IN2/COMP1_INP LCD_COM086P A5I/O Port A5P A5/TIM3_BKIN/ LCD_COM1(2)/ADC1_IN1/COMP1_INP LCD_COM197P A6I/O Port A6P A6/[ADC1_TRIG](3)/LCD_COM2(2)/ADC1_IN0/ COMP1_INP LCD_COM2108P A7I/O Port A7 P A7/LCD_SEG0(2)(4) LCD_SEG01114PE0I/O Port E0 PE0(4)/LCD_SEG1(2) LCD_SEG11215PE1I/O Port E1 PE1/TIM1_CH2N / LCD_SEG2(2) LCD_SEG21316PE2I/O Port E2PE2/TIM1_CH3N / LCD_SEG3(2)LCD_SEG31417PE3I/O Port E3 PE3/LCD_SEG4(2) LCD_SEG41518PE4I/O Port E4 PE4/LCD_SEG5(2)LCD_SEG5UM0970Extension connectionDoc ID 17693 Rev 120/291619PE5I/O Port E5PE5/LCD_SEG6(2)/ADC1_IN23/COMP2_INP/ COMP1_INP LCD_SEG61720PD0I/O Port D0PD0/TIM3_CH2/ [ADC1_TRIG](3)/ LCD_SEG7(2)/ADC1_IN2 2/COMP2_INP/ COMP1_INP LCD_SEG71821PD1I/O Port D1 PD1/TIM3_TRIG/ LCD_COM3(2)/ADC1_IN21/COMP2_INP/ COMP1_INPLCD_COM3199/40GNDGroundTable 7.P2 pinoutPin number (P2)Pin number(STM8L)Pin nameT y p eMain functionAlternate function LCD (U5)1+5V5 Volts board power supplied or supplyexternal application when USB connected2NC 39/40GND Ground448PE7I/O Port E7 PE7/LCD_SEG27(2)547PE6 I/O Port E6PE6/LCD_SEG26(2)/PVD_IN646PC7I/O Port C7PC7/LCD_SEG25(2)/ ADC1_IN3/COMP2_INM/ COMP1_INP 745PC6I/O Port C6PC6/OSC32_OUT/ [SPI1_SCK](3)/ [USART1_RX](3)844PC5I/O Port C5 PC5/OSC32_IN /[SPI1_NSS](3)/[USART1_TX](3) 943PC4I/O Port C4 PC4/[USART1_CK](3)/ I2C1_SMB/CCO/LCD_SEG24(2)/ADC1_IN4/COMP2_INM/ COMP1_INPTable 6.P1 pinout (continued)Pin number (P1)Pin number(STM8L)Board pin nameT y p eMain functionAlternate function LCD (U5)UM0970Extension connectionDoc ID 17693 Rev 121/291042PC3I/O Port C3 PC3/[USART1_TX](3)/LCD_SEG23(2)/ADC1_IN5/COMP1_INP/ COMP2_INM LCD_SEG231141PC2I/O Port C2 PC2/[USART1_RX](3)/ LCD_SEG22/ADC1_IN6/COMP1_INP/VREF_OUT LCD_SEG221238PC1I/O Port C1 PC1(4)/I2C1_SCL 1337PC0I/O Port C0 PC0(4)/I2C1_SDA1436PD7I/O Port D7 PD7/TIM1_CH1N /LCD_SEG21(2)/ ADC1_IN7/RTC_ALARM/ VREF_OUT/ COMP1_INPLCD_SEG211535PD6I/O Port D6PD6/TIM1_BKIN /LCD_SEG20(2)/ ADC1_IN8/RTC_CALIB/ VREF_OUT/ COMP1_INP LCD_SEG201634PD5I/O Port D5PD5/TIM1_CH3 /LCD_SEG19(2)/ADC1_IN9/COMP1_INP LCD_SEG191733PD4I/O Port D4PD4/TIM1_CH2 /LCD_SEG18(2)/ADC1_IN10/COMP1_INP LCD_SEG181832PF0I/O Port F0PF0/ADC1_IN24/DAC_OUT 199/40GNDGroundTable 7.P2 pinout (continued)Pin number (P2)Pin number(STM8L)Pin nameT y p eMain functionAlternate function LCD (U5)Extension connectionUM097022/29Doc ID 17693 Rev 1Table 8.P3 pinoutPin number (P3)Pin number(STM8L)Pin nameT y p eMain functionAlternate function LCD (U5)122PD2I/O Port D2 PD2/TIM1_CH1 /LCD_SEG8(2)/ ADC1_IN20/COMP1_INP LCD_SEG8223PD3I/O Port D3 PD3/ TIM1_TRIG/ LCD_SEG9(2)/ADC1_IN1 9/COMP1_INP LCD_SEG9324PB0I/O Port B0 PB0/TIM2_CH1/ LCD_SEG10(2)/ ADC1_IN18/COMP1_INP LCD_SEG10425PB1I/O Port B1 PB1/TIM3_CH1/ LCD_SEG11(2)/ ADC1_IN17/COMP1_INP LCD_SEG11526PB2I/O Port B2 PB2/ TIM2_CH2/ LCD_SEG12(2)/ ADC1_IN16/COMP1_INP LCD_SEG12627PB3I/O Port B3 PB3/TIM2_TRIG/ LCD_SEG13(2)/ ADC1_IN15/COMP1_INP LCD_SEG13728PB4I/O Port B4 PB4/[SPI1_NSS](3)/ LCD_SEG14(2)/ ADC1_IN14/COMP1_INP LCD_SEG14829PB5I/O Port B5 PB5/[SPI1_SCK](3)/ LCD_SEG15(2)/ ADC1_IN13/COMP1_INP LCD_SEG15930PB6I/O Port B6 PB6/[SPI1_MOSI](3)/ LCD_SEG16(2)/ ADC1_IN12/COMP1_INP LCD_SEG161031PB7I/O Port B7 PB7/[SPI1_MISO](3)/ LCD_SEG17(2)/ ADC1_IN11/COMP1_INPLCD_SEG17Revision history UM097028/29Doc ID 17693 Rev 16 Revision historyTable 9.Document revision historyDateRevisionChanges24-Sep-20101Initial release.UM0970Please Read Carefully:Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice.All ST products are sold pursuant to ST’s terms and conditions of sale.Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein.No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein.UNL ESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SAL E ST DISCL AIMS ANY EXPRESS OR IMPL IED WARRANTY WITH RESPECT TO THE USE AND/OR SAL E OF ST PRODUCTS INCL UDING WITHOUT L IMITATION IMPL IED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. UNL ESS EXPRESSL Y APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE, ST PRODUCTS ARE NOT RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY, DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER’S OWN RISK.Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST.ST and the ST logo are trademarks or registered trademarks of ST in various countries.Information in this document supersedes and replaces all information previously supplied.The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.© 2010 STMicroelectronics - All rights reservedSTMicroelectronics group of companiesAustralia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan - Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of AmericaDoc ID 17693 Rev 129/29。
STM8-SWIM通信协议和调试模块用户手册(部分翻译)

STM8-SWIM通信协议和调试模块用户手册(部分翻译)翻译:本人应朋友之邀,翻译了本文的第三章,由于水平有限,且没有用过STM8系列的控制器,如有错误,请见谅。
by踏雪无痕2010-11-11*******************December 2009Doc ID 14024 Rev 21/37UM0470User manualSTM8 SWIM communication protocol and debug module IntroductionThis manual has been written for developers who need to build programming, testing or debugging tools for the STM8 microcontroller family. It explains the debug architecture of the STM8 core.The STM8 debug system consists of two modules:●DM: Debug module ●SWIM: Single wire interface moduleRelated documentation:●STM8S Flash programming reference manual (PM0051)●STM8L Flash programming manual (PM0054)STM8 SWIM 通信协议和调试模块用户手册1.介绍:STM8微控制器家族的测试或调试工具.它解释了stm8 内核调试体系结构STM8 调试系统由两个模块组成:调试模块单线接口模块叙述文档:Contents UM0470Contents1Debug system overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2Communication layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73Single wire interface module (SWIM) . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.1Operatingmodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.2SWIM entry sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.3Bit format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113.3.1High speed bit format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.3.2Low speed bit format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.4SWIM communication protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.5SWIMcommands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.5.1SRST: system reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.5.2ROTF: read on the fly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.5.3WOTF: write on the fly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.6SWIM communication reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.7CPU register access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.8SWIM communication in Halt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.9Physicallayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.10STM8 SWIM registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.10.1SWIM control status register (SWIM_CSR) . . . . . . . . . . . . . . . . . . . . . . 183.10.2SWIM clock control register (CLK_SWIMCCR) . . . . . . . . . . . . . . . . . . . 194Debug module (DM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .204.1Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204.2Mainfeatures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204.3Debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .224.3.1Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .224.3.2Breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224.3.3Abort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .224.3.4Watchdogcontrol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224.3.5Interaction with SWIM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224.4Breakpoint decoding table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2/37Doc ID14024 Rev 2UM0470Contents4.5Software breakpoint mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244.6Timingdescription . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244.7Abort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .244.8Databreakpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254.9Instructionbreakpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254.10Stepmode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254.11Applicationnotes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264.11.1Illegal Memory access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264.11.2Forbidden stack access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264.11.3DMbreak . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264.12DMregisters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274.12.1DM breakpoint register 1 extended byte (DM_BKR1E) . . . . . . . . . . . . . 274.12.2DM breakpoint register 1 high byte (DM_BKR1H) . . . . . . . . . . . . . . . . . 274.12.3DM breakpoint register 1 low byte (DM_BKR1L) . . . . . . . . . . . . . . . . . . 274.12.4DM breakpoint register 2 extended byte (DM_BKR2E) . . . . . . . . . . . . . 284.12.5DM breakpoint register 2 high byte (DM_BKR2H) . . . . . . . . . . . . . . . . . 284.12.6DM breakpoint register 2 low byte (DM_BKR2L) . . . . . . . . . . . . . . . . . . 284.12.7DM control register 1 (DM_CR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294.12.8DM control register 2 (DM_CR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304.12.9DM control/status register 1 (DM_CSR1) . . . . . . . . . . . . . . . . . . . . . . . 314.12.10DM control/status register 2 (DM_CSR2) . . . . . . . . . . . . . . . . . . . . . . . 324.12.11DM enable function register (DM_ENFCTR) . . . . . . . . . . . . . . . . . . . . . 334.12.12Summary of SWIM, DM and core register maps . . . . . . . . . . . . . . . . . . 34 Appendix A Description of the DM_ENFCTR registerfor each STM8 product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36Doc ID 14024 Rev 23/37List of tables UM0470 List of tablesTable 1.SWIM command summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 Table 2.CPU register memory mapping in STM8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Table 3.SWIM pincharacteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 Table 4.Decoding table for breakpoint interrupt generation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Table 5.STM8 registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34 Table 6.Peripherals which are frozen by the bits of the DM_ENFCTR registerfor each STM8 product. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 Table 7.Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 4/37Doc ID 14024 Rev 2UM0470List of figures List of figuresFigure 1.Debug system block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Figure 2.SWIM pin external connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7 Figure 3.SWIM activation sequence. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8 Figure 4.SWIM activation timing diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Figure 5.SWIM entry sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10 Figure 6.High speed bit format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11 Figure 7.Low speed bit format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12 Figure mand format (Host -> Target) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Figure 9.Data format (Target -> Host). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13Figure 10.Timings on SWIM pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 Figure 11.Debug module block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Figure 12.STM8 Instruction Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24 Figure 13.STM8 Debug Module Stall Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Figure 14.STM8 DM Data Break Timing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Figure 15.STM8 DM instruction break timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Figure 16.STM8 DM step timing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25Doc ID 14024 Rev 25/37Debug system overview UM04706/37Doc ID 14024 Rev 21Debug system overview The STM8 debug system interface allows a debugging or programming tool to be connected to the MCU through a single wire bidirectional communication based on open-drain line.It provides non-intrusive read/write access to RAM and peripherals during program executionThe block diagram is shown in Figure 1.Figure 1.Debug system block diagramThe debug module uses the two internal clock sources present in the device, the LSI Low Speed Internal clock (usually in the range 30 kHz-200 kHz, depending on the product) one and the HSI High Speed Internal clock (usually in the range 10 MHzto 25 MHz, depending on the device). The clocks are automatically started when necessary.SWIM EntryLSI oscillator HSI oscillatorComm Layer Command DecodeDebug module (DM)STM8CorePeripherals SWIM pinP e r i p h e r a l B u sCPU BusSWIM RAMFlash/R A M B u sSTM8Data EEPROM调试系统总览UM0470Communication layerDoc ID 14024 Rev 27/372 Communication layerThe SWIM is a single wire interface based on asynchronous, high sink (8 mA), open-drain,bidirectional communication.While the CPU is running, the SWIM allows non-intrusive read/write accesses to be performed on-the-fly to the RAM and peripheral registers, for debug purposes.In addition, while the CPU is stalled, the SWIM allows read/write accesses to be performed to any other part of the MCU’s memory space (Data EEPROM and program memory).CPU registers (A, X, Y , CC, SP) can also be accessed. These registers are mapped in memory and can be accessed in the same way as other memory addresses.●Register, peripherals and memory can be accessed only when the SWIM_DM bit is set. ●When the system is in HALT , WFI orreadout protection mode, the NO_ACCESS flag in the SWIM_CSR register is set. In this case, it is forbidden to perform any accesses because parts of the device may not be clocked and a read access could return garbage or a write access might not succeed.The SWIM can perform a MCU device software reset.The SWIM pin can also be used by the MCU target application as a standard I/O port with some restrictions if you also want to use it for debug. The safest way is to provide a strap option on the application PCB. Figure 2.SWIM pin external connectionsSTM8Application I/OSWIM interface for toolsJumper selection fordebug purposesSWIM pin通信层即使CPU在运行,SWIM 允许不插入读取访问执行空中飞入(on-the-fly)到RAM和外设寄存器达到调试目的另外,当CPU停止时,SWIM允许读写MCU的其它部件的内存空间(DATA EEPROM 和程序存储器)CPU 寄存器(A,X,Y,CC,SP)同样能读写,这些寄存器映射到内存并且能像访问其它内存地址一样访问它们寄存器,外设和内存只有在SWIM_DM位设置时能读写当系统在HALT,WFI或者读出保护模式时,NO_ACCESS 标志位(SWIM_CSR中)置位。
0.96'OLED(4Pin)模块学习手册(STM8S版)

S1
通讯地址
0
0x78
1
0x7a
通讯地址选择表
2、模块用途
OLED,即有机发光二极管( Organic Light Emitting Diode)。 OLED 由于同时具备自发光,不需背光 源、对比度高、厚度薄、视角广、反应速度快、可用于挠曲性面板、使用温度范围广、构造及制程较简单等特 性,被认为是下一代的平面显示器新兴应用技术 。
3.3 模块的电源电路设计
SSD1306 的电源有 VCC:显示屏工作电压;VDD:逻辑电路工作电压。VCC 的工作电压比较高,但是有两种 供电方式:第一种是外部给 VCC 供电,电压范围 8.5V~9.5V;第二种是使用 SSD1306 的内部 DC/DC 电路生成的 电压对 VCC 进行供电,供电范围 7.0V~7.5V(可参考官方手册 2、3.2 部分内容)。一般的系统的工作电压是 3.3V 或 5V,所以电源电路设计采用 SSD1306 的内部 DC/DC 设计(可参考官方手册 1.62、部分内容),VCC 由内部的 DC/DC 电路供电,只需要给 VBAT 与 VDD 供电,供电电压为 3.3V。
深圳市技新电子科技有限公司 www.jixin.pro
0.96’OLED(4Pin)V1.0.0.0
0.96’OLED(4Pin)模块学习手册(STM8S 版)
1、模块介绍
1.1 模块特点
0.96’OLED(4Pin)模块采用 SSD1306 为主芯片,像素为 128*64,通讯方式为 IIC,地址可选(默认地 址 0x78),接口简单,模块带有稳压芯片,支持 3.3V~5V 电压供电,上电自动复位,自发光自由视角,功耗 低。主要特点如下:
11
BS1
这些引脚由 MCU 接口选择输入,选择如下
STM8S固件库使用手册al

STM8S固件库用户手册STM8S系列8位微控制器固件函数库version 1.1.0北京微芯力科 & 沈阳微扬电机整理INDEXSTM8S_FWLIB version V1.1.0stm8s_Adc1 __________ 1 stm8s_Beep __________ 7 stm8s_Clk __________ 8 stm8s_exti __________ 14 stm8s_flash __________ 16 stm8s_gpio __________ 20 stm8s_iwdg __________ 23 stm8s_tim1 __________ 24 stm8s_tim2 __________ 40 stm8s_tim4 __________ 50 stm8s_can __________***************************************************************************************** file stm8s_adc1. version V1.1.0***************************************************************************************** ***************************** STM8S FWLIB *************************************** ADC1_DeInit(void);ADC1_Init( ADC1_ConvMode_TypeDef ADC1_ConversionMode,ADC1_Channel_TypeDef ADC1_Channel,ADC1_PresSel_TypeDef ADC1_PrescalerSelection,ADC1_ExtTrig_TypeDef ADC1_ExtTrigger,FunctionalState ADC1_ExtTriggerState,ADC1_Align_TypeDef ADC1_Align,ADC1_SchmittTrigg_TypeDef ADC1_SchmittTriggerChannel,FunctionalState ADC1_SchmittTriggerState);ADC1_Cmd(FunctionalState NewState);ADC1_ScanModeCmd(FunctionalState NewState);ADC1_DataBufferCmd(FunctionalState NewState);ADC1_ITConfig(ADC1_IT_TypeDef ADC1_IT, FunctionalState NewState);ADC1_PrescalerConfig(ADC1_PresSel_TypeDef ADC1_Prescaler);ADC1_SchmittTriggerChannel,ADC1_SchmittTriggerConfig( ADC1_SchmittTrigg_TypeDefFunctionalState NewState);ADC1_ConversionConfig( ADC1_ConvMode_TypeDef ADC1_ConversionMode,ADC1_Channel_TypeDef ADC1_Channel,ADC1_Align_TypeDef ADC1_Align);ADC1_ExternalTriggerConfig(ADC1_ExtTrig_TypeDef ADC1_ExtTrigger, FunctionalState NewState); ADC1_AWDChannelConfig(ADC1_Channel_TypeDef Channel, FunctionalState NewState);ADC1_StartConversion(void);ADC1_GetConversionValue(void);ADC1_SetHighThreshold(u16 Threshold);ADC1_SetLowThreshold(u16 Threshold);ADC1_GetBufferValue(u8 Buffer);ADC1_GetAWDChannelStatus(ADC1_Channel_TypeDef Channel);ADC1_ClearFlag(ADC1_Flag_TypeDef Flag);ADC1_GetITStatus(ADC1_IT_TypeDef ITPendingBit);ADC1_ClearITPendingBit(ADC1_IT_TypeDef ITPendingBit);********************************************************************************************************************************************************************************** ADC1_DeInit(void);***************************************************************************************** ADC1_Init( ADC1_ConvMode_TypeDef ADC1_ConversionMode,ADC1_Channel_TypeDef ADC1_Channel,ADC1_PresSel_TypeDef ADC1_PrescalerSelection,ADC1_ExtTrig_TypeDef ADC1_ExtTrigger,FunctionalState ADC1_ExtTriggerState,ADC1_Align_TypeDef ADC1_Align,ADC1_SchmittTrigg_TypeDef ADC1_SchmittTriggerChannel,FunctionalState ADC1_SchmittTriggerState); ———————————————————————————————————————————— INPUT ://ADC1 conversion mode selectionADC1_CONVERSIONMODE_SINGLEADC1_CONVERSIONMODE_CONTINUOUS//ADC1 analog channel selectionADC1_CHANNEL_0. . . . . .ADC1_CHANNEL_9//ADC1 clock prescaler selectionADC1_PRESSEL_FCPU_D2D3, D4, D6, D8, D10, D12ADC1_PRESSEL_FCPU_D18//ADC1 External conversion trigger event selectionADC1_EXTTRIG_TIMADC1_EXTTRIG_GPIO//FunctionalState ADC1_ExtTriggerStateADC1_EXTTRIG_TIM = (u8)0x00,ADC1_EXTTRIG_GPIO = (u8)0x10,//ADC1 data alignmentADC1_ALIGN_LEFTADC1_ALIGN_RIGHT//ADC1 schmitt TriggerADC1_SCHMITTTRIG_CHANNEL0. . . . . .ADC1_SCHMITTTRIG_CHANNEL9ADC1_SCHMITTTRIG_ALL//FunctionalState ADC1_SchmittTriggerStateADC1_SCHMITTTRIG_CHANNEL1 = (u8)0x01,ADC1_SCHMITTTRIG_CHANNEL2 = (u8)0x02,ADC1_SCHMITTTRIG_CHANNEL3 = (u8)0x03,ADC1_SCHMITTTRIG_CHANNEL4 = (u8)0x04,ADC1_SCHMITTTRIG_CHANNEL5 = (u8)0x05,ADC1_SCHMITTTRIG_CHANNEL6 = (u8)0x06,ADC1_SCHMITTTRIG_CHANNEL7 = (u8)0x07,ADC1_SCHMITTTRIG_CHANNEL8 = (u8)0x08,ADC1_SCHMITTTRIG_CHANNEL9 = (u8)0x09,(u8)0xFFADC1_SCHMITTTRIG_ALL =***************************************************************************************** ADC1_Cmd(FunctionalState NewState); ———————————————————————————————————————————— INPUT : DISABLE ; ENABLE***************************************************************************************** ADC1_ScanModeCmd(FunctionalState NewState);———————————————————————————————————————————— INPUT : DISABLE ; ENABLE***************************************************************************************** ADC1_DataBufferCmd(FunctionalState NewState);———————————————————————————————————————————— INPUT : DISABLE ; ENABLE***************************************************************************************** ADC1_ITConfig(ADC1_IT_TypeDef ADC1_IT, FunctionalState NewState); ———————————————————————————————————————————— INPUT ://ADC1 Interrupt sourceADC1_IT_AWDIE = (u16)0x10, /**< Analog WDG interrupt enable */ADC1_IT_EOCIE = (u16)0x20, /**< EOC iterrupt enable */ADC1_IT_AWD = (u16)0x140, /**< Analog WDG status */ADC1_IT_AWS0 = (u16)0x110, /**< Analog channel 0 status */ADC1_IT_AWS1 = (u16)0x111, /**< Analog channel 1 status */ADC1_IT_AWS2 = (u16)0x112, /**< Analog channel 2 status */ADC1_IT_AWS3 = (u16)0x113, /**< Analog channel 3 status */ADC1_IT_AWS4 = (u16)0x114, /**< Analog channel 4 status */ADC1_IT_AWS5 = (u16)0x115, /**< Analog channel 5 status */ADC1_IT_AWS6 = (u16)0x116, /**< Analog channel 6 status */ADC1_IT_AWS7 = (u16)0x117, /**< Analog channel 7 status */ADC1_IT_AWS8 = (u16)0x118, /**< Analog channel 8 status */ADC1_IT_AWS9 = (u16)0x119, /**< Analog channel 9 status */ADC1_IT_EOC = (u16)0x80 /**< EOC pending bit */FunctionalState NewState : DISABLE ; ENABLE***************************************************************************************** ADC1_PrescalerConfig(ADC1_PresSel_TypeDef ADC1_Prescaler); ———————————————————————————————————————————— INPUT : //ADC1 clock prescaler selectionADC1_PRESSEL_FCPU_D2 = (u8)0x00, /**< Prescaler selection fADC1 = fcpu/2 */ADC1_PRESSEL_FCPU_D3 = (u8)0x10, /**< Prescaler selection fADC1 = fcpu/3 */ADC1_PRESSEL_FCPU_D4 = (u8)0x20, /**< Prescaler selection fADC1 = fcpu/4 */ADC1_PRESSEL_FCPU_D6 = (u8)0x30, /**< Prescaler selection fADC1 = fcpu/6 */ADC1_PRESSEL_FCPU_D8 = (u8)0x40, /**< Prescaler selection fADC1 = fcpu/8 */ADC1_PRESSEL_FCPU_D10 = (u8)0x50, /**< Prescaler selection fADC1 = fcpu/10 */ADC1_PRESSEL_FCPU_D12 = (u8)0x60, /**< Prescaler selection fADC1 = fcpu/12 */ADC1_PRESSEL_FCPU_D18 = (u8)0x70 /**< Prescaler selection fADC1 = fcpu/18 */***************************************************************************************** ADC1_SchmittTriggerConfig( ADC1_SchmittTrigg_TypeDef ADC1_SchmittTriggerChannel,FunctionalState NewState); ———————————————————————————————————————————— INPUT: //ADC1 schmitt TriggerADC1_SCHMITTTRIG_CHANNEL0 = (u8)0x00, /**< Schmitt trigger disable on AIN0 */ADC1_SCHMITTTRIG_CHANNEL1 = (u8)0x01, /**< Schmitt trigger disable on AIN1 */ADC1_SCHMITTTRIG_CHANNEL2 = (u8)0x02, /**< Schmitt trigger disable on AIN2 */ADC1_SCHMITTTRIG_CHANNEL3 = (u8)0x03, /**< Schmitt trigger disable on AIN3 */ADC1_SCHMITTTRIG_CHANNEL4 = (u8)0x04, /**< Schmitt trigger disable on AIN4 */ADC1_SCHMITTTRIG_CHANNEL5 = (u8)0x05, /**< Schmitt trigger disable on AIN5 */ADC1_SCHMITTTRIG_CHANNEL6 = (u8)0x06, /**< Schmitt trigger disable on AIN6 */ADC1_SCHMITTTRIG_CHANNEL7 = (u8)0x07, /**< Schmitt trigger disable on AIN7 */ADC1_SCHMITTTRIG_CHANNEL8 = (u8)0x08, /**< Schmitt trigger disable on AIN8 */ADC1_SCHMITTTRIG_CHANNEL9 = (u8)0x09, /**< Schmitt trigger disable on AIN9 */(u8)0xFFADC1_SCHMITTTRIG_ALL =/**< Schmitt trigger disable on All channels */ FunctionalState NewState : DISABLE ; ENABLE***************************************************************************************** ADC1_ConversionConfig( ADC1_ConvMode_TypeDef ADC1_ConversionMode,ADC1_Channel_TypeDef ADC1_Channel,ADC1_Align_TypeDef ADC1_Align ); ———————————————————————————————————————————— INPUT: SEE:ADC1_Init ( )***************************************************************************************** ADC1_ExternalTriggerConfig(ADC1_ExtTrig_TypeDefADC1_ExtTrigger, FunctionalState NewState); ———————————————————————————————————————————— INPUT: SEE:ADC1_Init ( )FunctionalState NewState : DISABLE ; ENABLE***************************************************************************************** ADC1_AWDChannelConfig(ADC1_Channel_TypeDef Channel, FunctionalState NewState); ———————————————————————————————————————————— INPUT: SEE:ADC1_Init( ) -> ADC1_Channel_TypeDef ADC1_ChannelFunctionalState NewState : DISABLE ; ENABLE***************************************************************************************** ADC1_StartConversion(void);***************************************************************************************** ADC1_GetConversionValue(void); ————————————————————————————————————————————Return : (u16) ConversionValueADC1_GetConversionValue( );Examples: ADC1ConversionValue=***************************************************************************************** ADC1_SetHighThreshold(u16 Threshold); // Sets the high threshold of the analog watchdog ———————————————————————————————————————————— INPUT : u16 DATA***************************************************************************************** ADC1_SetLowThreshold(u16 Threshold); // Sets the high threshold of the analog watchdog ———————————————————————————————————————————— INPUT : u16 DATA***************************************************************************************** ADC1_GetBufferValue(u8 Buffer); //Read ADC1ConversionValue from the DATA buffer ———————————————————————————————————————————— INPUT : (u8) Buffer ValueADC1ConversionValueReturn : (u16)***************************************************************************************** ADC1_GetAWDChannelStatus(ADC1_Channel_TypeDef Channel);// Checks the specified analog watchdog channel status ———————————————————————————————————————————— INPUT : (u8) ADC1_Channel_TypeDef Channel 0 ~ 9Return : (u8) ((FlagStatus)status) 0 or 1***************************************************************************************** ADC1_GetFlagStatus(ADC1_Flag_TypeDef Flag);//Checks the specified ADC1 flag status : REG ADC3_CR3_DBUF ———————————————————————————————————————————— INPUT : //ADC1 flag.ADC1_FLAG_OVR = (u8)0x41, /**< Overrun status flag */ADC1_FLAG_AWD = (u8)0x40, /**< Analog WDG status */ADC1_FLAG_AWS0 = (u8)0x10, /**< Analog channel 0 status */ADC1_FLAG_AWS1 = (u8)0x11, /**< Analog channel 1 status */ADC1_FLAG_AWS2 = (u8)0x12, /**< Analog channel 2 status */ADC1_FLAG_AWS3 = (u8)0x13, /**< Analog channel 3 status */ADC1_FLAG_AWS4 = (u8)0x14, /**< Analog channel 4 status */ADC1_FLAG_AWS5 = (u8)0x15, /**< Analog channel 5 status */ADC1_FLAG_AWS6 = (u8)0x16, /**< Analog channel 6 status */ADC1_FLAG_AWS7 = (u8)0x17, /**< Analog channel 7 status */ADC1_FLAG_AWS8 = (u8)0x18, /**< Analog channel 8 status*/ADC1_FLAG_AWS9 = (u8)0x19, /**< Analog channel 9 status */ADC1_FLAG_EOC = (u8)0x80 /**< EOC falg */Return :0 or 1 //FlagStatus Status of the ADC1 flag.***************************************************************************************** ADC1_ClearFlag(ADC1_Flag_TypeDef Flag); // Clear the specified ADC1 Flag. ———————————————————————————————————————————— INPUT : //ADC1 flag. SEE ADC1_GetFlagStatus( );***************************************************************************************** ADC1_GetITStatus(ADC1_IT_TypeDef ITPendingBit); // Returns the specified pending bit statusINPUT : // ITPendingBit : the IT pending bit to check.ADC1_IT_AWDIE = (u16)0x10, /**< Analog WDG interrupt enable */ADC1_IT_EOCIE = (u16)0x20, /**< EOC iterrupt enable */ADC1_IT_AWD = (u16)0x140, /**< Analog WDG status */ADC1_IT_AWS0 = (u16)0x110, /**< Analog channel 0 status */ADC1_IT_AWS1 = (u16)0x111, /**< Analog channel 1 status */ADC1_IT_AWS2 = (u16)0x112,/**< Analog channel 2 status */ADC1_IT_AWS3 = (u16)0x113, /**< Analog channel 3 status */ADC1_IT_AWS4 = (u16)0x114, /**< Analog channel 4 status */ADC1_IT_AWS5 = (u16)0x115, /**< Analog channel 5 status */ADC1_IT_AWS6 = (u16)0x116, /**< Analog channel 6 status */ADC1_IT_AWS7 = (u16)0x117, /**< Analog channel 7 status */ADC1_IT_AWS8 = (u16)0x118, /**< Analog channel 8 status */ADC1_IT_AWS9 = (u16)0x119, /**< Analog channel 9 status */ADC1_IT_EOC = (u16)0x80 /**< EOC pending bit */Return :0 or 1 // status of the specified pending bit.***************************************************************************************** ADC1_ClearITPendingBit(ADC1_IT_TypeDef ITPendingBit); ———————————————————————————————————————————— INPUT : S EE ADC1_GetITStatus( );***************************** STM8S FWLIB ******************************************************************** STM8S FWLIB *************************************** file stm8s_beep. version V1.1.0***************************************************************************************** BEEP_DeInit(void);BEEP_Init(BEEP_Frequency_TypeDef BEEP_Frequency);BEEP_Cmd(FunctionalState NewState);BEEP_LSICalibrationConfig(u32 LSIFreqHz);********************************************************************************************************************************************************************************** BEEP_DeInit(void); // Deinitializes the BEEP peripheral registers to their default reset***************************************************************************************** BEEP_Init(BEEP_Frequency_TypeDef BEEP_Frequency);// Initializes the BEEP function according to the specified parameters. ———————————————————————————————————————————— INPUT : // BEEP_Frequency Frequency selection.BEEP_FREQUENCY_1KHZ = (u8)0x00, /*!< Beep signal output frequency equals to 1 KHz */BEEP_FREQUENCY_2KHZ = (u8)0x40, /*!< Beep signal output frequency equals to 2 KHz */BEEP_FREQUENCY_4KHZ = (u8)0x80 /*!< Beep signal output frequency equals to 4 KHz */***************************************************************************************** BEEP_Cmd(FunctionalState NewState); ———————————————————————————————————————————— INPUT : DISABLE ; ENABLE***************************************************************************************** BEEP_LSICalibrationConfig(u32 LSIFreqHz);// Update CSR register with the measured LSI frequency. ———————————————————————————————————————————— INPUT : u32 LSIFreqHz***************************** STM8S FWLIB ******************************************************************** STM8S FWLIB *************************************** file stm8s_clk. version V1.1.0*****************************************************************************************CLK_DeInit (void);CLK_HSECmd (FunctionalState NewState);CLK_HSICmd (FunctionalState NewState);CLK_LSICmd (FunctionalState NewState);CLK_CCOCmd (FunctionalState NewState);CLK_ClockSwitchCmd (FunctionalState NewState);CLK_FastHaltWakeUpCmd (FunctionalState NewState);CLK_SlowActiveHaltWakeUpCmd (FunctionalState NewState);CLK_PeripheralClockConfig (CLK_Peripheral_TypeDef CLK_Peripheral, FunctionalState NewState);CLK_Source_TypeDef CLK_ClockSwitchConfig (CLK_SwitchMode_TypeDefCLK_SwitchMode,CLK_NewClock,ITState,FunctionalStateCLK_CurrentClockState_TypeDef CLK_CurrentClockState);CLK_HSIPrescalerConfig (CLK_Prescaler_TypeDef HSIPrescaler);CLK_CCOConfig (CLK_Output_TypeDef CLK_CCO);CLK_ITConfig (CLK_IT_TypeDef CLK_IT, FunctionalState NewState);CLK_SYSCLKConfig (CLK_Prescaler_TypeDef CLK_Prescaler);CLK_SWIMConfig (CLK_SWIMDivider_TypeDef CLK_SWIMDivider);CLK_CANConfig (CLK_CANDivider_TypeDef CLK_CANDivider);CLK_ClockSecuritySystemEnable (void);CLK_SYSCLKEmergencyClear (void);CLK_AdjustHSICalibrationValue (CLK_HSITrimValue_TypeDef CLK_HSICalibrationValue);CLK_GetClockFreq (void);CLK_GetSYSCLKSource (void);CLK_GetFlagStatus (CLK_Flag_TypeDef CLK_FLAG);CLK_GetITStatus (CLK_IT_TypeDef CLK_IT);CLK_ClearITPendingBit (CLK_IT_TypeDef CLK_IT);********************************************************************************************************************************************************************************** CLK_DeInit (void);***************************************************************************************** CLK_HSECmd (FunctionalState NewState); ———————————————————————————————————————————— INPUT : DISABLE ; ENABLE***************************************************************************************** CLK_HSICmd (FunctionalState NewState); ———————————————————————————————————————————— INPUT : DISABLE ; ENABLE***************************************************************************************** CLK_LSICmd (FunctionalState NewState); ———————————————————————————————————————————— INPUT : DISABLE ; ENABLE***************************************************************************************** CLK_CCOCmd (FunctionalState NewState); // Enables or disablle the Configurable Clock Output ———————————————————————————————————————————— INPUT : DISABLE ; ENABLE***************************************************************************************** CLK_ClockSwitchCmd (FunctionalState NewState); // Starts or Stops manually clock switch execution ———————————————————————————————————————————— INPUT : DISABLE ; ENABLE***************************************************************************************** CLK_FastHaltWakeUpCmd (FunctionalState NewState); ———————————————————————————————————————————— INPUT : DISABLE ; ENABLE***************************************************************************************** CLK_SlowActiveHaltWakeUpCmd (FunctionalState NewState); //Configures the slow active halt wake up ———————————————————————————————————————————— INPUT : DISABLE ; ENABLE***************************************************************************************** CLK_PeripheralClockConfig ( C LK_Peripheral_TypeDef CLK_Peripheral,FunctionalState NewState); ———————————————————————————————————————————— INPUT : // CLK Enable peripheralCLK_PERIPHERAL_I2C = (u8)0x00, /*!< Peripheral Clock Enable 1, I2C */CLK_PERIPHERAL_SPI = (u8)0x01, /*!< Peripheral Clock Enable 1, SPI */CLK_PERIPHERAL_UART1 = (u8)0x02, /*!< Peripheral Clock Enable 1, UART1 */CLK_PERIPHERAL_UART2 = (u8)0x03, /*!< Peripheral Clock Enable 1, UART2 */CLK_PERIPHERAL_UART3 = (u8)0x03, /*!< Peripheral Clock Enable 1, UART3 */CLK_PERIPHERAL_TIMER6 = (u8)0x04, /*!< Peripheral Clock Enable 1, Timer6 */CLK_PERIPHERAL_TIMER4 = (u8)0x04, /*!< Peripheral Clock Enable 1, Timer4 */CLK_PERIPHERAL_TIMER5 = (u8)0x05, /*!< Peripheral Clock Enable 1, Timer5 */CLK_PERIPHERAL_TIMER2 = (u8)0x05, /*!< Peripheral Clock Enable 1, Timer2 */CLK_PERIPHERAL_TIMER3 = (u8)0x06, /*!< Peripheral Clock Enable 1, Timer3 */CLK_PERIPHERAL_TIMER1 = (u8)0x07, /*!< Peripheral Clock Enable 1, Timer1 */CLK_PERIPHERAL_ADC = (u8)0x13, /*!< Peripheral Clock Enable 2, ADC */CLK_PERIPHERAL_CAN = (u8)0x17 /*!< Peripheral Clock Enable 2, CAN */FunctionalState NewState : DISABLE ; ENABLE***************************************************************************************** CLK_ClockSwitchConfig ( CLK_SwitchMode_TypeDef CLK_SwitchMode,CLK_Source_TypeDef CLK_NewClock,ITState,FunctionalStateCLK_CurrentClockState_TypeDef CLK_CurrentClockState ); ———————————————————————————————————————————— INPUT ://Switch Mode Auto, Manual.CLK_SWITCHMODE_MANUAL = (u8)0x00, /*!< Enable the manual clock switching mode */CLK_SWITCHMODE_AUTO = (u8)0x01 /*!< Enable the automatic clock switching mode *///CLK Clock Source.CLK_SOURCE_HSI = (u8)0xE1, /*!< Clock Source HSI. */CLK_SOURCE_LSI = (u8)0xD2, /*!< Clock Source LSI. */CLK_SOURCE_HSE = (u8)0xB4 /*!< Clock Source HSE. *///FunctionalState ITStateDISABLE ; ENABLE//CLK_CurrentClockState_TypeDefCLK_CURRENTCLOCKSTATE_DISABLE = (u8)0x00, /*!< Current clock disable */CLK_CURRENTCLOCKSTATE_ENABLE = (u8)0x01 /*!< Current clock enable */Return : SUCCESS or ERROR;***************************************************************************************** CLK_HSIPrescalerConfig (CLK_Prescaler_TypeDef HSIPrescaler); ———————————————————————————————————————————— INPUT : //CLK Clock Divisor.CLK_PRESCALER_HSIDIV1 = (u8)0x00, /*!< High speed internal clock prescaler: 1 */CLK_PRESCALER_HSIDIV2 = (u8)0x08, /*!< High speed internal clock prescaler: 2 */CLK_PRESCALER_HSIDIV4 = (u8)0x10, /*!< High speed internal clock prescaler: 4 */CLK_PRESCALER_HSIDIV8 = (u8)0x18, /*!< High speed internal clock prescaler: 8 */CLK_PRESCALER_CPUDIV1 = (u8)0x80, /*!< CPU clock division factors 1 */CLK_PRESCALER_CPUDIV2 = (u8)0x81, /*!< CPU clock division factors 2 */CLK_PRESCALER_CPUDIV4 = (u8)0x82, /*!< CPU clock division factors 4 */CLK_PRESCALER_CPUDIV8 = (u8)0x83, /*!< CPU clock division factors 8 */CLK_PRESCALER_CPUDIV16 = (u8)0x84, /*!< CPU clock division factors 16 */CLK_PRESCALER_CPUDIV32 = (u8)0x85, /*!< CPU clock division factors 32 */CLK_PRESCALER_CPUDIV64 = (u8)0x86, /*!< CPU clock division factors 64 */CLK_PRESCALER_CPUDIV128 = (u8)0x87 /*!< CPU clock division factors 128 */***************************************************************************************** CLK_CCOConfig (CLK_Output_TypeDef CLK_CCO); ———————————————————————————————————————————— INPUT : //CLK Clock OutputCLK_OUTPUT_HSI = (u8)0x00, /*!< Clock Output HSI */CLK_OUTPUT_LSI = (u8)0x02, /*!< Clock Output LSI */CLK_OUTPUT_HSE = (u8)0x04, /*!< Clock Output HSE */CLK_OUTPUT_CPUDIV2 = (u8)0x0A, /*!< Clock Output CPU/2 */CLK_OUTPUT_CPUDIV4 = (u8)0x0C, /*!< Clock Output CPU/4 */CLK_OUTPUT_CPUDIV8 = (u8)0x0E, /*!< Clock Output CPU/8 */CLK_OUTPUT_CPUDIV16 = (u8)0x10, /*!< Clock Output CPU/16 */CLK_OUTPUT_CPUDIV32 = (u8)0x12, /*!< Clock Output CPU/32 */CLK_OUTPUT_CPUDIV64 = (u8)0x14, /*!< Clock Output CPU/64 */CLK_OUTPUT_HSIRC = (u8)0x16, /*!< Clock Output HSI RC */CLK_OUTPUT_MASTER = (u8)0x18, /*!< Clock Output Master */CLK_OUTPUT_OTHERS = (u8)0x1A /*!< Clock Output OTHER */***************************************************************************************** CLK_ITConfig (CLK_IT_TypeDef CLK_IT, FunctionalState NewState); ———————————————————————————————————————————— INPUT : //CLK interrupt configuration and Flags cleared by software.CLK_IT_CSSD = (u8)0x0C, /*!< Clock security system detection Flag */CLK_IT_SWIF = (u8)0x1C /*!< Clock switch interrupt Flag */***************************************************************************************** CLK_SYSCLKConfig (CLK_Prescaler_TypeDef CLK_Prescaler); ———————————————————————————————————————————— INPUT : //CLK Clock Divisor.CLK_PRESCALER_HSIDIV1 = (u8)0x00, /*!< High speed internal clock prescaler: 1 */CLK_PRESCALER_HSIDIV2 = (u8)0x08, /*!< High speed internal clock prescaler: 2 */CLK_PRESCALER_HSIDIV4 = (u8)0x10, /*!< High speed internal clock prescaler: 4 */CLK_PRESCALER_HSIDIV8 = (u8)0x18, /*!< High speed internal clock prescaler: 8 */CLK_PRESCALER_CPUDIV1 = (u8)0x80, /*!< CPU clock division factors 1 */CLK_PRESCALER_CPUDIV2 = (u8)0x81, /*!< CPU clock division factors 2 */CLK_PRESCALER_CPUDIV4 = (u8)0x82, /*!< CPU clock division factors 4 */CLK_PRESCALER_CPUDIV8 = (u8)0x83, /*!< CPU clock division factors 8 */CLK_PRESCALER_CPUDIV16 = (u8)0x84, /*!< CPU clock division factors 16 */CLK_PRESCALER_CPUDIV32 = (u8)0x85, /*!< CPU clock division factors 32 */CLK_PRESCALER_CPUDIV64 = (u8)0x86, /*!< CPU clock division factors 64 */CLK_PRESCALER_CPUDIV128 = (u8)0x87 /*!< CPU clock division factors 128 ****************************************************************************************** CLK_SWIMConfig (CLK_SWIMDivider_TypeDef CLK_SWIMDivider); ———————————————————————————————————————————— INPUT : //SWIM Clock divider.CLK_SWIMDIVIDER_2 = (u8)0x00, /*!< SWIM clock is divided by 2 */CLK_SWIMDIVIDER_OTHER = (u8)0x01 /*!< SWIM clock is not divided by 2 */***************************************************************************************** CLK_CANConfig (CLK_CANDivider_TypeDef CLK_CANDivider); ———————————————————————————————————————————— INPUT : //External CAN clock dividern.CLK_CANDIVIDER_1 = (u8)0x00, /*!< External CAN clock = HSE/1 */CLK_CANDIVIDER_2 = (u8)0x01, /*!< External CAN clock = HSE/2 */CLK_CANDIVIDER_3 = (u8)0x02, /*!< External CAN clock = HSE/3 */CLK_CANDIVIDER_4 = (u8)0x03, /*!< External CAN clock = HSE/4 */CLK_CANDIVIDER_5 = (u8)0x04, /*!< External CAN clock = HSE/5 */CLK_CANDIVIDER_7 = (u8)0x06, /*!< External CAN clock = HSE/7 */CLK_CANDIVIDER_8 = (u8)0x07 /*!< External CAN clock = HSE/8 */***************************************************************************************** CLK_ClockSecuritySystemEnable (void); // Enables the Clock Security System.***************************************************************************************** CLK_SYSCLKEmergencyClear (void); // Reset the SWBSY flag (SWICR Reister)***************************************************************************************** CLK_AdjustHSICalibrationValue (CLK_HSITrimValue_TypeDef CLK_HSICalibrationValue); ———————————————————————————————————————————— INPUT : //CLK HSI Calibration Value.CLK_HSITRIMV ALUE_0 = (u8)0x00, /*!< HSI Calibtation Value 0 */CLK_HSITRIMV ALUE_1 = (u8)0x01, /*!< HSI Calibtation Value 1 */CLK_HSITRIMV ALUE_2 = (u8)0x02, /*!< HSI Calibtation Value 2 */CLK_HSITRIMV ALUE_3 = (u8)0x03, /*!< HSI Calibtation Value 3 */CLK_HSITRIMV ALUE_4 = (u8)0x04, /*!< HSI Calibtation Value 4 */CLK_HSITRIMV ALUE_5 = (u8)0x05, /*!< HSI Calibtation Value 5 */CLK_HSITRIMV ALUE_6 = (u8)0x06, /*!< HSI Calibtation Value 6 */CLK_HSITRIMV ALUE_7 = (u8)0x07 /*!< HSI Calibtation Value 7 */***************************************************************************************** CLK_GetClockFreq (void); //eturns the frequencies of different on chip clocks. ———————————————————————————————————————————— Return : ((u32)clockfrequency)Examples :(u32)clockfrequency = CLK_GetClockFreq ();***************************************************************************************** CLK_GetSYSCLKSource (void); ———————————————————————————————————————————— Return : // Returns the clock source used as system clock.(u8)0xE1, /*!< Clock Source HSI. */(u8)0xD2, /*!< Clock Source LSI. */(u8)0xB4 /*!< Clock Source HSE. */***************************************************************************************** CLK_GetFlagStatus (CLK_Flag_TypeDef CLK_FLAG);// Checks whether the specified CLK flag is set or not. ———————————————————————————————————————————— INPUT : // CLK_FLAG Flag to check.CLK_FLAG_LSIRDY = (u16)0x0110, /*!< Low speed internal oscillator ready Flag */CLK_FLAG_HSIRDY = (u16)0x0102, /*!< High speed internal oscillator ready Flag */CLK_FLAG_HSERDY = (u16)0x0202, /*!< High speed external oscillator ready Flag */CLK_FLAG_SWIF = (u16)0x0308, /*!< Clock switch interrupt Flag */CLK_FLAG_SWBSY = (u16)0x0301, /*!< Switch busy Flag */CLK_FLAG_CSSD = (u16)0x0408, /*!< Clock security system detection Flag */CLK_FLAG_AUX = (u16)0x0402, /*!< Auxiliary oscillator connected to master clock */CLK_FLAG_CCOBSY = (u16)0x0504, /*!< Configurable clock output busy */CLK_FLAG_CCORDY = (u16)0x0502 /*!< Configurable clock output ready */Return : RESET or SET //FlagStatus, status of the checked flag*****************************************************************************************。
STM8CubeMX中文版用户使用手册

3.3.1 运行 STM8CubeMX 作为独立应用 ............................................................9
3.3.2 在命令行模式下运行 STM8CubeMX .........................................................9
2、主要特点 ............................................................................................................................................................................................................4
3.2.3 卸载 STM8CubeMX 独立版本 ....................................................................8
3.3 推出 STM8CubeMX ................................................................................................9
4.3 主界面 ....................................................................................................................19
4.4 工具栏和菜单 ........................................................................................................20
ST STM8S-DISCOVERY STM8S access Discovery 数据手册

Data briefFor further information contact your local STMicroelectronics sales office.November 2010Doc ID 17820 Rev 11/3STM8S-DISCOVERYSTM8S access DiscoveryFeatures■STM8S105C6T6 microcontroller, 32 KB Flash, 2 KB RAM, 1 KB EEPROM ■Powered by USB cable between PC and STM8S-DISCOVERY ■Selectable power of 5 V or 3.3 V ■Touch sensing button ■User LED ■Extension header for all I/Os ■Wrapping area for users own application ■Embedded ST-Link ■USB interface for programming and debugging ■SWIM debug supportDescriptionThe STM8S-DISCOVERY helps you to discoverthe STM8S features and to develop and shareyour own application.Even though the STM8S-DISCOVERY is builtaround an STM8S105C6T6, it allows evaluationof the main features of all the STM8S Access lineMCUs. It includes an embedded debugger ST -Link, and a touch sensing button.The STM8S-DISCOVERY simply plugs into a PCthrough a standard USB cable. Numerousapplications are available from the STM8S-DISCOVERY web page.Table 1.Device summary Order codeReference STM8S-DISCOVERY STM8S access DiscoverySystem requirements STM8S-DISCOVERY 2/3Doc ID 17820 Rev 11 System requirements●Windows PC (2000, XP , Vista)●USB type A to B cable2 Development toolchain●IAR, Embedded Workbench® for STM8●STMicroelectronics, ST Visual Develop (STVD)3 Demonstration softwareDemonstration software is preloaded in the board's Flash memory. This demonstration usesthe touch sensing feature of the STM8S-Discovery to change the led blinking speed whenthe touch key is pressed. The latest version of the demonstration source code andassociated documentation can be downloaded from /stm8s-discovery.4 Revision historyTable 2.Document revision history DateRevision Changes05-Nov-20101Initial release.STM8S-DISCOVERYPlease Read Carefully:Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice.All ST products are sold pursuant to ST’s terms and conditions of sale.Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein.No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein.UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE, ST PRODUCTS ARE NOT RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY, DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER’S OWN RISK.Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST.ST and the ST logo are trademarks or registered trademarks of ST in various countries.Information in this document supersedes and replaces all information previously supplied.The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.© 2010 STMicroelectronics - All rights reservedSTMicroelectronics group of companiesAustralia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan - Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of AmericaDoc ID 17820 Rev 13/3。
ST单片机STM8S开发入门教程

ST单片机STM8S开发入门教程最近ST在国内大力推广他的8位高性价比单片机STM8S系列,感觉性能上还是非常不错的,网上稍微看了点资料,打算有机会还是学习一下,先入门为以后做好技术积累。
好了,长话短说。
手上拿到一套ST最近做活动赠送的三合一学习套件,上面包括STM32F小板、ST LINK小板、STM8S小板,做工很精致,相信很多朋友也收到了。
既然当初去申请了,人家也送了,总得把用起来吧,放着吃灰尘是很可惜的^_^ 。
好,步入正题,刚开始在论坛上逛了一圈,感觉STM8S的资料实在太少,都是官方的应用资料,没有什么入门介绍,连需要安装什么软件都搞不清楚。
偶的电脑光驱坏了,所以也读不出光盘里有什么东西,所以只能到处瞎摸,还是ourdev论坛好,嘿嘿,仔细看了几个帖子,总算明白大概是什么样的开发环境了。
用C语言开发STM8S,需要安装两个软件:1、STVD IDE开发环境;2、COSMIC for STM8 C编译器。
STVD可以到官网下载,下载地址:COSMIC 需要申请LICENSE,比较繁琐,刚好坛子有人传了一个免安装无限制版本的,偶就赶紧下载了,大家可以去下载,仅做为个人学习使用。
下载地址:软件下载后,只需安装STVD。
从上面地址下载的COSMIC不用安装,只要解压到硬盘即可。
后面建立工程的时候设置好路径即可。
下面一步一步开始啦~一、安装好STVD后,桌面上建立了两个快捷图标,ST Visual Develop就是STVD了。
ST Visual Programmer是编程软件,可以配合ST LINK对STM8S进行编程烧录。
二、双击运行ST Visual Develop,启动STVD开发环境。
执行Workspace,在New Workspace 窗口里选择Create workspace and projects,点击“确定”建立工作组和工程三、在Workspace 里输入Workspace名称,由于最终我们要测试一个现成的LED程序,所以偶写了led,随你喜欢了,呵呵。
STM8S和STM32选型手册(中文版)

2(8/8/8) 3(12/12/12)
112 223
1/(10) 1/(10)
37 LQFP48 37 LQFP48
STM32F101CB 36 128K 16K
3(12/12/12)
223
1/(10)
37 LQFP48
STM32F101R4 36 16K 4K
2(8/8/8)
112
1/(16)
51 LQFP64
2 1 3/(16) 1(2) 80 LQFP100/LFBGA100
STM32F103VD 72 384K 64K ● 4(16/16/16) 2(8/8/12) 2 3 2 3+2 1 1
2 1 3/(16) 1(2) 80 LQFP100/LFBGA100
STM32F103VE 72 512K 64K ● 4(16/16/16) 2(8/8/12) 2 3 2 3+2 1 1
2 1 3/(16) 1(2) 80 LQFP100/LFBGA100
STM32F103ZC 72 256K 48K ● 4(16/16/16) 2(8/8/12) 2 3 2 3+2 1 1
2 1 3/(21) 1(2) 112 LQFP144/LFBGA144
144脚 STM32F103ZD 72 384K 64K ● 4(16/16/16) 2(8/8/12) 2 3 2 3+2 1 1
48 48
32K 6K 64K 10K
2(8/8/8) 3(12/12/12)
1121 2231
1/(16) 1/(16)
51 LQFP64 51 LQFP64
STM32F102RB 48 128K 16K
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
UM0817User ManualSTM8S-DISCOVERYIntroductionThe STM8S-DISCOVERY is a quick start evaluation board which helps you to discover theSTM8 features, and to develop and share your own application. It is based on an STM8S105and includes an embedded debugger, ST-LINK, and a touch sensing button. Numerousapplications are available from the STM8S-Discovery web page.Features■STM8S105C6T6 microcontroller, 32KB Flash, 2KB RAM, 1KB EEPROM■Powered by USB cable between PC and STM8S-DISCOVERY■Selectable power of 5V or 3.3V■Touch Sensing button, TS1■User LED, LD1■Extension header for all I/Os■Wrapping area for users own application■Embedded ST-LINK for STM8S■USB interface for programming and debugging■SWIM debug supportFigure 1.STM8S-DISCOVERY evaluation boardFebruary 2010Doc ID 16361 Rev 21/17Contents UM0817Contents1Quick start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32Hardware and layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.1STM8S105C6T6 microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.2ST-LINK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.2.1Using the ST-LINK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.2.2Using the ST-LINK on other STM8S applications . . . . . . . . . . . . . . . . . . 82.3Power supply and power selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.4Single touch sensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3Daughterboard connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4Electrical schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 5Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162/17Doc ID 16361 Rev 2UM0817Quick startDoc ID 16361 Rev 23/171 Quick startIt is very simple to get started using the STM8S-DISCOVERY , just follow these four steps:1.Connect the STM8S-DISCOVERY to a PC with a USB cable.2. Press the TS1 button, and observe LED LD1 blinking.3.Press the TS1 button to change blinking speed.4. Visit /stm8s-discovery and follow the tutorial, then discover otherapplications.The STM8S-DISCOVERY helps you develop and share your own application. Y ou candiscover more of the STM8S features by downloading and executing the proposed programs in the project list.Note:The software code corresponding to this application is available under the name Discover in the project list of the STM8S-Discovery web page.Hardware and layout UM0817 2 Hardware and layoutThe STM8S-DISCOVERY is designed around the STM8S105C6T6 microcontroller in anLQFP48 package. It has two distinct sections that may be separated, the STM8S105C6T6module and the ST-LINK module.Figure2 illustrates the connections between the STM8S105C6T6 and its peripherals (ST-LINK, touch-sensing button, LED and connectors).Figure3 helps you to locate these features on the STM8S-DISCOVERY board, as well asthe potential point of separation (for more details refer to Section2.2.2: Using the ST-LINKon other STM8S applications).Figure 2.Hardware block diagramSTM8S105C6T64/17Doc ID 16361 Rev 2UM0817Hardware and layoutDoc ID 16361 Rev 25/17Figure 3.Top layoutUSB connector ST -LINK JTAGUSB data transfer LEDST -LINK core SWIM connectorS T -L I N K m o d u l ePossible separation pointLED (LD1)Power supply jumper External Osc. (16MHz)STM8S105C6T6T ouch sensing button (TS1)Wrapping areaSO16 footprintS T M 8S 105C 6T 6 m o d u l eHardware and layout UM08176/17Doc ID 16361 Rev 22.1 STM8S105C6T6 microcontrollerFigure 4.STM8S105C6T6 packageThis device provides the following benefits:●Reduced system cost –Integrated true data EEPROM for up to 300K write/erase cycles–High system integration level; internal clock oscillators, brown-out reset, watchdog. ●Performance and robustness –16MHz CPU clock frequency–Up to 38 I/Os on a 48-pin package including 16 high sink outputs –Robust I/O immune against current injection –Independent watchdogs with separate clock source–Flexible clock control, 4 master clocks (HSI, LSI, HSE and external HSE)–Clock security system–A family of products for applications with 2.95 V to 5.5 V operating supply ●Short development cycles –Applications scalability across common family product architecture with compatible pinout, memory map and modular peripherals. –Full documentation and a wide choice of development tools–Standard S/W library for firmware and touch sensing development quick start –Numerous application notes and firmware examples available ●Product longevity –Advanced core and peripherals made in state-of-the-art technology –Low power modes (wait, active-halt, halt)–Auto wake-up timer for active halt –Permanently active, low consumption ●Other features –Nested interrupt controller with 32 interrupts –Up to 37 external interrupts on 6 vectors– 2 x 16-bit general purpose timers; with 2+3 CAPCOM channels (IC, OC or PWM) –Advanced control timer: 16-bit, 4 CAPCOM channels, 3 complementary outputs, dead- time insertion and flexible synchronization –8-bit basic timer with 8-bit prescaler–UART with clock output for synchronous operation, Smartcard, IrDA, LIN –SPI interface up to 8Mbit/s –I2C interface up to 400Kbit/s–Analog-to-digital converter 10-bit, ±1 LSB ADC with up to 10 multiplexed channelsThe STM8S105C6T6 8-bit microcontroller offers:1Kbyte true data EEPROM 32Kbytes of Flash program memory 2Kbytes RAMUM0817Hardware and layout Figure 5.STM8S105 block diagramFor more information see the STM8S105xx datasheet (Doc ID 14771) on the ST website.Doc ID 16361 Rev 27/17Hardware and layout UM08178/17Doc ID 16361 Rev 22.2 ST-LINKThe ST -LINK provides a USB interface for programming and debugging using a single wire interface module (SWIM). The ST -LINK module of the STM8S-DISCOVERY also supplies 5V and 3.3V to the STM8S105C6T6 module.2.2.1 Using the ST-LINKFigure 6.Typical configurationNote:The driver for ST -LINK is installed automatically when the USB is connected.For information about debugging and programming features refer to ST -LINK UM0627, UM0036 STVD and RN0011 STVP . For information about SWIM refer to UM0470.2.2.2 Using the ST-LINK on other STM8S applicationsY ou can connect your ST -LINK to other STM8S applications in 2 ways.●By removing the solder bridges: This way uses the ST -LINK without breaking the PCB. Unsolder the two solder bridges SB1 and SB2 under the SWIM connector.See Figure 7. Y ou can re-solder the two bridges at a later date thus keeping the STM8S-DISCOVERY usable.●By removing it from your board: This way constitutes a good alternative to programming the STM8S devices in other applications. See Figure 8.Note:This ST -LINK only supports the STM8S family. Do not use it with other STM8 families.Figure 7.ST-LINK without breaking the PCBHardware requirements:- USB cable type A to B- Computer with Windows 2000, XP or Vista OSST T oolset (ST Visual Develop and ST Visual Program)Software requirement:which support ST -LINK SWIMRemove SB1 and SB2 solder bridgesUM0817Hardware and layoutDoc ID 16361 Rev 29/17Figure 8.Separated ST-LINK moduleWarning:By removing this module you will lose power supply on the STM8S105C6T6 evaluation board. In consequence, you will not be able to program and use the STM8S105C6T6 board without a SWIM cable and an external power supply. To reconnect your STM8S105C6T6 use connector CNn see Section 3: Daughterboard connection .2.3 Power supply and power selectionThe power supply is provided by a USB connector. Jumper JP1 selects the VDD value (5V or regulated 3.3V) see Figure 9.Figure 9.Power selectionSWIMSTLinkSTM8S105C6 eval boardSTM8S105C6T6VDD = 5VVDD = 3.3VHardware and layout UM081710/17Doc ID 16361 Rev 22.4 Single touch sensingA touch sensing button TS1 is available on the STM8S-DISCOVERY (see Figure 10).Figure 10.Touch sensing schematicTo disable the touch sensing interface and to use PC1, PC2 and PC3 as standard I/O, youneed to unsolder the 2-1 connection and solder 2-3 connection on SB4 and SB3, you also need to unsolder the R2 resistor.RC acquisition principleThe RC acquisition method detects a human touch on key touch sensor (TS1) by measuring the small variation of the touch electrode capacitance. Electrode capacitance is periodically charged and discharged through a fixed resistor (R6).The capacitance value depends on the following parameters: electrode area (A), relative dielectric constant of the insulator (eR), the relative permittivity of air (e0) and the distance between the two electrodes.For more information about touch sensing please refer to AN2927.UM0817Daughterboard connectionDoc ID 16361 Rev 211/173 Daughterboard connectionFour 12-pin male headers CN1, CN2, CN3 and CN4 are connected to the STM8S105C6T6microcontroller. See the following tables for pin assignments.Table 1.CN1 pinoutPin number (Cn1)Pin number (chip)Pin name T y p eMain function Alternate function11NRST IO Reset 22OSCIN/P A1IOPort A133OSCOUT/P A2IO Port A244Vssio_1S I/O ground 55Vss S Digital ground66VCAP S 1.8V regulator capacitor 77Vdd S Digital power supply 88Vddio_1SI/O power supply99P A3IO Port A31010P A4IO Port A41111P A5IO Port A51212P A6IOPort A6Table 2 pinoutPin number (Cn2)Pin number (chip)Pin name T y p eMain function Alternate function125PE5IO Port E5SPI master / slave226PC1/TS1IOPort C1Timer 1 - channel 1 / UART2synchronous clock 327PC2/TS1_load IO Port C2Timer 1 - channel2428PC3IO Port C3Timer 1 - channel 3 529PC4IO Port C4Timer 1 - channel 4 630PC5IO Port C5SPI clock731Vssio_2S I/O ground 832Vddio_2S I/O power supply 933PC6IO Port C6SPI master out / slave in 1034PC7IO Port C7SPI master in / slave out1135PG0IO Port G01236PG1IOPort G1Daughterboard connectionUM081712/17Doc ID 16361 Rev 2Table 3.CN3 pinoutPin number (Cn3)Pin number (chip)Pin name T y p eMain function Alternate function113Vdda S Analog power supply 214Vssa S Analog ground 315PB7IO Port B7Analog input 7416PB6IO Port B6Analog input 6517PB5IO Port B5Analog input 5618PB4IO Port B4Analog input 4719PB3IO Port B3Analog input 3820PB2IO Port B2Analog input 2921PB1IO Port B1Analog input 11022PB0IO Port B0Analog input 01123PE7IO Port E7Analog input 81224PE6IOPort E6Analog input 9(2)Table 4.CN4 pinoutPin number (Cn4)Pin number (chip)Pin name T y p eMain function Alternate function137PE3IO Port E3Timer 1 – break Input 238PE2IO Port E2I2C data 339PE1IO Port E1I2C clock440PE0IO Port E0Configurable clock output 541PD0/LED IO Port D0Timer 3 - channel 2 642PD1/SWIM IO Port D1SWIM data interface 743PD2IO Port D2Timer 3 - channel 1 844PD3IO Port D3Timer 2 - channel 2 945PD4IO Port D4Timer 2 - channel 11046PD5IO Port D5UART2 data transmit 1147PD6IO Port D6UART2 data receive 1248PD7IOPort D7Top level interruptElectrical schematicsElectrical schematics15/17Revision history UM081716/17Doc ID 16361 Rev 25 Revision historyTable 5.Document revision historyDateRevisionChanges05-Oct-20091Initial release.12-Feb-20102Section 2.4: RC acquisition principle modified.UM0817Please Read Carefully:Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice.All ST products are sold pursuant to ST’s terms and conditions of sale.Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein.No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein.UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE, ST PRODUCTS ARE NOT RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY, DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER’S OWN RISK.Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST.ST and the ST logo are trademarks or registered trademarks of ST in various countries.Information in this document supersedes and replaces all information previously supplied.The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.© 2010 STMicroelectronics - All rights reservedSTMicroelectronics group of companiesAustralia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan - Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of AmericaDoc ID 16361 Rev 217/17。