{"id":233,"date":"2018-02-14T09:43:09","date_gmt":"2018-02-14T09:43:09","guid":{"rendered":"http:\/\/byomkesh.in\/wordpress\/?p=233"},"modified":"2018-02-14T09:43:09","modified_gmt":"2018-02-14T09:43:09","slug":"programming-stm8s103","status":"publish","type":"post","link":"http:\/\/byomkesh.in\/wordpress\/programming-stm8s103\/","title":{"rendered":"programming stm8s103"},"content":{"rendered":"<p>Install ST visual Develop<br \/>\ninstall STM8S_StdPeriph_Driver<\/p>\n<p>create file with following code (after &#8212;&#8211; till net &#8212;-)<br \/>\ncopy stm8s_conf from STM8S_StdPeriph_Lib\\Project\\STM8S_StdPeriph_Template directory to your source directory<br \/>\ndownload adn install cosmic then<\/p>\n<p>set cosmic path e.g. C:\\Program Files (x86)\\COSMIC\\FSE_Compilers\\CXSTM8 under project->setting ->general ->rootpath and toolset as &#8220;STM8 COSMIC&#8221;<\/p>\n<p>Now complie and full build should work<\/p>\n<p><code><br \/>\n#define STM8S103<br \/>\n#include \"stm8s.h\"<\/p>\n<p>void myDelay(int k);<\/p>\n<p>void myDelay(int k)<br \/>\n{<br \/>\n       int i,j;<br \/>\n       for(i=0;i<k;i++)\n       {\n            for(j=0;j<100;j++);\n        }\n}\n\nvoid main(void)\n{ \n\tGPIOB->DDR |=0x20;\/\/ PB.5 as Output<br \/>\n\tGPIOB->CR1 |=0x20;\/\/ PB.5 as Push Pull Type Output  <\/p>\n<p>  \/* Infinite loop *\/<br \/>\n  while (1)<br \/>\n  {<br \/>\n\t\tGPIOB->ODR |=1<<5;\/\/ PB.5 = 1 OFF\n    myDelay(5000);\n    GPIOB->ODR &=~(1<<5);\/\/ PB.5 = 0 ON\n\t\tmyDelay(500);\n\t\tGPIOB->ODR |=1<<5;\/\/ PB.5 = 1 OFF\n    myDelay(500);\n    GPIOB->ODR &=~(1<<5);\/\/ PB.5 = 0 ON\n    myDelay(500);\n\t\tGPIOB->ODR |=1<<5;\/\/ PB.5 = 1 OFF\n    myDelay(2000);\n    GPIOB->ODR &=~(1<<5);\/\/ PB.5 = 0 ON\n\t\tmyDelay(500);\n\t\tGPIOB->ODR |=1<<5;\/\/ PB.5 = 1 OFF\n    myDelay(500);\n    GPIOB->ODR &=~(1<<5);\/\/ PB.5 = 0 ON\n    myDelay(500);\n\t\tGPIOB->ODR |=1<<5;\/\/ PB.5 = 1 OFF\n    myDelay(500);\n    GPIOB->ODR &=~(1<<5);\/\/ PB.5 = 0 ON\n\t\tmyDelay(500);\n\t\tGPIOB->ODR |=1<<5;\/\/ PB.5 = 1 OFF\n    myDelay(500);\n    GPIOB->ODR &=~(1<<5);\/\/ PB.5 = 0 ON\n    myDelay(500);\n\t\t\n\/\/\t\tmyDelay(5000);\n\t\t\n  }\n  \n}\n\n#ifdef USE_FULL_ASSERT\n\n\/**\n  * @brief  Reports the name of the source file and the source line number\n  *   where the assert_param error has occurred.\n  * @param file: pointer to the source file name\n  * @param line: assert_param error line source number\n  * @retval : None\n  *\/\nvoid assert_failed(u8* file, u32 line)\n{ \n  \/* User can add his own implementation to report the file name and line number,\n     ex: printf(\"Wrong parameters value: file %s on line %d\\r\\n\", file, line) *\/\n\n  \/* Infinite loop *\/\n  while (1)\n  {\n  }\n}\n#endif\n\n\n\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install ST visual Develop install STM8S_StdPeriph_Driver create file with following code (after &#8212;&#8211; till net &#8212;-) copy stm8s_conf from STM8S_StdPeriph_Lib\\Project\\STM8S_StdPeriph_Template directory to your source directory download adn install cosmic then set cosmic path e.g. C:\\Program Files (x86)\\COSMIC\\FSE_Compilers\\CXSTM8 under project->setting ->general ->rootpath and toolset as &#8220;STM8 COSMIC&#8221; Now complie and full build should work #define STM8S103 &hellip; <a href=\"http:\/\/byomkesh.in\/wordpress\/programming-stm8s103\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">programming stm8s103<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-233","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/byomkesh.in\/wordpress\/wp-json\/wp\/v2\/posts\/233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/byomkesh.in\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/byomkesh.in\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/byomkesh.in\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/byomkesh.in\/wordpress\/wp-json\/wp\/v2\/comments?post=233"}],"version-history":[{"count":1,"href":"http:\/\/byomkesh.in\/wordpress\/wp-json\/wp\/v2\/posts\/233\/revisions"}],"predecessor-version":[{"id":234,"href":"http:\/\/byomkesh.in\/wordpress\/wp-json\/wp\/v2\/posts\/233\/revisions\/234"}],"wp:attachment":[{"href":"http:\/\/byomkesh.in\/wordpress\/wp-json\/wp\/v2\/media?parent=233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/byomkesh.in\/wordpress\/wp-json\/wp\/v2\/categories?post=233"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/byomkesh.in\/wordpress\/wp-json\/wp\/v2\/tags?post=233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}