STM8 Led blinking | STM8S assembly Language bare metal from scratch | STM8S led blinking

Опубликовано: 30 Март 2020
на канале: Abdul Rehman 2050
2,564
29

This stm8 cosmic tutorial for stm8 led blinking tutorial is made to teach basic stm8 assembly instructions and usage of scratch ram for creating variable.
STM8S Programming tutorial in Assembly language bare metal programming we used ram0 variable declaration in assembly language of stm8s microcontrolllers. We used stm8s103f3 based bluepill board. Same code will work in any similar STM8S microcontrollers.
Here is complete code used in this tutorial

stm8/

#include "mapping.inc"
segment 'rom'

;==============================
PB_DDR EQU $5007
PB_CR1 EQU $5008
PB_ODR EQU $5005

R0 EQU $0
R1 EQU $1
R2 EQU $2
;---------------------------------
BSET PB_DDR,#5 ;FORCE PB_DDR,5=1; OUTPUT
BSET PB_CR1,#5
MAIN
BCPL PB_ODR,#5
CALL DELAY3
JRA MAIN


DELAY3:
MOV R2,#5
D3L3: ;5*255*255
MOV R1,#255
D3L2: ;255*255
MOV R0,#255
D3L1:
DEC R0
JRNE D3L1

DEC R1
JRNE D3L2

DEC R2
JRNE D3L3
RET


;==============================
end