Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Why am I not seeing the LED blink faster on hardware when the waveform graph shows the signal updating?

I am using the cDAQ-9188 chassis with a NI 9476 in the 8th slot, and when I run my VI, the waveform gets updated if I change the frequency of a signal while the program is running, but the DO from the write does not get updated. I thought that write takes in the data from the digital waveform input, so I'm confused as to why the digital waveform indicator is updated with a new signal, but my LED into a DI module (9421) is not updating.

 

Thanks in advance for any tips and suggestions!

Speed2.vi calls Generate_PWM.vi, so Generate_PWM is a subVI inside Speed2.

Download All
0 Kudos
Message 1 of 6
(5,439 Views)

Hi Ruthnan,

 

After looking at your code I think what is happening is that although you are getting all the points at a different frequency as shown in the waveform you are writing them out at the same speed. Basically, writing a binary 1 or 0 based off the data in the array is getting written at the same speed. Have you considered wiring the output of the counter to the input with the LED and just adjusting the counter frequency?

Patrick H | National Instruments | Software Engineer
0 Kudos
Message 2 of 6
(5,414 Views)

Hey Patrick,

 

I would love to vary the counter output; however, I am running three tasks that need three different frequencies to be varying at random (once per second), so in a previous VI, I just changed the counter output frequency but eventually (when I added the other two tasks), I kept getting errors saying the requested resource has already been reserved for another task, because I wanted to change the frequency of the sample clock (CO.Pulse.Frequency or some property like that).

 

Should I open a SRN to fix this issue?

 

Thanks,

Ruth Nan

0 Kudos
Message 3 of 6
(5,409 Views)

Hi Ruthnan,

 

Sorry for the delay in response but after looking over that hardware it seems there should be enough counters in the chassis to support what you are doing. I believe you are getting the resource is reserved error because you have started one output task on that module thus reserving the reference. Once that task starts any additional task with get an error. It should be possible to use more than one counter in your application but it sounds like an error in the VI configuration. I am happy to help here to get an example up and running but I think it would be faster to open a service request for this issue. Let me know what you would like to do.

Patrick H | National Instruments | Software Engineer
0 Kudos
Message 4 of 6
(5,368 Views)

Hi Patrick,

 

I already have a solution coded where I can use the internal counters in the chassis as the sample clock for three separate tasks. However, the NI 9476 module does not allow multiple clock sources to be assigned to the sample clock, and I get the reserved resource error.

 

This was why I was thinking to use one sample clock (one internal counter, _ctr0) to clock three separate tasks and just change the signal frequency (what I am feeding into the PWM vi). I think I will go ahead and open a service request number. Would having three separate NI 9476 modules work to let me run those three tasks separately with separate counters?

 

Thanks again for all your help,

Ruth Nan

0 Kudos
Message 5 of 6
(5,359 Views)

Hi Ruthnan,

 

Have three modules would allow for three tasks and you should have no problem doing that with your code. If you have any more questions do not hesitate to comment here and let the engineer you speak with know about the forum so I can discuss this with him or her.

Patrick H | National Instruments | Software Engineer
0 Kudos
Message 6 of 6
(5,354 Views)