2020-06-23 07:31 AM
2020-06-23 07:52 AM
Using what compiler?
Check the manual for "inline assembly/assembler"
2020-06-23 07:53 AM
https://lujji.github.io/blog/mixing-c-and-assembly-on-stm8/
2020-06-23 11:05 AM
Thanks for the reply, Let me try it. So far I was using ATMEL. This is my first try with ST. I am using STVD with cosmic compiler. Meanwhile can you please check, whats wrong with this. It is giving error.
#include <stm8s103k.h>
#include <stm8.h>
#define LED_PORT PD
#define LED_PIN PIN3
static const _flash uint8_t Digits[4] = { 0B01111110, 0B00001100, 0B10110110, 0B10011110 };
int main(void) {
unsigned long count;
CLK_CKDIVR = 0B00001000;
PORT(LED_PORT, DDR) |= LED_PIN; // i.e. PB_DDR |= (1 << 5);
PORT(LED_PORT, CR1) |= LED_PIN; // i.e. PB_CR1 |= (1 << 5);
while(1) {
PORT(LED_PORT, ODR) |= LED_PIN; // PB_ODR |= (1 << 5);
count = 100000L;
while (count > 0)
{ count--; }
PORT(LED_PORT, ODR) &= ~LED_PIN; // PB_ODR &= ~(1 << 5);
count = 100000L;
while (count > 0)
{ count--; }
}
return(0);
}
2020-06-23 12:22 PM
Does it accept binary constants?
2020-06-23 05:30 PM
Yes it does. I used it again CLK_CKDIVR = 0B00001000; in line-12.
2020-06-23 05:45 PM
Sir, one more reason I might be overlooking. It is showing a message at startup. Can you please check this.
2020-06-23 06:27 PM
Dear Sir, I changed the settings to ST Assembler Linker instead of Cosmic, and it compiled well. No errors. Now can I program this file with S19 extension directly to my chip ????