12-03-2021 03:11 AM
Hi Mr. GerdW
thanks for your reply
Firstly I just don't want to connect to PWM express vi but alternatively I don't know how. For another issue, it is enough to produce a frequency of 40 khz for now. that's fine, the problem is that I want to generate a certain number of pulses as well as a frequency of 40 khz.
For example, if I add 100,000 pulses, I want to generate a piece of code that expects a new pulse count when 100,000 pulses are over. Because frequency determines the speed of the motor and the number of pulses determines the position of the motor.
12-03-2021 03:18 AM
Hi worker,
@constructionworker wrote:
For example, if I add 100,000 pulses, I want to generate a piece of code that expects a new pulse count when 100,000 pulses are over.
Typically you solve this problem by placing a loop around your pulse generation code: with the next iteration a new pulse count is used...
12-03-2021 03:21 AM - edited 12-03-2021 03:22 AM
That's all pretty trivial to do in FPGA (not getting to know FPGA programming but once you can do that this is really a trivial exercise). I still think it would be actually easier for you to investigate a bit more about the serial communication with the Modbus protocol. Yes Modbus can be a hassle to get working, especially with a USB serial port that you want to connect to anything but the predominant Windows OS with something else than the manufacturers own software package but it would avoid many of the problems you are now fighting with.
12-03-2021 03:54 AM
Hi mr.rolfk
After doing some research to do it using Modbus, it really takes a lot of effort. Almost no examples. Therefore, I want to communicate with modbus later. For now I'm just trying to go to the designated location by generating frequency and specific pulses. Because I think it's a little easier and might work.
Again, thanks for your opinion.
12-03-2021 03:56 AM
Mr.GerdW
It generates frequency with pwm express vi, but I don't really know how to determine the number of pulses. I couldn't find an example on this subject.
12-03-2021 04:04 AM
@constructionworker wrote:
Hi mr.rolfk
After doing some research to do it using Modbus, it really takes a lot of effort. Almost no examples. Therefore, I want to communicate with modbus later. For now I'm just trying to go to the designated location by generating frequency and specific pulses. Because I think it's a little easier and might work.
There are virtually millions of Modbus applications out there including in LabVIEW and probably 100ds of youtobe movies, tutorials and LabVIEW posts about doing Modbus. Just not with your specific device.
But your problem about not being able to specify the number of pulses is simply from using Express VIs. Express VIs are quick solutions that let you "configure" a few parameters with "zero" programming. They implement certain common problem solutions and if your problem is 3% different they won't work anymore for you. Then you have to forget Express VIs and start and do your own real programming.
12-03-2021 04:58 AM
Thanks for your opinion and suggestions. I gave up using Pwm express vi a little after your suggestion. I am trying to generate a pulse with any digital pin on top of that. How nanosecond time can be used in Labview. Here is my sample application.
12-03-2021 05:12 AM
Hi worker,
@constructionworker wrote:
I am trying to generate a pulse with any digital pin on top of that. How nanosecond time can be used in Labview.
As has been said several times before: employ the FPGA in your myRIO.
It will allow you that "nanosecond time" (usually 25ns steps with a 40MHz clock) easily.
12-03-2021 01:24 PM
In fact, generating 40 khz pulses is enough for me for now because the motor has a resolution of 1,280,000 pulses. 100,000 pulses corresponds to one revolution. But I have adjusted the gear ratio parameters in the motor driver to complete one revolution of the motor when a 40,000 khz pulse is sent. This resolution is enough. 40 khz pulse is enough for now, my main problem is if I
If I send a 40khz pulse, the motor is constantly spinning. The motor I want to create should stop after completing one revolution.That is, after 40,000 pulses are sent, I want to program the motor to stop rotating and wait for the new pulse. In this case, I need to create pulses and see the number of pulses generated. If it completes 40,000 pulses in 1000 milliseconds, the motor rotates slowly.
If 40,000 completes in 10 milliseconds, the motor will spin faster.
It is necessary to control both parameters, speed and number of steps.
I need help with this.