From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PWM - counter output (PFI4) USB 6211

Solved!
Go to solution

I have manged to output PWM signal via AO of USB 6211 to control a DC motor. Now, I am trying to use the counter terminal instead.

Cant seem to make it work. Didnt get any signal out when link the PFI4 terminal to an oscilloscope.

 

I am not sure wheather my coding is wrong or my wiring (i.e. from USB 6211 to DC motor) is wrong. I need to use the counter terminal as I have used the analog output for a different measurement.

 

Please advice. Codings attached.

 

Thanks  a lot.

 

0 Kudos
Message 1 of 9
(7,106 Views)

Try attached code, and if it works, you can modifiy it to meet your requirement.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 2 of 9
(7,088 Views)

Hi..Thanks for the respond.

But still not getting anything..

 

Could it be because my wiring connections are incorrect..?

I connected PFI4 (counter 0) terminal and DGND (Digital ground) port to the DC motor.
 Am I doing it right?

 

Deakin_user2013

0 Kudos
Message 3 of 9
(7,079 Views)
Solution
Accepted by topic author Deakin_user2013

Before conneting to DC Motor, first make sure that the PWM is getting generated properly... use oscilloscope.

 

And have you changed the constant (physical terminals) for your device...??

Choose right terminal

 

Change it to:

Dev1/ctr0 & Dev1/PFI4 and the connection diagram should be:

Connection


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 4 of 9
(7,071 Views)

Hi,

 

Youre right. I better check the PWM signal first. Well, I am off work now. I will do it tomorrow and let you know how it go.

I have modify my code according to your solution and have also changed the physical channels as recommended. I will inform you of the outcome soon..

 

Thanks a lot.

 

Regards,

MNHZA

Deakin

0 Kudos
Message 5 of 9
(7,061 Views)

@Deakin_user2013 wrote:

I have modify my code according to your solution and have also changed the physical channels as recommended.


I prefer changing the physical channel because NI gives such flexibility. Also I would like to mention here that, it is not stringently required to change the physical channels and that too to exactly 'Dev1/PFI4'. It can be any other available PFI line. Say if you don't want to use this property node (CO.Pulse.Terminal) then the default output terminal would have been the same (PFI4), but you can definitely choose any other terminal (check this link here).


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 6 of 9
(7,051 Views)

Hi Again..

I did the changes as you recommended..and it works!! Awesome...Thank you very much..

I managed to observe the PWM signals via osciloscope and internally loop it back to the AI port.

 

Just one last question...Duty cycle can be varied from 0-100%...But what about the frequency of the signal? Is there a limit for it??

What would be the best frequency to operate in?

 

My nexy step is try to control a DC motor..I guess I need a transistor for this..

 

Thanks again..

You have been very helpful!

 

Regards,

Deakin user 2013

0 Kudos
Message 7 of 9
(7,024 Views)

Deakin_user2013 wrote:

Just one last question...Duty cycle can be varied from 0-100%...But what about the frequency of the signal? Is there a limit for it??

What would be the best frequency to operate in?


Duty Cycle cannot be varied between 0-100% (or 0-1)...!! I don't remember this specification for all different devices, what I prefer is, I set the duty cycle to 0 (zero) and check the error message. Below is the error message from my simulated PCI-6251 card, I'm not sure if the max-min range is same for each and every DAQ device or is different.

 

Max & Min DutyCycle Supported (NI PCI-6251 Simulated)

 

Similarly for determining the max-min frequency, set the frequency to 0 (zero) and observe the error message.

 

Max & Min Freq Supported (NI PCI-6251 Simulated)

 

Regarding the best frequency to operate:

that is absolutely application dependent and also on the allowable max-min values (of frequency).


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 8 of 9
(7,020 Views)

Hi Mr Deakin_user2013

 

                  This is a message three years late from your last post in 2013. I am also doing something similar to your experiment back then, for driving a DC motor.

 

                 What i had observed from measuring the voltage output of your posted program on an oscilloscope, the program does drive at 50hz @ 10% duty cycle but the voltage amplitude can only reach a maximum of 2.5V approximately.

 

                 From my understanding, typically for a DC motor, a 5V PWM signal is required to drive the DC motor with 50hz @ 10% duty cycle

   

                 How do you overcome the issue of increasing the 2.5V to 5V HIGH state PWM signal? Please do pardon my lack of understanding for driving DC motors. I am new to DC motor builds.

 

Jay

0 Kudos
Message 9 of 9
(5,765 Views)