07-10-2013 05:27 AM
Hi, I'm having an implementation problem which my biggest problem is that I don't actualy know how to search my anwser.
I have a program that adquires some values from my inputs, after that I do some calculations and finaly, depending on my output I have to convert to a PWM, so in a time base I have to control the ON/OFF off my PWM but I can't get stuck here, and I just can't use a while loop. It's forbidden.
Can anyone explain me how to do that? how do I have always a PWM output and keep reading my inputs?
Thanks and sorry for my bad explanation of the problem.
07-10-2013 05:47 AM
-> How are you planning to generate the PWM (what hardware have you selected)...!!
@Top24 wrote:
Can anyone explain me how to do that? how do I have always a PWM output and keep reading my inputs?
You can have PWN generation and input acquisition in saperate & parallel loops.
-> can you share your code, and tell us, what you have done so far
-> And last thing, what is "Cicle"??
07-10-2013 05:59 AM
I can't share the code due to company privacy 😕
I'm not working with any hardware for now i'm just simulating and of course that I'm new at labview.
I have something like this:
- Aquire temperature
- Use a Pid control go generate a 0 - 100 analog signal
- After having that 0 -100 analog signal I want to convert it into a PWM signal so I do it mathematicaly comparing the iteration I'm in and the analog value and in a while loop I have mt time frequency and it is simple. the working PWM is one I found here in the forum and I'ts in my post below.
The problem is the last topic is working using the VI I'm sending BUT I need to make it work without the while cicle 😕
07-10-2013 06:18 AM
I saw your code, now as you're using 'Shift Registers', you cannot remove compltely the While loop (it's not While ciclecycle). But if you want to convert this code (PWM from an analog signal.vi) into a subVI, which should run just once, probbaly you can change the existing While loop to a single iteration loop OR a cleaner approach would be include 'Feedback Node'.
PS: Single iteration loop is either a For loop with '1' wired to N terminal OR a While loop with 'True' connected to conditional terminal (set as 'Stop if True').
07-10-2013 06:22 AM
Shift registers are not a problem since my pwm is still in a while loop BUT that while loop is the same that has the PID, so if I have to rum the while loop 100 times to have a full period of my PWM controler in that time I'll run my PID 100 times witch will change my analog PWM input without the cicle is complete
07-10-2013 06:28 AM
This is a sample of my program 🙂
07-10-2013 08:22 AM
Your problem statement is not very clear, but I made some modifications and you can use this code for your reference.
Specially check the changes done in "PWM from an analog signal.vi".
07-10-2013 08:40 AM
Putting both those files together I still have 2 while loops. I' trying to put everything in a while loop only 😕
07-10-2013 09:15 AM
@Top24 wrote:
I still have 2 while loops.
Where do you think is the second Loop???
07-10-2013 09:43 AM
each file has a while loop I was looking for trying to gather both in a single VI with a single while loop