mb2hal feedback

More
14 Oct 2024 09:39 - 14 Oct 2024 14:30 #312049 by FedX
mb2hal feedback was created by FedX
Hi all,

i'm thinking of the best way to trigger an EEPROM write command on an ESP32. 

If i send a Fc06 to adress 200 with data = 1 it triggers the writing routine and sends back a value of 0.
As the mb2hal triggers all transactions cyclical i need to make sure, that it only sends a 1 to adress 200 once. 

I would like to use a hal toggle button. checked sets the PIN to the saving transaction high. Now the question is how can i use the answer to trigger io of the button to 0 ? 

I don't know if it is possible to use the transaction feedback at all.. 
There are a couple of solutions i think of, for example a timer solution. As i know the refresh rate i could use a timer which deactivates the button after a couple of seconds and use another timer in my ESP32 to only allow a storage in the same time window.. 
Or i create a fc03 for adress 200 which sends 0x01 if storing was succesful and use a logic to set back the button -> if button checked and fc03 adr200 is 1 -> button.io = 0 which should release the button as soon as the values are written.. 

just found out that for a halbutton checked state is readOnly.. How can i uncheck a button via a hal pin?
I think i will use a flipFlop for my saving issue. Clicking the buttons sets the output to high and a high signal from 06 200 sets it back to zero

current solution looks like that there might be a better way, but at least its working:
loadusr -Wn ESP32_mb mb2hal config=mb2halESP32.ini

#Komponenten
loadrt flipflop names=ESP_Save_FlipFlop
loadrt conv_s32_bit count=1
loadrt conv_bit_float count=1

addf ESP_Save_FlipFlop servo-thread
addf conv-s32-bit.0 servo-thread
addf conv-bit-float.0 servo-thread

net valuesStoredToBool ESP32_mb.MMS_store.valuesStored.int => conv-s32-bit.0.in
net triggerSaveCommand qtpyvcp.mms.storevalues.out => ESP_Save_FlipFlop.set
net setSaveCommand ESP_Save_FlipFlop.out => conv-bit-float.0.in
net triggerStoreValuesESP conv-bit-float.0.out => ESP32_mb.command.store.ESP_StoreValues
net resetSaveCommand ESP_Save_FlipFlop.reset <= conv-s32-bit.0.out

br


 
Last edit: 14 Oct 2024 14:30 by FedX.

Please Log in or Create an account to join the conversation.

More
22 Oct 2024 13:57 #312860 by bkt
Replied by bkt on topic mb2hal feedback
use classicladder ... all more easy

Please Log in or Create an account to join the conversation.

Time to create page: 0.106 seconds
Powered by Kunena Forum