Skip to content

Instantly share code, notes, and snippets.

@andrewsclapp
Created July 8, 2020 18:47
Show Gist options
  • Save andrewsclapp/8286ac972e05d02964cbbaf402a64e47 to your computer and use it in GitHub Desktop.
Save andrewsclapp/8286ac972e05d02964cbbaf402a64e47 to your computer and use it in GitHub Desktop.
Test Rx with INTRX at 2400
\ select the (STM8S) controller first (alt. STM8S105. STM8S207)
\res MCU: STM8L051
\ define the UART buffer length
8 CONSTANT RBLEN
\ then load the controller independent code
#require INTRX
\ put it to work
#require WIPE
#require :NVM
#require OSCFREQ
#require UART_DIV
#require UARTBRR
#require 'IDLE
NVM
'BOOT ( xt )
:NVM
INTRX
( xt ) LITERAL EXECUTE
;NVM 'BOOT !
\ calculate UART_DIV settings for 2400 baud at the CPU clock rate
240 OSCFREQ UART_DIV UARTBRR !
: rec1 ?RXP IF SPACE EMIT THEN ;
' rec1 'IDLE !
WIPE
RAM
#require PERSIST \ make it survive a RESET command
PERSIST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment