Skip to content

Instantly share code, notes, and snippets.

View TG9541's full-sized avatar

Thomas TG9541

View GitHub Profile
@TG9541
TG9541 / BF!.asm
Last active April 25, 2020 10:22
Notes on BF! (version with X as the working register) and BF@ (Little Endian)
; starting from B! ( t a u -- )
; t a u
; 1 $100 7
; bit# Addr Bool
; 00 01 01 00 FF FF
; == --- ===== =====
; 72 1F 01 00 81 FF
; X 1,X 2,X 4,X
@TG9541
TG9541 / codeload3.py
Last active October 11, 2021 10:07
Experimental port of STM8 eForth codeload.py from Python2.7 to Python3
#!/usr/bin/env python3
#
# codeload3.py - a mostly e4thcom compatible Forth loader
#
# The MIT License
#
# Copyright (c) 2020 TG9541
#
# Permission is hereby granted, free of charge,
# to any person obtaining a copy of this software and
@TG9541
TG9541 / DCDC-MH.md
Last active December 24, 2019 21:24
Notes for DCDC-MH
Pin	STM	 Connected to
1	PD4	 dig 1
2	PD5	 seg A
3	PD6	 seg F
4	NRST  R - VSS
5	PA1	 seg DP
6	PA2	 seg D
7	VSS	 GND
8	Vcap Cap
@TG9541
TG9541 / ntctheta
Created March 17, 2019 20:26
W1209 style NTC sensor signal to temperature conversion with LPF and un-chatter (GND -- NTC -(Ain)- 20k -- VCC)
\ 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
@TG9541
TG9541 / SerialAscCoilsTest.java
Created February 23, 2019 17:12
JAMOD FC01 "Read Coils" with MODBUS ASCII protocol
/**
* Copyright 2002-2010 jamod development team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@TG9541
TG9541 / USBaspLoader-for-USBasp.hex
Created January 12, 2019 11:05
An USBaspLoader modified to work on a USBasp dongle. Plug in with JP1 closed to start in USBaspLoader mode. Of course, the USBasp firmware can be loaded onto the USBasp with the USBaspLoader :-)
:101800004BC07FC064C063C062C061C060C05FC0C5
:101810005EC05DC05CC05BC05AC059C058C057C0F4
:1018200056C055C054C00000EC2DFD2DB7B6B0FC1D
:10183000FDCF27BFE895B7B6B0FCFDCF21E1B7B625
:10184000B6FCF4CF089509021200010100803209AC
:10185000040000000000000012011001FF00000859
:10186000C016DC050201010200010E035500530001
:1018700042006100730070001C037700770077005E
:101880002E00660069007300630068006C002E0083
:10189000640065000403090411241FBECFE5D4E0F1
@TG9541
TG9541 / BUSCTRL
Last active January 17, 2019 05:38
Very simple but extensible MODBUS server for STM8 eForth
\ STM8 eForth C0135 bus control for RS485 - MODBUS
\res MCU: STM8S103
\res export PB_ODR PB_DDR
#require ]B!
NVM
\ Set RS485 Driver to "RX"
: BUSrx ( -- )
@TG9541
TG9541 / MBPROTO
Created January 5, 2019 23:44
MODBUS protocol implementation
#require UARTISR
#require CRC16
#require ]B!
#require WIPE
NVM
: mbslv ( -- c )
;
\ get MODBUS FC
@TG9541
TG9541 / MBCRC
Created January 2, 2019 16:56
STM8 eForth dependencies of MBTEST
#require UARTISR
#require CRC16
#require WIPE
NVM
: mbslv ( -- c )
rxbuf C@
;
: mbfc ( -- c )
@TG9541
TG9541 / SerialDOTest.java
Created January 2, 2019 16:35
CLI test for MODBUS RTU FC05 "Write Single Coils" with JAMOD
/**
* Copyright 2002-2010 jamod development team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software