I am trying to use a DateTime Input in Ignition to send a "start time" and "Stop time" to a PLC via a modbus HRF register. The PLC is using a float representing the hours in a day, so 12.5 would be 12:30PM. It seems impossible to use a DateTime Input value for anything, no tags bind well to it.
I create a custom expression property in a DateTime Input that calculated the float I desired, but I can't figure out a method to send that to an OPC tag. Does any one have a recommendation for doing that?
Have you tried the
valueChange tag event on the expression tag? Just write the new value to the target OPC tag every time.
Or, perhaps, just script the conversion and tag write as part of the input form. Not everything has to go through a tag.
You are correct.
I kept the expression property in the DateTime to get the format I wanted, then I set up an event that every time the DateTime Input changed, it sent that to the UDT tag I had bound to the PLC. I will need to do something in reverse to the View has an updated number..something to look into.
I'm not sure I understand the problem but it should be easy enough to get decimal hours into a tag.
now(1000) causes it to update every second. In your case you'll be binding to the entered datetime rather than
Binding a float to the DateTime Input value parameter will not function at all, that's what the issue is. I did essentially what you have but through events and scripting because the tag I'm binding to has an OPC tag, so it can't be an expression and an OPC at the same time (that I know of).
Currently, I'm doing an embedded View like below, with a UDT. Operator can set the On/Off time during the day and the days of the week that it operates. I can get it going one direction (to PLC) but every time the view opens, it just shows what is in the default view which is not helpful. I think I should switch to something other than a DateTime Input component, it has not been user-friendly.