Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

Fast digital writes to ELVIS in NORMAL mode ?

Hello All,
 
I need to control 3 digital lines on my prototyping board, while ELVIS is in NORMAL mode (so I can use scope, func.gen etc.) at the same time. ( Controlling them with ELVIS bypassed I read is possible...but I need ELVIS communicating).
 
I read that SCANCLK, CTRx_OUTPUT can be used as static dig outputs, so Im hoping to use these. Hopefully LV writes will be fast enough for my application.
 
I do not need "correlated" outputs as timing is not critical, but needs to be fairly fast ie >10kbps.
 
Im also happy to use the DO 0-7 lines if these can be controlled in NORMAL mode.
 
Can anyone direct me as to how to do this ? Im using an ELVIS connected to PC via an USB-6251.
 
Thanks for any help,
 
Carlo
 
===============================================================

Take a look at DATEx, FOTEx, HELEx & SIGEx add-in trainer boards for NI ELVIS 1,2 & 2+ and DXIQ, ESSB for NI ELVIS III and myDSP for myDAQ to learn Wireless Telecoms, Signals & Systems, Fiber Optics and Green Energy principles (www.emona-tims.com)
0 Kudos
Message 1 of 12
(11,083 Views)
Carlo,

You can not perform correlated DIO in NORMAL mode and in order to reach rate higher than 1kHz you will have to use correlated digital output.


Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
0 Kudos
Message 2 of 12
(11,071 Views)

Hello Abhinav,

Thank you for your reply.

I have read about DAQmx VIs now and believe I am on the right track. Thanks for the link...very helpful.

If I use the DAQmx VIs to control some of the digital outputs of the 6251s PFI lines, then hopefully I will be able to achieve rates of say 1khz, or perhaps a little slower...100khz minimum....in uncorrelated mode eg. as static writes from LV.  Do you think this will be possible ?

Also, will I be able to achieve this whilst running ELVIS in NORMAL mode at the same time, as these PFI lines are unused by ELVIS ?

I will give this a try, and would appreciate any opinions on whether this is the way to go, or there is some better way which I have overlooked.

Thanks for any help,

Carlo

 

 

 

===============================================================

Take a look at DATEx, FOTEx, HELEx & SIGEx add-in trainer boards for NI ELVIS 1,2 & 2+ and DXIQ, ESSB for NI ELVIS III and myDSP for myDAQ to learn Wireless Telecoms, Signals & Systems, Fiber Optics and Green Energy principles (www.emona-tims.com)
0 Kudos
Message 3 of 12
(11,068 Views)

Hello Carlo. 

In order to understand your application better, could you tell me what specific task you are trying to perform with these 3 digital lines?  We may be able to utilize other functionality of the ELVIS depending on your application.  For example, if you need to generate a pulse train, you could utilize the counters that are available on the bottom right hand side of the ELVIS board.

Since you cannot use correlated DIO, the update rate of the digital output lines will be dependent on the speed of your computer since updates will be software based.  However, you should be able to do this at a fairly quick rate.  Also, keep in mind that if you just wish to output a high or low, you can use the digital output lines located in the top right hand side of the ELVIS to do this. 

Also, let us know how those tests go that you talked about in your last post.  We would love to help you if you run into specific issues with this. 

Brian F
Applications Engineer
National Instruments

0 Kudos
Message 4 of 12
(11,043 Views)

Hello Brian,

Thanks for your reply. I must say Im impressed by the very supportive nature of this forum. As a newbie to LV & ELVIS, its encouraging to see a forum with so much help....and no flaming.

After reading many posts & tutorials, Im making some progress, but am hoping to avail myself of the expertise of this forum to take the optimum path and save some time setting up this interface.

Whilst running ELVIS in NORMAL mode (so that I can use ELVIS vi's like scope, func.gen etc), I also need to control a MCU board plugged into the ELVIS breadboard via 3 digital output lines.(no inputs needed).

These 3 lines implement a simple serial comms interface from my LV program to the MCU on ELVIS ie: enable, clock, data. I need the clock rate to be at least 200Hz.

Im using a USB-6251 (and LV8.2) and I believe I can use port2 lines which have P2.3,P2,2, P2.4, P2.5, P2.6 avail as dig outs.These lines also show up on the ELVIS protoboard at 'counters' and "Prog.Func.I/O" so I can grab them there.

I used DAQ assistant to create an earlier version of my attached VI, but Im finding it slow going to understand tasks,virtual channels etc despite having read the many info's online.

Ultimately, I need a VI which reads a knob value, U8, and outputs a brief serial stream based on that knob value to the MCU.

Im planning to bit-bash the comms using a Mathscript vi, (which Im familiar with from using MATLAB ) .ie: knob data > mathscript vi > 3 dig lines.

I imagine this app is dead simple, but the learning curve is rather steep, so any hints (or proto vi's) would be a great help.

Thanks,

Carlo

 

===============================================================

Take a look at DATEx, FOTEx, HELEx & SIGEx add-in trainer boards for NI ELVIS 1,2 & 2+ and DXIQ, ESSB for NI ELVIS III and myDSP for myDAQ to learn Wireless Telecoms, Signals & Systems, Fiber Optics and Green Energy principles (www.emona-tims.com)
0 Kudos
Message 5 of 12
(11,036 Views)

Hello Carlo. 

It sounds like you have the right idea.  Reading tutorials online and going through some example programs are great ways to learn about the power of LabVIEW.  However, at this point, I think the most learning is going to be done by diving right in and trying to get something to work.  You can take baby steps in getting something 'simple' to work before moving to a more complex application.  I would recommend the method of divide and conquer for this application.  Find something easy to do, and verify that it works.  Then tackle the next little part of the application and get that working.  Before you know it, you will be finished!  Doing this type of programming will be great for learning as well as successful development of your application.  I think you will be surprised at how easy it is to program in LabVIEW once you do this. 

With that said, one of my favorite DAQmx tutorials is located here.  This website has a lot of information that may prove useful for your endeavors:

Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications
http://zone.ni.com/devzone/cda/tut/p/id/2835

Good luck and if you have some troubles after diving in, we would be happy to help you out!

Brian F
Applications Engineer
National Instruments

0 Kudos
Message 6 of 12
(11,017 Views)

Hello Brian & other viewers,

I have made some good progress, have it working basically and would appreciate any tips on optimisation please.

This code aims to send the values from the 8 knobs & 1 switch group as a serial stream to a DAQmx box. It takes 900 msec to complete one complete poll of all 9 devices. This is a little too slow. Profiling shows that half time spent writing to DAQmx, and half spent in my VI.

Q1) Can the knob polling be amended so that values are only sent when there is a value change ie: no knob change= no writes to DAQmx. As one knob moved, then data from that knob sent continously to DAQmx...until knob stops being changed...This would make it fast enough as I'ld be updating the DAQ about 9 time  per second. Ive tried using "event" block with value change...but couldnt get it working ...any hints ?

Q2) is it faster to manipulate numbers rather than boolean arrays to construct my bit frames ? This could speed things up.Perhaps theres better ways to construct my data frames ?

Q3) How can I remove the dialog box which sets up the channel for DAQmx, and have it permanently address only port2, lines 4,5 & 6. of the DAQ box? The dialog is a remnant from the setup example.

Thanks for any help you can give,

Carlo

===============================================================

Take a look at DATEx, FOTEx, HELEx & SIGEx add-in trainer boards for NI ELVIS 1,2 & 2+ and DXIQ, ESSB for NI ELVIS III and myDSP for myDAQ to learn Wireless Telecoms, Signals & Systems, Fiber Optics and Green Energy principles (www.emona-tims.com)
0 Kudos
Message 7 of 12
(10,896 Views)
Hello. 
 
I would recommend looking at event structures as a means to only write when there is a value change on one of the knobs. Some great information on event structures can be found at:
 
Event-Driven Programming in LabVIEW
 
In terms of your question about manipulating boolean arrays or numbers, the arrays can be quite costly in terms of memory and execution speed.  However, I don't know how you would implement some of the functionality in your current program (i.e. aaabbbccc) without converting it to an array of booleans.  There may be an algorithm for doing this numerically, but I would bet that it would be costly to do this as well. 
 
In terms of eliminating the dialog box, you can change the control to a constant on your block diagram by right clicking on the 'lines' input terminal on the "DAQmx Create Channel VI" and selecting create>>constant.  Then, you will need to enter in DevX/port2/line4:6 in the constant box and you should be up and running. 
 
This may be the fastest your code can execute if all of the logic in your while loop is necessary.  If you could, I would appreciate a detailed explanation of what this code does step by step.  I don't quite understand the tripling of the data bits for example. 
 
Let me know and we will be happy to help further!
 
Brian F
Applications Engineer
National Instruments
0 Kudos
Message 8 of 12
(10,885 Views)
>Hello,
 
>Thanks for the reply.
 
> I will take a close look at that event info. Thanks. 
 
In terms of your question about manipulating boolean arrays or numbers, the arrays can be quite costly in terms of memory and execution speed.  However, I don't know how you would implement some of the functionality in your current program (i.e. aaabbbccc) without converting it to an array of booleans.  There may be an algorithm for doing this numerically, but I would bet that it would be costly to do this as well. 
 
>some of the concatenating can be done by multiplying and addition....I will give it a try, but I dont expect much improvement overall (and at a cost of making it less legible)
Yes, I agree, the tripling would be a hassle...best done as an array.
 
In terms of eliminating the dialog box, you can change the control to a constant on your block diagram by right clicking on the 'lines' input terminal on the "DAQmx Create Channel VI" and selecting create>>constant.  Then, you will need to enter in DevX/port2/line4:6 in the constant box and you should be up and running. 
 
> OK..will give it a try.
 
This may be the fastest your code can execute if all of the logic in your while loop is necessary.  If you could, I would appreciate a detailed explanation of what this code does step by step.  I don't quite understand the tripling of the data bits for example. 
 
>Im aiming to create 3 frames of 64 bits each. One of CLK, ENABLE & DATA. The data frame has address & knob data inside it, and so varies. I need to output the data, with a CLKpulse directly in the center of the data...for my hardware. So by tripling the data I spread it to be 3 bits wide, so the cLK pulses will be high in the center of the relevant data bit.
So in effect, Im bit bashing out a clocked serial data stream, with chip enable, to some custom hardware, through the DAQ box.
ALthough its rather basic, I figured it was quite fast.
Do you think it can be done much more quickly...keeping in mind that I need to drive the DAQ by software, as Its also being used by an ELVIS unit.
 
Also, the bundle/unbundle serves to synchronise the 3 streams, as its crucial that they are aligned. I wonder if this can be done more elegantly/efficiently ?
 
Thanks for any more comments,
 
Carlo
 
===============================================================

Take a look at DATEx, FOTEx, HELEx & SIGEx add-in trainer boards for NI ELVIS 1,2 & 2+ and DXIQ, ESSB for NI ELVIS III and myDSP for myDAQ to learn Wireless Telecoms, Signals & Systems, Fiber Optics and Green Energy principles (www.emona-tims.com)
0 Kudos
Message 9 of 12
(10,876 Views)
Hello Carlo. 
 
For the application that you are working toward with the constraints that we have discussed above, I think you are doing things efficiently and cannot think of a better way at this time.  I will definitely make a post if I do come across a better way to do anything in your code. 
 
Let me know how the event structures go for you. 
 
Brian F
Applications Engineer
National Instruments
0 Kudos
Message 10 of 12
(10,856 Views)