EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint -...
Transcript of EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint -...
![Page 1: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/1.jpg)
0101
STM8 e.z.t.
pdfMachine by Broadgun Software - a great PDF writer! - a great PDF creator! - http://www.pdfmachine.com http://www.broadgun.com
![Page 2: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/2.jpg)
0202
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
![Page 3: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/3.jpg)
0303
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
The faster and simpler way to use the Examples in the STM8 library (Rel.1.1.1)is to create a new folder copying inside the STM example file. In the followingslide you will see how to do it:
![Page 4: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/4.jpg)
0404
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
Just start with the following assumptions:
We will write code using COSMIC C Compiler 16KFree and STM IDE
We assume that STM libraties have been extracted in the directory:�\STM8SFWLib111\FWLib
We assume that working directory is: �\STM8S208_ADC
![Page 5: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/5.jpg)
0505
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
Now copy directories �\STM8SFWLib111\FWLib
Into our working directory �\STM8S208_ADC
![Page 6: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/6.jpg)
0606
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
STEP n.1
Our starting example is: ADC2_ContinuousConversion You can find it in the following directory: �\STM8SFWLib111\FWLib\examples\ADC2\ADC2_ContinuousConversion
![Page 7: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/7.jpg)
0707
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
STEP n.2
From directoty: �\STM8SFWLib111\FWLib\examples\ADC2\ADC2_ContinuousConversionCopy the following files :main.cmain.hstm8s_conf.h stm8s_it.hstm8s_it.c
Into our working directory:�STM8S208_ADC\STM8SFWLib\FWLib\project
![Page 8: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/8.jpg)
0808
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
STEP n.3
Now run ST Visual Develop
Just open our project clicking on File and thenOpen Workspace.
Project to load will be in the directory you can seebelow.�\STM8S208_ADC\project\STVD\Cosmic
![Page 9: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/9.jpg)
0909
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
STEP n.3/cont.
Once that project is open youshould have a video as it is herebeside
We are using the following demo board: SILICA-STM8/128-EVAL thatincludes STM8S208 device, so we can delete the followingdirectory:stm8s207/105/103/903
![Page 10: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/10.jpg)
010010
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
STEP n.4
Now you have to expand folder stm8s208adding the following two files:stm8s_gpio.cstm8s_adc2.cTo do this please right click on Source Filesand select Add FIles to Folder�(see example).
![Page 11: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/11.jpg)
011011
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
STEP n.4/cont.
go in the following directoty: �\STM8S208_ADC\library\srcAnd select files like the example below, then click OPEN
![Page 12: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/12.jpg)
012012
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
STEP n.5
Now Compile the project clicking on this iconYou should get 0 errors and 0 warnings as the example below.
![Page 13: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/13.jpg)
013013
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
STEP n.5/cont.
To check application we just haveto enter in the DEBUG mode.
If it is the first use of the debugYou should select the HW tool youWant to use
To do this click onDebug instrument and selectTarget SettingsIn the new windowselect Swim Rlink(see example beside)
![Page 14: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/14.jpg)
014014
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
STEP n.5/cont.
To enter in DEBUG you have to click on the following icon:
If everything is OK you should see that turning potentiometer on the eval board leds will switch on in sequence.
![Page 15: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/15.jpg)
015015
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
STEP n.6
The main availableCommands in Debug mode are:
![Page 16: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/16.jpg)
016016
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
STEP n.6/Cont.
Watch VariablesSelect variable you want to watchThen right click on Quickwatch
click AddWatch , a new window withvariables will appare.
![Page 17: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/17.jpg)
017017
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
STEP n.6/Cont.
Vatch Variables On FlyIf you want to wath variable content in real timeYou have to click on the variable and select:ReadWrite On Fly
Variables box will change color and variablesvalues will change in real time
![Page 18: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/18.jpg)
018018
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
STEP n.6/Cont.
BreakPointTo insert a breakpointMove on the interestedCode line. Left click withmouse beside line label.A red marker will appare ,Indicating that BreakpointIs set.
![Page 19: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/19.jpg)
019019
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
IMPORTANT NOTES
It is very important to check the following files configuration:stm8s.hstm8s_conf.hFollwing you will see a brief explaination of the two files.
![Page 20: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/20.jpg)
020020
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
stm8s.h
Il file stm8s.h defines the MCU we want to use in our project.Please check rows from 44 as reported below.
#if !defined (STM8S208) && !defined (STM8S207) && !defined (STM8S105) && !defined (STM8S103) && !defined (STM8S903)/* #define STM8S208 */#define STM8S207/* #define STM8S105 */ /* #define STM8S103 *//* #define STM8S903 */
#endif
If you want to use another MCU model (ex. STM32F207) just removecomment from the interested line (see the line in bold)
![Page 21: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/21.jpg)
021021
STM8 Usare gli esempi di libreria di STM8 (Libreria ver.1.1.1)
stm8s_conf.h
file stm8s_conf.h enbles all peripheral we want to use and specify clock frequency.Perpheral enable should be done removing comment on the interestedperipheral. It is also important to include enabled peripheral source files in ourProject:
ESEMPIO:Periferica Abilitata
/************************************* SPI ************************************/#define _SPI (1)Periferica Disabilitata
/************************************* SPI ************************************/// #define _SPI (1)
![Page 22: EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from ... · Microsoft PowerPoint - EndZone-UsareLaLibreria-STM8.ppt - pdfMachine from Broadgun Software, , a great PDF writer utility!](https://reader031.fdocuments.in/reader031/viewer/2022021810/5c6baccf09d3f2ff0e8be47c/html5/thumbnails/22.jpg)
022022
LINK
ST-MCUhttp://www.st.com/mcu/index.htmlSTM8Shttp://www.st.com/mcu/inchtml-pages-stm8s.htmlDocuments and files for family STM8Shttp://www.st.com/mcu/modules.php?name=mcu&file=familiesdocs&FAM=113STM8Lhttp://www.st.com/mcu/inchtml-pages-stm8l.htmlDocuments and files for family STM8Lhttp://www.st.com/mcu/familiesdocs-120.htmlTouch sensing software suite http://www.st.com/mcu/inchtml-pages-touch_sense_sw_lib.htmlMCU Training & Seminarshttp://www.st.com/mcu/inchtml-pages-mcu_train.htmlSTM8 examples:http://emcu.altervista.org/