Patrick Fitzgerald
Published © GPL3+

Assembly Language Program STM8 Development Board with STVD

Thomson Semiconductor makes the STM8 series of MCUs. STVD Visual Design Studio program comes ready to assembly program ST7 and STM8 chips.

AdvancedProtip2 hours89

Things used in this project

Hardware components

STM8S103F3P6/STM8S003F3P6 minimum development board
×1
STM8S103K3T6 core development board minimum
×1
st-link v2 programmer
×1

Software apps and online services

ST Visual Develop
STVP ST Visual Programmer

Story

Read more

Code

main.asm

Assembly x86
STM8 Assembly language program that compiles on STVD
Runs on STM8S chips
stm8/
	MOTOROLA	
	WORDS		; following addresses are 16-bit length
	segment byte at 8080-9FFF 'rom'	; 8Kb
; PB5 for Small BOARD STM8S003F3P6
; PC3 for Big   BOARD STM8S103K3T6
.main
    MOV     $50c6, #0 ; CLK_CKDIVR = $50c6 clock value
    BSET    $5007, #5 ; PB_DDR = $5007 ; PB_DDR|=(1<<PB5)
    BSET    $5008, #5 ; PB_CR1 = $5008 ; PB_CR1|=(1<<PB5)
    BSET    $500c, #3 ; PC_DDR = $500c ; PC_DDR|=(1<<PC3)
    BSET    $500d, #3 ; PC_CR1 = $500d ; PC_CR1|=(1<<PC3)
main_loop:
    bcpl    $5005, #5 ; PB_ODR = $5005 ; PB_ODR^=(1<<PB5)	
    bcpl    $500a, #3 ; PC_ODR = $500a ; PC_ODR^=(1<<PC3)
	call    	delay
    jp      main_loop	
delay:
    ld 	    a, #$30 	; #$30 hex for 48 decimal
    ldw     y, #$d400 ; #$d400 hex 54272 decimal
loop:
    subw    y, #$01 	; decrement with set carry
    sbc     a, #0 		; decrement carry flag_flag
    jrne    loop
	ret
    end
    	

Credits

Patrick Fitzgerald

Patrick Fitzgerald

100 projects • 28 followers

Comments