Hello world example
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-12-30 7:00 AM
Posted on December 30, 2011 at 16:00
Hi there !
I am anewbie
in ST microcontroller. 1) Tobeginning, I bought : * Ahttp://www.st.com/internet/evalboard/product/251jsp
(with a stm8l101K3 MCU) * A kit (with the Ride7developmentenvironment) 2)So, my issue:
programming a hello world soft
for my MCU. In other words: To make a short software todetect an analog input DC voltage
(3.3V DC on comparative inputs ) 3) What I have already done:#include ''stm8l10x.h''
#define MyGPIO (GPIOB)
#define MyPin(GPIO_Pin_All)
void
main(
void
){
uint8_t C=0;
uint8_t My;
while
(1) {
GPIO_DeInit(MyGPIO);
GPIO_Init(MyGPIO, MyPin, GPIO_Mode_In_FL_No_IT);
My = GPIO_ReadInputDataBit(MyGPIO, MyPin);
C++;
}
}
But : When I run this example, and use a strap to powereed with a 3.3 V DC inputs of the MCU, nothings occurs... Just the unint8_t C counter works.
Anybody can explain-me how to develop a simple soft to detect the input voltage in an analog input pin of the MCU ?
NB: Yes, I havealready downloaded some example in the internet (st website and ride example). The main issue for myself is tounderstandhow a microcontroller works, I2C, SPI, comparator etc. I have just one experience with MCU (mbed NXP product). Regards, GM
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-01-02 7:49 AM
Posted on January 02, 2012 at 16:49
Hi,
You need to use the ADC in order to measure the analog input voltage.In the RidE7 installation directory, go to Examples\STM8\ST_Libraries\STM8L15x_StdPeriph_Lib-v1.5.1 (adapt if you are using an older version) and check the ADC examples. You will have plenty of information there!Best regards,BrunoOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-01-06 1:39 PM
Posted on January 06, 2012 at 22:39
Hi ! Thanks for your answer.
STM8L15x_StdPeriph_Lib runs on the STM8L
101
K3 ? Or there is no ADC on the sm8l101 ?Regards,
GM