Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

digital output external trigger/clock

Hi, ive been looking through the posts but not found anything. Ive got a 1d boolean array. on the rising edge of a clock signal i want it to output the next item in the array to a pin on my digital port. I did the same thing a while ago but with an analogue output and it worked fine, with this it doesnt. Comes up with an error:
 
Measurements: Specified read or write operation failed, because the number of lines in the data for a channel does not match the number of lines in the channel.
If you are using the Digital Waveform datatype, make sure the number of lines in the digital waveform matches the number of lines in the channel. If you are using boolean data, make sure the array dimension for lines in the data matches the number of lines in the channel.
Number of Lines in Channel: 1
Number of Lines in Data: 16
 
I've attached the code.
 
many thanks
Mike
 
0 Kudos
Message 1 of 9
(4,185 Views)
Hi there Mike
 
just so that I can clarify, each time that you have a rising edge you would like to cycle to the next element in your array and output this on a single line. looking at you code what it is trying to do at the moment is output the entire array onto a single line.
 
The way to approach this I feel would be for the trigger to stimulate a software function that indexes the array to the correct element and then outputs it onto a single line.
 
post back if my original description of your aims is correct just to make sure that I understand you right and then I will have a go at a piece of code for you.
 
best regards
Graham Green

Sr. Product Marketing Manager

National instruments
0 Kudos
Message 2 of 9
(4,166 Views)

Hi Graham, thanks for your response on this. ok, i see where you're coming from. I'll give that a go.

I was presuming it would work the same way it does with analog output. With that i write an array of output values to the task first, then start it running and each time it recieves a rising edge on the trigger it jumps to the next one.. ive attached a pic of that code for clarity.

Ultimatley im trying to output a digital signal to set a DAC so i need a clock signal aswell, my thought was doing it this way and using a clock sigal connected to the trigger input to trigger the next sample to output. I would like to be able to use either an external or internal clock. It would be great if i could route the internal clock signal to one of the output pins, in a way that its just running in the background if you know what i mean, ive seen signal routing mentioned somewhere, would that be the way to do this?

Also I wonder if you could point me in the direction of something that explains how to handle digital signals generally, is not something ive really done before. I've come across digital waveforms in the help file.. is this what i should use for this sort of thing?

many thanks,
Mike Parker

0 Kudos
Message 3 of 9
(4,136 Views)
Just to say we managed to get it working using Digital Waveforms incase anyone else is searching for how to do it. Ive attached a pic of the block diagram. Theres a few bits im not sure about what they do, like the dT bit on the waveform.. doesnt really make sense when its triggered by an external clock but what the heck..
 
Mike
0 Kudos
Message 4 of 9
(4,130 Views)
0 Kudos
Message 5 of 9
(3,589 Views)

Hi venturer,

 

I need to start out by saying that neither the 6008 nor the 6509 support clocked digital I/O.  This makes either of these boards less than ideal for accepting an external signal to be used to clock out serial data.

 

However, If you are not open to new hardware the 6509 should be much better than the USB 6008 for this application (although that isn't necessarily saying all that much).  You could configure it to use change detection to send a software event when the clock signal goes high.  In the event handler you would write a single bit of your serial output.

 

The speed of your external clock is a critical factor in determining if the above approach would be suitable.  Is the delay from the clock edge to the data line being updated a factor for you?

 

 

The best solution would be to use a board with clocked digital I/O (e.g. PCIe-6320).

 

 

Best Regards,

John Passiak
0 Kudos
Message 6 of 9
(3,569 Views)

Just saw your timing diagram, the period of your clock signal says >5 us.  How much greater than 5 us can you go?  5 us isn't going to work so well for the software-timed approach.

 

Best Regards,

John Passiak
0 Kudos
Message 7 of 9
(3,566 Views)

The 5uS is produced externally and is fed in as an input. This external clock signal will trigger the changes for each serial output of data bits 

 

Thanks

0 Kudos
Message 8 of 9
(3,559 Views)

5 us (200 kHz) is too fast for the software-timed solution.  Unless you are able to slow down the rate you'll want to use a board that supports clocked DIO.

 

 

Best Regards,

John Passiak
0 Kudos
Message 9 of 9
(3,546 Views)