06 -01-2019, 02:18 PM
Hi,
I changed my robot driver according to Albert's suggestion in order to support analog output ->Related Thread
For testing purposes I created a program using the RoboDK GUI and noticed that RoboDK seems to treat the IO-value as an integer. Please see the screenshots attached.
When using decimals I get 0V output voltage for the given examples. As a workaround I multiplied the values by 1,000,000 and transformed them to integers. Inside the robot driver I divide them by 1,000,000 again and everything works fine.
It is not necessarily a bug, more like a suggestion for improvement. It would be comfortable if the IO-instructions would accept decimal values straightforward.
I changed my robot driver according to Albert's suggestion in order to support analog output ->Related Thread
For testing purposes I created a program using the RoboDK GUI and noticed that RoboDK seems to treat the IO-value as an integer. Please see the screenshots attached.
When using decimals I get 0V output voltage for the given examples. As a workaround I multiplied the values by 1,000,000 and transformed them to integers. Inside the robot driver I divide them by 1,000,000 again and everything works fine.
Code:
CASE 10
COM_ACTCNT = COM_ACTCNT + 1
io_id = COM_VALUE1
IF io_id >= 20 THEN
COM_VALUE2 = COM_VALUE2 / 1000000
$ANOUT[io_id] = COM_VALUE2
ELSE
IF COM_VALUE2 > 0.5 THEN
$OUT[io_id] = TRUE
ELSE
$OUT[io_id] = FALSE
ENDIF
ENDIF
COM_ACTION = 0
It is not necessarily a bug, more like a suggestion for improvement. It would be comfortable if the IO-instructions would accept decimal values straightforward.