Yesterday, I tried to control a stepper motor using the L297 IC driver, but then I realized that I need another IC which could drive high current to the motor, similar to darlington transistor arrays. The ICs are being purchased at the moment for the need of lab experiment taught by my friend.
Oh well, I decided to learn how to generate a simple PWM in PCI-6221 on LabView -as you know I am always new in this, too many functions available, and I am not used to graphical programming-.
I utilized the counter 0 (DevX/ctr0) to turn on a LED (light emitting diode) that it will flicker according to the signal given. For this card the LED is located on PFI 12 (pin number 2).
Here is the front panel, where user can interact with the program:
and here is the back panel for the main flow program:
I still not yet have the LabView Real-Time with me, my boss said it will arrive tomorrow. This program is written with LV 8.2 with the minimum delay is 1 ms. If you analyze the back panel above, when there’s a value change in the control form (the meter and vertical bar) for different duty cycle or frequency, the value will be updated inside the case structure. You can experiment by changing the duty cycle and frequency, and then look at the flicker rate and intensity of the LED.
If you removed the timed loop and changed with while loop, a problem will occur if the value change in the control form is faster that one period of loop cycle, thus LabView Run-Time will generate an error message. The reason is that, the changing is lot faster that one cycle loop which is 1 ms. With this timed loop, unnecessary changing is discarded, only values which are between the right time slot considered as input. If error happened the LED on front panel will be on.
If you don’t understand my explanation, you can download the vi program here (remove the .pdf extension).





very interesting, but I don’t agree with you
Idetrorce
Hi Idetrorce, which part you don’t agree?
hi,
I want to list program counter for CVAVR in ATmega8535.
Plz, give me some good listing
thanks