multiply float variable with constant in hal

More
16 Apr 2010 21:37 #2619 by ben5446
Im trying to multiply a float variable before coverting it to s32 to bring into ladder logic. Can someone tell me what is the syntax to do this in the hal io file?

Thanks

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

More
17 Apr 2010 07:07 #2620 by cmorley
here is the general idea:

# load the component count equals how many you want
loadrt mult2 count=1
# add component to a thread (pick a valid threadname)
addf mult2.0 thread1
# input_signal
net input_signal mult2.0.in0
# constant of 100 to multiply by
setp mult2.0.in1 100
# connect it to classicladder. CL will demote float to S32 internally
net mult2.0.out classicladder.0.floatin-00

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

More
18 Apr 2010 16:46 #2622 by ben5446
That worked like a charm.

Thanks

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

Time to create page: 0.068 seconds
Powered by Kunena Forum