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: 

DC motor control

Solved!
Go to solution

I have having a issue with pulsing a signal from encoder.. I have to control a motor making sure it doesn't go over a certain threshold. It needs to count the pulse with an have a repeat trigger. I have done code for it over an over but I do not know how to get this pulse signal.. It seems simple enough but I no longer no where to being.

0 Kudos
Message 1 of 10
(4,187 Views)

like I dont understand how to make that pulse signal come in from the encoder.. I am getting confused.

0 Kudos
Message 2 of 10
(4,184 Views)

Post the code you have written, so that we can see where you are.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 3 of 10
(4,135 Views)

This is what I have so far it counts the pulses. But how would I implement the user to enter a frequency. (I would prefer they enter a RPM though an from there count the pulses. I just don't see how to count the pulses an have the user enter the speed(RPM). I talked to technical support an they counldn't help me. I'm sure I need two conditions though. Any help would be great.

0 Kudos
Message 4 of 10
(4,109 Views)
Solution
Accepted by topic author Gotti_uncc

Hi Gotti_uncc

 

I just wanted to ask a few clarifying questions about your application.

 

Are you trying to count the pulses from an encoder and read in a user input that will generate a pulse train to change the speed your motor?

 

What hardware are you using?

Sam Burhans
Senior Product Manager
National Instruments
0 Kudos
Message 5 of 10
(4,098 Views)
Yes Sam-B that is what I am using I will be using a compact rio or a MyRio. Also yes that is what I am trying to accomplish.
0 Kudos
Message 6 of 10
(4,094 Views)
I didn't mean to say this was solved.
0 Kudos
Message 7 of 10
(4,088 Views)

Hi Gotti_uncc

 

If you are going to use a cRIO or a myRIO you will not be able to use the DAQmx API as this API is for a windows operating system.

 

With a cRIO or a myRIO you will be able to use the FPGA and in the following link there is information about how to use an encoder and this other links has information about how to create a PWM signal in the FPGA.

 

Regards

Esteban R.

0 Kudos
Message 8 of 10
(4,035 Views)

Hello to everyone,

I am new in LabVIEW FPGA programing and I have a couple questions, so I would be grateful if you could answer me. For my final work I have to control the speed and direction  of DC motor  using sb-RIO 9636 and H-bridge L298n. In attachments you can find scheme of the H- bridge and my program. I have conected In1(pin 5 of L298n) to digital pin 1 of the card, In2(pin 7 of L298n) to digital pin 2 of the card and changing the state of the pin I change the direction of the motor(I know that the one In should be Low and the other High so the motor can rotate  in one or the other direction). PWM(Enable pin of the L298n pin 6) I have conected to DIO3.

PWM signal I cretaed is  shown in picture.

My questions are:

1.Will loop timer I used, provide that period of signal is lenght I specify in the control(for example if I put 20 000  will the period be 20000 s)?

2. Can I vary the duty cycle changing the control Waiting (DIO3 is HIGH for a couple of us, then it sets LOW, and then all that repeats )?

3. Earlier I thaugt that PWM signal I should send in both IN1 and IN2, and that the Enable pin is used to stop or start the motor. I tried that and the motor was rotating different speed, and I could stop or star the motor with enable pin, sending it HIGH OR LOW, but I could not change the direction of the motor. So my other option was to conect the pins as I explained at the begining.  My question is: Should I PWM conect to the enable pin, and will thah work?

 

Thank you

Download All
0 Kudos
Message 9 of 10
(3,589 Views)

Hello there,

 

1. Yes. Below is some Help documentation about the Loop Timer Express VI.

 

'Loop Timer Express VI'

http://zone.ni.com/reference/en-XX/help/371599G-01/lvfpga/loop_timer/

 

2. Changing the 'Waiting control seems like a logical way to vary the duty cycle. Have you tested it? If so, what behavior did you see?

 

 

 

 

0 Kudos
Message 10 of 10
(3,538 Views)