Configuring Analog inputs
I have created a subsystem to scale analog inputs so you can use either 0-10V or 4-20mA. It even has a parameter to turn on a TRND block. Can this be done on the Monarco HAT given how the flags are already separate configurations? I'm building a generic logger and would like the analog input to be software configurable if possible. This way I can use either V or mA transducers and and not have to change the code, just use the HMI to configure it.
After posting earlier I wondered if something like this would be better?
Not having the unused input flag showing an alarm might be tricky?
thanks for your question. Good job - your latest proposed solution makes sense. Just one small remark:
For now it is possible to have ranges just 0-10V or 4-20mA. It is not possible to switch to 0-5V.
Let me know if I can be of assistance.
Will the unused flag produce an error or alarm in the system log?
I’ve also removed the 0-5v option
I wasn't 100% right, sorry for that.
It is prohibited to use both flags for AI at the same time by the compiler. The solution is not that straightforward however it is possible:
- use just "MNR_AI1" flag
- to set the current mode use SDC write flag, address 0x00A - bits 01 and 02 (see docs: https://github.com/monarco/monarco-hat-documentation/blob/master/Monarco_HAT_SPI_Protocol.md#service-channel-register-description)
- when in current mode you need to manually convert the value by following formula 10V = 52.475 mA
If you need any additional help, let me know.