This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
: Clrdisplay ( -- ) \ clear anything showing | |
32 E7S 32 E7S 32 E7S ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\ STM8 eForth interactive RC-servo demo | |
\ set compilation target for STARTTEMP / ENDTEMP | |
: TARGET NVM ; | |
#require hw/pwm.fs | |
#require OPT! | |
#include STARTTEMP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\ The HC-SR04 "trig" pin is connected to the SET key input (PC3). | |
\ The "echo" pin is connected to the same GPIO with a 1k resistor | |
\ Uses TIM1 with 1µs clock -> 3.4mm resolution. | |
#require ]B! | |
\res MCU: STM8S103 | |
\res export PC_DDR PC_ODR PC_CR1 | |
\res export TIM1_PSCRH TIM1_SR1 TIM1_CCMR3 TIM1_CCMR4 TIM1_CCER2 TIM1_CR1 | |
\res export TIM1_CCR3HTIM1_CCR4H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\ STM8 eForth ECHO | |
\ Make local echo in STM8 eForth optional | |
\ Note1: since this code patches TAP, and sets the startup word, | |
\ it should be loaded with #require ECHO | |
\ Note2: the RAM address of variable TAPECHO must be below 0x0100, | |
\ it's recommended to #require ECHO early on in the main file | |
\ Note3: this file sets the 'BOOT vector for initializing TAPECHO - | |
\ any startup code must execute this task! | |
#require TAP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RAM | |
#require TOKEN | |
#require >IN | |
#require .ID | |
#require .0 | |
NVM | |
: GET ( string -- ) | |
\ interpretion semantics: get and print variable | |
>IN @ TOKEN CR .ID ." =" | |
>IN ! ' EXECUTE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#require <# | |
\ #require $," | |
#require $" | |
\ #require $"| | |
#require # | |
#require #> | |
\ #require 0 | |
\ #require 1 | |
\ #require -1 | |
#require 2DROP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; STM8EF Global Configuration File | |
; Minimal config for STM8S Value Line, defaults with few extras (e.g. NVM) | |
HAS_CPNVM = 1 ; Can compile to Flash, always interpret to RAM | |
BAREBONES = 1 ; Remove or unlink some more: hi HERE .R U.R SPACES @EXECUTE AHEAD CALL, EXIT COMPILE [COMPILE] | |
WORDS_EXTRACORE = 1 ; Extra core words: =0 I | |
WORDS_EXTRAEEPR = 1 ; Extra EEPROM lock/unlock words: LOCK ULOCK ULOCKF LOCKF | |
; RESET RAM NVM LOCK ULOCK WORDS .S DUMP IMMEDIATE ALLOT VARIABLE CONSTANT CREATE ] : ; | |
; OVERT ." AFT REPEAT WHILE ELSE THEN IF AGAIN UNTIL BEGIN NEXT FOR LITERAL C, , ' CR [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#require PAD | |
: SP@ ( -- a ) \ push current stack pointer | |
[ $9093 , \ LDW Y,X | |
$5A C, \ DECW X | |
$5A C, \ DECW X | |
$FF C, ] \ LDW (X),Y | |
; | |
: dict.free SP@ PAD - . ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\res MCU: STM8S103 | |
\res export PA_ODR | |
\res export PA_DDR | |
\res export PA_CR1 | |
\res export PC_DDR | |
\res export PC_CR1 | |
#require ]B! | |
1 CONSTANT _COL \ PA1 low side KTY10 solar collector |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\ W1209 temperature measurement with filter and noise suppression | |
\ © 2017 TG9541, refer to https://github.com/TG9541/W1209/blob/master/LICENSE | |
\ Note: W1209 thermostats may require adjustment, | |
\ especially when used outside the range of -5C to +20C | |
\ Refer to https://github.com/TG9541/W1209/wiki/W1209-Sensor | |
RAM | |
900 CONSTANT USENSMAX \ max temperature |
OlderNewer