multiply float variable with constant in hal
16 Apr 2010 21:37 #2619
by ben5446
multiply float variable with constant in hal was created 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
Thanks
Please Log in or Create an account to join the conversation.
17 Apr 2010 07:07 #2620
by cmorley
Replied by cmorley on topic Re:multiply float variable with constant in hal
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
# 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.
18 Apr 2010 16:46 #2622
by ben5446
Replied by ben5446 on topic Re:multiply float variable with constant in hal
That worked like a charm.
Thanks
Thanks
Please Log in or Create an account to join the conversation.
Time to create page: 0.166 seconds