Replies: 1 comment
-
You certainly refer to https://github.com/TG9541/stm8ef-modbus ... there a binary release exists that does something useful (please look for /out/C0135/C0135-forth.ihx). Using the Forth console you can easily add "action handlers" similar to what's done in C0135/board.fs: \ headerless code Preparation Handler
:NVM
IN@ inputs !
;NVM ( xt-pre ) \ compile time: keep this eXecution Token on the stack
\ headerless code Action Handler
:NVM
coils @ OUT!
;NVM ( xt-act ) \ and also this Reading ADCs and writing them to "holding registers" requires just a few additional lines of code in the "Preparation Handler": \ headerless code Preparation Handler
:NVM
IN@ inputs !
4 ADC! ADC@ holding !
3 ADC! ADC@ holding 2+ !
;NVM ( xt-pre ) \ compile time: keep this eXecution Token on the stack |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thanks for this modbus work. From the documentation, it appears that the MODBUS functions and communication are independent from Forth console, but are combined on the same serial port. But it is still unclear how the image switches from modbus messages and Forth commands? Is there any modbus command which switches to Forth and Forth command to switch back to Modbus? Some more details on how it works for novice would help. Also, is it possible to call the NVM-based Forth problem by Modbus and return the result in Modbus register?
Another question: is there a precompiled image which reads ADCs and GPIOs in response to Modbus messages (register read?) and returns data in Modbus message (not in Forth console)?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions