LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

motor control by serial port

Hi GerdW

Got it. I hadn't been defining P,S and M in the LabVIEW program which I had defined in the controller one.

Now it works great with PID control block as well.

'Thank you so much for the help.

 

0 Kudos
Message 11 of 23
(1,275 Views)

Okay now my problem is:-

When I send the command to controller for getting the speed feedback it is giving me almost instantly (0.5ms - 2ms) the number of counts.

But when I interface it with the LabVIEW and I put the delay of 5ms in it, the VI is still not giving me any response(speed reading), its almost 22ms-25ms delay in the VI when the response speed is given back by the LabVIEW.

How can I minimize this delay for getting the response?

0 Kudos
Message 12 of 23
(1,259 Views)

Hi Sunny,

 

how does your current VI look like?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 23
(1,257 Views)

In your basic VI with comes shipped in LabVIEW examples the default delay given there is 500ms so if that reduced to 5ms I don't get any response.

But if increased to 22ms-25ms the speed count is given.

How can I reduce that delay to 5ms or less?

0 Kudos
Message 14 of 23
(1,256 Views)

This is the VI which I am working on.

0 Kudos
Message 15 of 23
(1,251 Views)

Ok now when I remove the property of bytes at port and  just give a constant on VISA read of how many bytes do I have to read I am getting the speed response at 2ms also.

Is it the right way?

0 Kudos
Message 16 of 23
(1,256 Views)

Hi Sunny,

 

yes, that's definitely the way to go. "Bytes at Port" isn't needed for proper serial communication using TermChar...

 

I removed some of those locals (and race conditions) in your VI. Sequences aren't needed so often. (See attachment.)

You shouldn't use the "STOP" function in your VI. Not at all...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 17 of 23
(1,254 Views)

Thanks a lot Sir.

0 Kudos
Message 18 of 23
(1,241 Views)

Hi

Im a begginer and want to do a PI control on a dc motor speed via avr. I have made a diagram but I think it must have some problems especially with the feedback.

your help really needed.

If there is any problem please tell me.

The other question is that can i send and recieve more than one type of data from one serial port? i mean for e.g having two feedback, one for speed and the other for motor current.

Thanks a lot.

0 Kudos
Message 19 of 23
(1,148 Views)

Hi Deovalente,

 

using the Simulation toolkit for a simple PI control is surely overkill...

 

- Do your really need to typecast your PI output to string? What kind of data does your "avr" expect?

- Does the "avr" really send you a DBL casted to a string, so you need to cast it back to DBL?

- Yes, your "avr" might send more than one value per message. It's up to you to decode that message in LabVIEW...

 

- Why do you close the serial port when you receive a message? You still want to receive further messages...

- Why do you use BytesAtPort when your serial port is set to use termination chars? Simply receive messages that are terminated by that char...

Best regards,
GerdW


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