LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing the Duty Cycle (PWM) with buttons

Solved!
Go to solution
Solution
Accepted by topic author H1636

Hi H1636,

 

there are several problems in your VI:

- overuse of local variables: all of them can (and should!) be replaced by wires!

- the case selector values are wrong: when dealing with bits you should have cases of 0, 1, 2, 4, and 8. (Even better: set the display mode of the case values to binary display…)

- you need to limit the "progress bar" (or better: the value in the shift register) to a range of 0…1

- you don't need an additional numeric indicator for your progress bar: just enable its own numeric display!

 

Something like this:

check.png

You still should implement the event structure!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 11 of 20
(1,230 Views)

Hi GerdW, it looks my problem almost solved. Can you please sent me the Vi if possible 🙂 

I really need it

 

Best,

Osman

0 Kudos
Message 12 of 20
(1,220 Views)

Hi H1636,

 

I didn't save the VI, so please don't ask by PM.

It's a snippet anyway, so just download it!

(Or follow my comments to improve on your own.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 13 of 20
(1,219 Views)

Hi GerdW,

I did everything you showed above. Here is the result: While the duty cycle has data, the buttons only work for wait time I set inside a loop. So, it does not work as I want 😞

I really need help,

FN: Those who created a vi to help this issue, please upload the file. I am not sure if the problem occurs because of my computer.

0 Kudos
Message 14 of 20
(1,213 Views)

Hi H1636,

 

you did not:

- change the case selector values

- replace ALL local variables by wires

- replace that additional numeric indicator by the digital display of the progress bar

Please do that…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 15 of 20
(1,210 Views)

Hi GerdW,

 

? - change the case selector values

Done - replace ALL local variables by wires

Done - replace that additional numeric indicator by the digital display of the progress bar

 

1.PNG

Button 1 & 2 are working fine, but I cannot say the same thing for 3 & 4. 3 problems left. 

1 - Default value is the duty cycle value,

2 - Decrement by the duty cycle value with button 3,

3 - Make the value "0" with button 4,

 

I think these are the final problems 🙂 You did really great

0 Kudos
Message 16 of 20
(1,212 Views)

Hi H1636,

 

you need to change the case selector values!

Do some debugging of your VI: which integer value results from pressing buttons 3 and 4?

After checking this reread my previous messages…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 17 of 20
(1,207 Views)

Sorry, could not find it. I am trying to find it for 6 hours without eating and drinking and it is now 2 am here. I do understand your concern about not sending the solution. But I really do not understand it.

B1-1

B2-2

B3-4

B4-?????

DutyCycle-????

Best,

0 Kudos
Message 18 of 20
(1,199 Views)

Hi H1636,

 

in the default case you need to wire the shift register trough the case structure.

And I already gave you all those case selector values before: did you read my messages?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 19 of 20
(1,192 Views)

I read it now, and it solved all the problem. This is a valuable page for me and you help a lot. 

 

Thank you sir 🙂

0 Kudos
Message 20 of 20
(1,182 Views)