Skip to content

C0135 beta 0.19 - "viable MODBUS RTU"

Compare
Choose a tag to compare
@TG9541 TG9541 released this 01 May 07:57
c033cd6

C0135 binary created with STM8 simulation in uCsim on Travis-CI. Tested on a "4-Relay" board V1.06.

Here is a screenshot of QModMaster:
image

Features:

  • As of #30, FC03, FC06 and FC15 the MODBUS address mapping is as follows:
MB address register MODBUS Forth
0 holding 1 holding
1 .. 59999 holding 2 holding 2+
60000 node ID $4000
60001 baud rate $4002
60002 .. 60319 user EEPROM $4004 - $43FE STM8S EEPROM
  • bitfield operations for Little Endian (i.e. "MODBUS packed bits") and Big Endian (i.e. "MODBUS registers") make better FC01, FC02, FC05 and FC15 possible. Refer to the following commits:
    • #28 FC05 addressing off-by-one (also large bitfields)
    • #25 Make FC03 and FC04 compatible with the new FC01 and FC02
    • #23 Use bitfield addressing to improve FC-1 and FC-2
    • #19 FC15 "Write Multiple Coils" not working
  • Add IN@ to actually read C0135 inputs, refer to issue issue #20 and to this HaD log entry
  • EEPROM Initialization w/o console: press and hold S2 during reset (refer to #17)
  • Relais 1..4 and LED as "single coil" address 0 .. 4
  • Forth console on PD1/SWIM 9600 baud

image

See #12 for discussion of missing or planned features (e.g. initial setting of Node-ID and baud rate).

Note: the tgz archive is recommended for general MODBUS use and for Forth programming. The included binary can be flashed with stm8flash -c stlinkv2 -p stm8s103f3 -s flash -w out/C0135/C0135-forth.ihx. If you're using Windows, STVP-STM8 may help.