Hi there, I originally wrote to you on the old forums regarding the control of a servo motor via the PWM output on your T7 device. This was around Feb and I havne't had a chance to finish the project until now.
What I am asking is at the end of the post you mentioned you had achieved proper function of the servo motor without having to change the settings mid run. If you are still able to do that in LabVIEW could I please have a look at the VI? this will greatly help me if possible.
Thanks,
Stuart.
Are you referring to old forum topic #7084?
http://forums.labjack.com/index.php?showtopic=7084
It suggests that you simply write to DIO0_EF_CONFIG_A whenever you want to update the duty cycle. You can use "LJM_eWRiteName Example.vi" to try that.
If I just use the vi you stated it does nothing, im clearing missing something as my knowledge is lacking, can you please explain in detail how to get this working.
Thanks,
Stuart.
We better go over some information from the old topic again. Please let us know what you do have working, and where you are stuck.
The following page documents the PWM Out feature on the T7:
https://labjack.com/support/datasheets/t7/digital-io/extended-features/p...
From there, you can see what registers you need to write to configure and update the PWM output. In LabVIEW, you can write these registers using the eWriteName or eWriteNames examples, and even more explicitly using the example "DIO EF Config 1 PWM Output.vi".
https://labjack.com/support/software/examples/ljm/labview
Hi there. So once ive read up on the PWM section more I know I am able to control the servo, as I have done this before. What I cannot do and have tried many times is to run a continous loop with say a numeric slider controlling the duty cycle, so I can change the position of the servo while my vi is running.
The very basic attempt that's easiest to describe invloves putting a while loop around the write section of the PWM output example vi and have a slider control the duty cycle. This achieved nothing and the servo refused to update. Would you have any ideas on how to correct this?
Thanks,
Stuart.
Here are the steps I suggest to approach your problem.
1. Run (run once) the example "DIO EF Config 1 PWM Output.vi" to configure your PWM output and get it started.
2. Run "LJM_eWriteName Example.vi" to update DIO0_EF_CONFIG_A. Try this a couple times with different values to see if you can change the duty cycle as desired.
3. Once you confirm that steps 1 & 2 work, you want to make a VI that starts by doing step 1 and then has a loop that continuously does step 2 (calls eWriteName each time in the loop). For a structure of what this would look like in terms of LabVIEW programming, see "DIO EF Config & Read 10 Counters Loop.vi". On the wiring diagram, the only substantial change I think you need is to replace eReadNames in the while loop with eWriteName. On the front panel you will make various changes to the controls, or move these to the wiring diagram and make them constants.
Hi, so I have been playing with the PWM output example vi and everytime I set the DIO_EF_CLOCK0_ROLL_VALUE and DIO0_EF_VALUE_A so that I can set the frequency to the required value the servo does move but a loud humming comes from it, I think this means the frequency is wrong and it is being updated too fast. I might be wrong about the problem but I don't know where else I am going wrong.
I have been following the equations on https://labjack.com/support/datasheets/t7/digital-io/extended-features/p... to set the required frequency at 50Hz. So my values are Roll Value = 1600000 and Value A = 800000 (50% duty cycle).
I am clearly missing something, could you please tell me if I am in the right direction.
Thanks,
Stuart.
Hi, I have just succeeded in getting the servo working in a while loop by following yours and the previous posts help. I am going to try to get it all working in one vi. I will keep you up to date.
Thanks for all your help.
For future forum users and so that we can improve how we explain the pwm system to other customers, if you have a chance can you describe what you did to get the PWM system to work properly for you?
Hi, to get the servo working I had to configure the frequency to 50Hz, to do this I set the following configurations:
DIO_EF_CLOCK0_ENABLE = 0
DIO_EF_CLOCK0_DIVISOR = 1
DIO_EF_CLOCK0_ROLL_VALUE = 1600000
DIO_EF_CLOCK0_ENABLE = 1
Then,
DIO0_EF_ENABLE = 0
DIO0_EF_INDEX = 0
DIO0_EF_CONFIG_A = 120000
DIO0_EF_ENABLE = 1
I was then able to change the CONFIG_A value from 80000 to 160000 in a loop via the writ name vi.