programming stm8s103

Install ST visual Develop
install STM8S_StdPeriph_Driver

create file with following code (after —– till net —-)
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 “STM8 COSMIC”

Now complie and full build should work


#define STM8S103
#include "stm8s.h"

void myDelay(int k);

void myDelay(int k)
{
int i,j;
for(i=0;iDDR |=0x20;// PB.5 as Output
GPIOB->CR1 |=0x20;// PB.5 as Push Pull Type Output

/* Infinite loop */
while (1)
{
GPIOB->ODR |=1<<5;// PB.5 = 1 OFF myDelay(5000); GPIOB->ODR &=~(1<<5);// PB.5 = 0 ON myDelay(500); GPIOB->ODR |=1<<5;// PB.5 = 1 OFF myDelay(500); GPIOB->ODR &=~(1<<5);// PB.5 = 0 ON myDelay(500); GPIOB->ODR |=1<<5;// PB.5 = 1 OFF myDelay(2000); GPIOB->ODR &=~(1<<5);// PB.5 = 0 ON myDelay(500); GPIOB->ODR |=1<<5;// PB.5 = 1 OFF myDelay(500); GPIOB->ODR &=~(1<<5);// PB.5 = 0 ON myDelay(500); GPIOB->ODR |=1<<5;// PB.5 = 1 OFF myDelay(500); GPIOB->ODR &=~(1<<5);// PB.5 = 0 ON myDelay(500); GPIOB->ODR |=1<<5;// PB.5 = 1 OFF myDelay(500); GPIOB->ODR &=~(1<<5);// PB.5 = 0 ON myDelay(500); // myDelay(5000); } } #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval : None */ void assert_failed(u8* file, u32 line) { /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* Infinite loop */ while (1) { } } #endif

IOT-generating data for integration of system parameters of ictuxen2 to carriots


# cat /root/bin/iot-carriots.sh

#!/bin/bash

#created by Byomkesh on 10-14Feb2018

echo '
v1 now
ictuxen2@byomkesh.byomkesh
' >/root/bin/data/iotdata.txt

/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL|grep -e Temp -e Slot|tr -s '\n' ' '|perl -e '$in=<>; $in =~ /Slot Number: ([^ ]*) .*Drive Temperature :[ ]*([^ ]*)C .*Slot Number: ([^ ]*) .*Drive Temperature :[ ]*([^ ]*)C .*Slot Number: ([^ ]*) .*Drive Temperature :[ ]*([^ ]*)C .*Slot Number: ([^ ]*) .*Drive Temperature :[ ]*([^ ]*)C .*Slot Number: ([^ ]*) .*Drive Temperature :[ ]*([^ ]*)C .*/; print "$1 $2 $3 $4 $5 $6 $7 $8 $9 $10"'|(read a b c d e f g h i j k; echo -n ''$b''$d''$f''$h''$j'';) >>/root/bin/data/iotdata.txt
/usr/sbin/isensor -s -g fan,temp,voltage,current|cut -d "|" -f 5,7|sed -e 's/ //g' -e's/\+//g' -e's/\%//g'|grep -e "C$" -e "V$" -e "A$" -e"RPM$"|tr -s '|' ' '|sed -e "s/C$//" -e "s/V$//" -e "s/A$//" -e"s/RPM$//"|while read a b c ; do a=`echo $a|tr '\.' '_'`; echo -n '<'$a'>'$b''; done >>/root/bin/data/iotdata.txt

echo '

' >>/root/bin/data/iotdata.txt

curl -s --request POST --data-binary @/root/bin/data/iotdata.txt --header "carriots.apikey:6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx6" --header "content-type:application/xml" http://api.carriots.com/streams 2>&1 >/dev/null

#curl -s --request POST --data-binary @/root/bin/data/iotdata.txt --header "carriots.apikey:6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx66" --header "content-type:application/xml" http://api.carriots.com/streams

# cat /root/bin/data/iotdata.txt