Learner Learner - 2 months ago 19
C Question

Assembly instruction in STVD IDE for STM8 microcontroller

I'm programming

STM8
micro controller in
STVD
. I happen to use an assembly instruction in the middle of code. As shown here

I used a instruction as below

asm("MOV $00500A,#$3");


But I'm facing with following error

#error cpstm8 ..\app\sched.c:183(5) missing prototype


Can anyone help me in fixing this?

Answer

For STM8 assembly instruction, you need to use _ before the instruction as shown below

 _asm("MOV $00500A,#$3");