LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help : generate digital serial data

Hello. I am new with NI (few days). attached is my colleague previous work. The program is to test a device by giving PARALLEL digital input. What should I modify, so that, I can generate SERIAL digital input instead? My hardware is PXI 6534. and I am using LabView 7.1 Please help... thanks
0 Kudos
Message 1 of 7
(3,282 Views)
Hi!
   I've taken a look to your colleague's code.... I just can say that it doesn't follow good LabView programming practices, so, if you're learning LabView, I strongly suggest to NOT look at that code, and start your own.  You can look at Digital generation examples, provided with LabView, and adapt them to your hardware. 

   Just an example: on the top left hand corner of block diagram, you have the creation and clear of three DAQmx tasks.  According to dataflow principle, nobody tells you when this code will be executed, if before or after the other code.  Is this desired behavior?

    Next: You start DAQmx Task, and suddenly clear it.... not good, I suppose (but I'm not sure, since it's been a long time I don't work with DAQmx.... now I'm deeping in PACs...)

    Next:  I strongly suggest not to use stacked sequence structure.  If unavoidable, use flat sequence structure.

   Of course, this is my point of view...... Smiley Happy

   Have a nice day!

graziano
0 Kudos
Message 2 of 7
(3,277 Views)

Hi Seicento,

I strongly advise to start from scratch but let’s first break in small pieces your colleague code. The first part of the code where you have three DAQmx task is clearly controlling a third party device that receives 5 V pulse as an input. The second part of the code is a sequence structure composes by two frames, the frame “0” is outputting a unsigned 16 bits integer that comes from the “iteration terminal” of the for loop. Second frame of the sequence structure has a blue “Express VI”, named Instruments I/O Assistant this part of the code serially write “:READ?” to this third party device; it must be a command that will make the device send a Measurment to your computer through port COM1.

The only part of your code that I think can be change to serial is the first frame of the sequence structure. Where instead of writing the unsigned 16 bits integer to 16 lines in parallel you will write it to one line serial. In this case each of the 16 bits will be written on the line which each clock pulse.

I have attached a screen shoot of a code in LabVIEW that will nicely help you accomplish this task; this code is no more than a modification of the example: “Cont Write Dig Chan-Burst.vi”, it uses the onboard clock to output the number through one of the line of the port.


I hope it helps, remember that you can find this example in LabVIEW. (Help -> Find Examples -> Search Tab -> type the name of the example).



Message Edited by Jaime F on 12-11-2007 10:23 AM
Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 3 of 7
(3,248 Views)
 
Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 4 of 7
(3,243 Views)
Thanks a lot Jamie F. I have tried your suggestions. I have few issues however: 1) My program has an error of "For loop : N is not wired, and there are no indexing inputs".It said that I need to right click on the tunnel to enable indexing,but when I clicked there is no option as that.see my attach file : 1.jpg. 2) Then I just connect the wire to the N instead.The error gone, but when I run the simulation, I got another error which as the attach file : 2.jpg 3) Attached vi file : T2.vi is a file that I just found here that are supposed to generate the serial digital data.But it was not work.Can you clarify the problems.. I am very hopefull you could help me.I just need to generate the serial digatal signal.I am actually taking up my collegue works,I am very new with the LabView.I appriciate the inputs.thanks
Download All
0 Kudos
Message 5 of 7
(3,220 Views)
Hi!
   I suggest to take a look at LabView user's manual, for loop is well descrived there Smiley Wink

   "N" terminal has to be wired to indicate how many cycles your for loop has to execute. As an option, you can wire an array as input of for loop, and, if indexing is enabled, "N" can be not wired, the loop executes many times as the number of elements in the array, but be careful,  in this way, the input of each iteration of for loop is the n-th element of array, instead of passing at each iteration the entire array.

   I suggest to build a basic example, to play with this concept: just build an array, pas it to for loop, and hilight, then change "N"....

   BTW, it seems to me that you are not passing an array to the for loop, so you can't enable indexing, because a scalar has no index... Smiley Happy

   Have a nice day!

graziano
0 Kudos
Message 6 of 7
(3,215 Views)

Hi Seicento,

Since the previous post from Graziano is a very good suggestion for your “for loop” issue, let me address your 200898 error. If you look this knowledgebase: Why do I get Error -200898 during Hardware-timed Digital Input/Output?. The 6534 does not support partial port hardware time applications, in other words you cannot output a digital pattern in just one line on a port hardware time. Your solution is to select the line that you won’t need and tristate them. Performing a Software Timed Tristate on the 6533/6534 is an example in LabVIEW 8.5 that might give you a guide in tristating the lines you are not going to be using. Another workaround is to make “Serial Dac in.vi” generates 8 waveforms instead of 1 where one line is your data and the other 7 are drove with zero values.

Since you have told in the post that you are fairly new to LabVIEW I would like to point you to some very useful debugging resources there is a light bolt close to the run button on the “block diagram” this is called highlight execution, it will slow down the flow of your code letting you watch it as it run, one of my favorite tools in LabVIEW.

I hope it helps

Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 7 of 7
(3,188 Views)