Discussion:
How do I write to the DIO 653X onboard memory then start the task?
(too old to reply)
Jakeus
2007-01-09 20:10:10 UTC
Permalink
Alright, I'm attempting to write data to the onboard memory of a 653X series PXI DIO board.  I want to do this because buffering data using the computer's RAM will be too slow for the higher speed applications I am trying to program for.  I'm using Lab Windows CVI and the latest DAQmx drivers.  Here is the code I have come up with:
#include <ansi_c.h>#include <NIDAQmx.h>void main(){  int32   sampsWritten = 0;

int i; TaskHandle   Output = 0;  char   chrBuffer[80];  uInt8   WriteArray[8]={1,0,0,0,0,0,0,0},  WriteArray2[8]={0,0,0,0,0,0,0,0}; 
for(i=0; i < 10000; i++){  DAQmxCreateTask("",&Output); DAQmxCreateDOChan(Output, "Output/port0/line0:7", "test", DAQmx_Val_ChanForAllLines); DAQmxCfgSampClkTiming (Output, "OnboardClock", 100, DAQmx_Val_Rising,DAQmx_Val_FiniteSamps, 10); DAQmxCfgOutputBuffer (Output, 10);  DAQmxWriteDigitalLines (Output, 1, 0, 10.0, DAQmx_Val_GroupByChannel, WriteArray,&sampsWritten, NULL); DAQmxStartTask(Output); DAQmxClearTask(Output);
 
 DAQmxCreateTask("",&Output); DAQmxCreateDOChan(Output, "Output/port0/line0:7", "test", DAQmx_Val_ChanForAllLines); DAQmxCfgSampClkTiming (Output, "OnboardClock", 100, DAQmx_Val_Rising,DAQmx_Val_FiniteSamps, 10); DAQmxCfgOutputBuffer (Output, 10); DAQmxWriteDigitalLines (Output, 1, 0, 10.0, DAQmx_Val_GroupByChannel, WriteArray2,&sampsWritten, NULL);       DAQmxStartTask(Output); DAQmxClearTask(Output);
}
  printf("\nPress ENTER to exit"); gets (chrBuffer);   } 
 
Basically I'm just trying to toggle Port0 pin 0 high and low. 
I have had problems trying to find decent examples of this application in CVI, so please don't criticize too much.
Any advice on what else I need to configure or any ways I can optimize this code?
Brian F.
2007-01-11 04:40:08 UTC
Permalink
Hello Jakeus. 
Thank you for contacting National Instruments.
At first glance, your code appears to make sense.  When you build and run the program, does it work as you expect or are you running into some issues? 
A good program for you to get started on Digital I/O applications is available online at:
NI-DAQmx: Simple Digital I/O Example for CVI<a href="http://zone.ni.com/devzone/cda/epd/p/id/4995" target="_blank">http://zone.ni.com/devzone/cda/epd/p/id/4995</a>
It is fairly simple, but it should give you a good outline for the process to follow when using DAQmx to write to a digital line.&nbsp;
I hope this helps in your application.&nbsp; If you have any further questions, we would be happy to help!
Brian FApplications EngineerNational Instruments

Loading...