Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support board "modbus_relay8" #40

Open
TG9541 opened this issue May 13, 2021 · 1 comment
Open

Support board "modbus_relay8" #40

TG9541 opened this issue May 13, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@TG9541
Copy link
Owner

TG9541 commented May 13, 2021

A MODBUS board with the name "modbus_relay8 v1.2" arrived a few days ago:
image
It has an STM8S103K3T6C, an LM2596-5V switching power supply (7..30V, 2-3A), 8 relays and 8 insulated inputs. The usual price is at $15.

I made a Gist with Forth code for I/O based on SWIMCOM. GPIOs for I/O are documented in the code.

Other GPIOs traced so far are:

GPIO usage
PA1 Q (crystal not populated)
PA2 Q (crystal not populated)
PB6 S2 (key)
PB7 LED (not populated)
PD7 RS485 direction
@TG9541 TG9541 self-assigned this May 13, 2021
@TG9541 TG9541 added the enhancement New feature or request label May 13, 2021
@TG9541
Copy link
Owner Author

TG9541 commented Jul 11, 2022

This works with the latest deferred BUSCTRL:

\ STM8EF-MODBUS eForth RS485 bus control for RS485 board RelayX8 

\res MCU: STM8S103
\res export PD_ODR PD_DDR PD_CR1

#require ]B!

NVM
  \ Set RS485 Driver to "RX"
  : rx ( -- )
    [ 0 PD_ODR 7 ]B!
  ;

  \ Set RS485 Driver to "TX"
  : tx ( -- )
    [ 1 PD_ODR 7 ]B!
  ;

  \ Initialize GPIO and RS485 Driver
  : CTRL ( -- )
    BUSrx
    [ 1 PD_DDR 7 ]B!
    [ 1 PD_CR1 7 ]B!
  ;

  ' rx is BUSrx
  ' tx is BUStx
  ' ctrl is BUSctrl
RAM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant