DAQmxWriteDigitalU32 writes zero channel

I learn to use NIDAQmx in my process control project and am stumped with my problem. I'm using LabWindows CVI 8.5 and PCI-6229. Here is the code segment causing problem

----------------

OUTPUTS DIGITAL DAQ 0-23 reserve line
char chanP1Leds [] = ' dev1/port0 / line0:2 ";            RGY
char chanP1TestClr [] = "line12/port0/dev1;
char chanP1AirCtl [] = "line16/port0/dev1;

Line reserve DAQ DIGITAL INPUT 23-31
char chanP1TestIn [] = ' dev1/port0 / line30:31 ";        30: test, 31:retest

Analog data acquisition
char chanP1RegMon [] = ' dev1/ai0;        Pressure regulator monitor
char chanP1FlowMon [] = ' dev1/ai1 ';        Flow regulator controller
char chanP1TransMon [] = ' dev1/ai2.        Pressure sensor monitor
char chanP1PressureCmd [] = ' dev1/ao0 ";        Pressure regulator control
char chanP1FlowCmd [] = ' dev1/ao1;        Flow regulator control

.

.

Sub GlobalInit (void)
{
int n;
SamplesWritten of Int32;
error int = 0;
char errBuff [2048] = {'\0'};
uInt8 TestData = 1;
uInt32 P1LedsData, P1AirCtlData, P1ClrData;
   
Inititialization data
P1SerNo = 0;
P1PressCmdData = 0.0;
P1FlowCmdData = 0.0;
P1FlowMonData = 0.0;
P1PressMonData = 0.0;
P1TransMonData = 0.0;
   
P1LedsData = 0 x 7;
P1ClrData = 1;                low-> Clear
P1AirCtlData = 1;            low-> on
       
/*********************************************/
DAQmx Configure Digital Code
/*********************************************/
SetWaitCursor (1);
Digital outputs.
Channel LED
DAQmxErrChk (DAQmxCreateTask("",&P1TaskDOLeds));
DAQmxErrChk (DAQmxCreateDOChan (P1TaskDOLeds, chanP1Leds, "P1Leds", DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxSetChanAttribute (P1TaskDOLeds, "P1Leds", DAQmx_DO_InvertLines, 0));
Test channel
DAQmxErrChk (DAQmxCreateTask("",&P1TaskDOClr));
DAQmxErrChk (DAQmxCreateDOChan (P1TaskDOClr, chanP1TestClr, "P1Clear", DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxSetChanAttribute (P1TaskDOClr, "P1Clear", DAQmx_DO_InvertLines, 0));
Solenoid Air input control
DAQmxErrChk (DAQmxCreateTask("",&P1TaskDOAirCtl));
DAQmxErrChk (DAQmxCreateDOChan (P1TaskDOAirCtl, chanP1AirCtl, "P1AirCtl", DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxSetChanAttribute (P1TaskDOAirCtl, "P1AirCtl", DAQmx_DO_InvertLines, 0));
   
Digital inputs.
DAQmxErrChk (DAQmxCreateTask("",&P1TaskDI));
DAQmxErrChk (DAQmxCreateDIChan (P1TaskDI, chanP1TestIn, "P1Test", DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxSetChanAttribute (P1TaskDI, "P1Test", DAQmx_DI_InvertLines, 0));

Activate tasks
DAQmxErrChk (DAQmxStartTask (P1TaskDOLeds));        Start the task output
DAQmxErrChk (DAQmxStartTask (P1TaskDOClr));        Start the task output
DAQmxErrChk (DAQmxStartTask (P1TaskDOAirCtl));    Start the task output
DAQmxErrChk (DAQmxStartTask (P1TaskDI));            Start the task entry
   
/*********************************************/
DAQmx write code
/*********************************************/
DAQmxErrChk (DAQmxWriteDigitalU32(P1TaskDOLeds,1,1,10.0,DAQmx_Val_GroupByChannel,&P1LedsData,,));
DAQmxErrChk (DAQmxWriteDigitalU32(P1TaskDOClr,1,1,10.0,DAQmx_Val_GroupByChannel,&P1ClrData,,));
DAQmxErrChk (DAQmxWriteDigitalU32(P1TaskDOAirCtl,1,1,10.0,DAQmx_Val_GroupByChannel,&P1AirCtlData,,));
DAQmxErrChk (DAQmxWriteDigitalScalarU32(P1TaskDOAirCtl,1,10.0,P1AirCtlData,));
DAQmxErrChk (DAQmxWriteDigitalLines(P1TaskDOAirCtl,1,1,10.0,DAQmx_Val_GroupByChannel,&TestData,,));

-----------------

My problem:

1 DAQmxWriteDigitalU32 writes correct data.

the 2nd & 3rd DAQmxWriteDigitalU32 wrote zero in the channels and it does not matter where to move these 2 lines, they always write zero to the channels. The commented DAQmxWriteDigitalScalarU32 also written zero to the channel, but the DAQmxWriteDigitalLines writes the correct data to the channel. MAX test Panel also records the correct data in the port. I really don't understand why this is happening if I need your expert help to point out what I'm missing here.

Thank you very much.

Lanny

That's all. Thanks Brooks.

I have read the help file on DAQmxWriteDigitalXX and the format of data in the reference OR DAQmx and not to do so until now with your explanation. I guess the WriteDigitalLines throw me in a loop of thought DAQmx is masking and transfer of data to write the correct value in a port for other types of writing (and reading). A sample with lines and spots scattered around the port, as my case would save a NOR-DAQmx beginner like me a few days of agony. Well, we had the example here now.

Tags: NI Software

Similar Questions

  • y570 write zeros to HARD disk

    Hey people

    If I write zeros on my hard drive will be the hidden partition formatted with any hard drive? or that which is hidden will remain intact?
    Thanks in advance

    Hi mohamedduhoky,

    If you write zeros or do a formatting of the hard drive, it will completely wipe the drive clean and all partitions (hidden or not) will be gone.

    Best regards

    neokenchi

  • Write to channel outside custom device

    Hi all

    I am writing a custom device to control some aspects of my definition of system (more specifically another device custom).  I can't solve this problem because I can't find a way to write about a VeriStand channel located outside my custom device.

    Help to get channel reference data (which I usually use to get a data reference so that I could use the channel for the data set Reference.vi) says expressly that I can't get write access to a channel outside of my custom device.

    Is it possible for me to get write access to a channel outside my ring custom?

    I realize I can create system to the output channels of my device custom maps, but I'm not crazy a whole bunch of mappings of system because they are not very visible, and I would like that the user only need to use my configuration pages.  I also realize that it's probably possible to create these custom mappings by my setup of device programming, but I was not brave enough to venture down this road again...

    I use VeriStand 2011 SP1 and LabVIEW 2011 SP1.

    Thank you

    Chris

    Project engineer

    Certified LabVIEW Developer

    BaseNodeType is part of the Assembly SystemStorage, that something is used internally and is not intended for use by the public.  The publicly documented API is the API of ZFS, which has documentation available and a little easier to use.

    In the ZFS API, there is a class called "Utilities" that has a (Source channel, Destination) AddMapping method and a ClearMapping(Channel Destination) method.  These work as expected and disable the mapping entirely (not only the creation of an invalid mapping with value null, like your screenshot).  It would be better to add and remove mappings.

    However, if you want to stay with your existing code, I think you can accomplish what you want by removing the method "SetDataSourceValue" and replaching with a method "RemoveProperty.  The name plugged into "RemoveProperty" will remain the same ("DataSource").  This actually completely erases the mapping of the string instead of remapping it on channel zero.

    Kind regards

    Devin

  • How to read / write several channels at a time target real PXI with a Board of 6259

    On a PXI real-time target, I was able to access more of a channel at a time.  The attached example illustrates the problem, when the second analog read occurs, I get a 'resource is reserved error '.  It is my first challenge in real time and do not know how to proceed.  In the end, I need to read three channels of analog input and analog output channel in the loop in real time.  Thanks for any help.

    Yes.  You need to put the two analog inputs in a single task.  There is only a single clock for reading of the analog inputs.  If you use it for a task, this clock is reserved and the other task cannot use it.

    That means connecting it to an analog output channel must do with it?  If the ai0 is not connected to anything, why you try to read it?

    The reason why you see something on this channel, it is that you see the residual value in reading the other analog input channel.  When you have an open circuit, the amplifier may not load or unload by another value, if you see a ghost of the other channel.  The entry for the land of analog unused thread and you'll see that the reading is zero or very close.

  • Formatting a drive actually writes zeros to it?

    According to This Microsoft article, zeros are written to a disc when it is formatted on Windows Vista and newer, so by replacing the existing data on the disk. My questions are the following:

    1. This applies to Windows 7? (Microsoft article specifies no Windows 7 slot "apply to".) Another article from Microsoft States that in Windows 7, one non-quick format "completely erases all existing data on the hard drive. "(But this does not overwrite the data)?
    2. If the answer to question 1 is affirmative: this, in particular, apply to the USB flash drives formatted using disk management?

    No quick format is not write 0 as I know :/

    Clean all going,

    With the help of command as administrator or cmd prompt...

    And diskpart

    Press ENTER after each line

    DiskPart
    List disk
    Select the disk n (where n is the number that was given to your ssd or HDD in list disk you want to clean or clean all)
    Clean
    Create partition primary align = 1024
    Format fs = ntfs quick
    Assets (assuming you want to install an operating system)
    Output

    Or

    DiskPart
    List disk
    Select the disk n (where n is the number that was given to your ssd or HDD in list disk you want to clean or clean all)
    Clean all the
    Create partition primary align = 1024
    Format fs = ntfs quick
    Assets (assuming you want to install an operating system)
    Output

    Or you can use a third great mini tool and use disk Wipe which will add from 0

    Both take some time depending on the speed of computers and the size of the disk so don't think it's a quick process, it could take hours or all day on a 1 terabyte drive :)

    http://www.partitionwizard.com/free-partition-manager.html

  • Toshiba HDD utility to write zeros to the drive

    I have a big problem in my Toshiba HDD and I need a Toshiba HDD utility but is not. I'm sure a zero fill can solve my problem.

    Other HARD drive seagate or wester digital provides us with DOS software to solve problems, but I can find a similar software for Toshiba HDD.

    Can anyone hel me?

    Hello

    What HARD disk utility do you mean exactly?
    On the Toshiba European pilot page you can find the HDD Protection Utility but this utility would work on laptops with a HARD drive shock sensor. So if your mobile phone does not support such sensor, this utility will not working and would not protect the HARD disk

  • Windows 7: How can I write zeros to a cd

    I have a CD I used for data backups.  Want to crush the contents of each CD with all zeros before their transmission, but can't.  I tried the format format d: /fs:UDF p:2 command and it seem to work, but he finished in less than 30 seconds, which seems too fast (702 MB CD).

    Displays 'Properties' on the CD and it says is 321 MB used space and free space is 380 MB.  Clearly zeros have not been written to the disk.

    How to make sure that none of my data remains on the CD?

    Jane_Eyre_0102

    An easy answer.   I considered cutting upward from the CDs, but I am old and do not have enough strength to cut dozens of CDs hand.  Also, I hate to contribute to another landfill.  If any of my data is left on the CD, I could donate it to a school or a mission.

    Writable CDs are old technology. They also have a reputation for being unreliable: much becomes unreadable after a year or two. You may find it difficult to find someone who is willing to face them. I wouldn't have them if you gave them to me. ("USB keys") Flash drives are easier to manage, have much more capacity, and are also more reliable. I suggest you do this:

    1. Find two blocks of wood. Put them on the floor with a gap of 4 "between them.
    2. Wrap each CD in a thick layer of newspapers.
    3. Place the package on the blocks.
    4. He struck with a hammer. The CD will stop immediately.

    You can also use a sharp instrument (knife, screwdriver) to draw some deep scratches on each CD.

  • How can I get channel z (zero) data encoder with a NEITHER-9411 in scan mode?

    Hello

    I use a cRIO to read a quadrature encoder, and I need z-Canel (zero channel) data using a NOR-9411 in scan mode.

    Chassis: NEITHER cRIO-9074

    Module C-series: 9411

    Encoder: EIB H25 series (model # XH25D-SS-1440-ABZC-28V/V-SM18)

    Now, I installed it using in scan mode and the properties > Configuration parameters of specialty as follows:

    Lifestyle specialty: Quadrature

    Input filter: disabled

    Time base of speed: 4096us

    Index Mode: Disabled

    This replaces Position0 position 1, Velocity0 and Velocity1 module instead of et0, DI1 channels, etc.  It works well to get a reading of the speed, but not the Z.

    I need to know Z as in the rest of my program calculations depend on.  (For this encoder Z is a digital signal that goes low when the encoder reaches 360 °.  It is also a very fast signal.  7200 RPM, it has a width of approximately 3.3us pulse.

    How can I get the data Z in Scan Mode?

    Agile Hello,

    The mode setting of index is the only way to access the Z channel in Scan Mode.  If selected the position will reset when the z channel is detected and the phase of the two other channels corresponds to your selection.

    It seems that you have the real z signal elsewhere in your code.  You may use the position data to generate the Z channel for this purpose?

    Let me know if you have any other questions,

    Sebastian

  • How to reformat hard disk and write the hard drive C, of zeros

    I gatewayway 500 x with windows xp home ditiond... This is a manufactured office 05/28/02. I have all the restore disks. How to write c or a hard drive, of zeros to make clean reinstall? It must be real simple, but people at the door give me a hard time. All the computer Gateway manufactured after OCT 2008 have a numnber SIND. Mine does not work. I did once in the year 2003, I phone to life as long as I am the original owner. I also have a Gateway VISTA laptop. I met two compuers myself. I use the desktop computer and error, learning and music. I studied logic computing to CSUN Northridge, CA in 1999, I was a student. I love this kind of thing, but I can't afford to pay losts of money at the time.  I'm disabled because I had two failed back operations less than 18 years. Now Iam 65, sea musician tought and I want to become a tech free tought. Help, please. I never learned to type properly... I have a lot of free time amd, I'm ready to help others. CC to BILL GATES.

    SHALOM BARRY

    Just use one of the managers of two partitions described below to remove the existing Windows XP partition (or will write zeros, but this is not necessary just to reinstall XP)

    -Partition management-

    Partition Wizard Home Edition:
    http://www.partitionwizard.com/free-partition-manager.html
    Note: There is also a CD bootable or versions of the bootable Flash drive:
    http://www.partitionwizard.com/Partition-Wizard-bootable-CD.html
    http://www.partitionwizard.com/bootable-Flash-drive.html
    Among the features and functions: create partition, Delete partition, format partition,.
    A partition resize, move partitions, Partition recovery after an accidental deletion,
    Convert the partition, partition Explore, Hide partition,
    Change the drive letter, a partition active Set, Explorer (content display) of the partition.
    Note: To complete any task use the "Pending Operations" box at the bottom left.

    Alternative to Partition Wizard (a bit easier to use, but Partition Wizard and EASUS have almost identical user interfaces)
    EASEUS Partition Master Home Edition (free):
    http://www.partition-tool.com/
    Partition software ALL-IN-ONE and the most convenient hard disk partition manager Kit
    Includes Partition Manager, Disk & Partition copy Wizard and Partition MBR and GUID partition GPT disk recovery Wizard (table) on Windows 2000, XP, Vista, Windows 7 and Windows Server 2000/2003/2008 (32-bit and 64-bit).
    It allows users to resize/move Partition, drive system extend, copy Disk & Partition, Partition merge, Split Partition, redistribute free space, convert dynamic disk, Partition Recovery and much more.

    J W Stuart: http://www.pagestart.com

  • How to access the channel values?

    I'm new to scripting language DIAdem.  I TDMS has a group and several channels with String type all.   How to read the first 4 characters of each string values and store into the new channel?  Example of data file attached.

    I tried for the statement in the Script window

    Ch("[1]/result") = Ch("[1]/Frame")

    or

    Ch("[1]/result") = Right (Ch ("[1] / framework", 3))

    All gave me error...

    Hi NiCoder,

    It's the way you read and write individual channel values, but what to do value-by-value is much slower that make them all with a single call to ChnCalculate():

    Set Group = Data.Root.ChannelGroups (1)
    Define FrameChannel = Group.Channels ("Frame")
    Set ResultChannel = Group.Channels.Add ("Result", DataTypeString)
    iMax = FrameChannel.Size
    FOR i = 1 TO iMax
    ResultChannel (i) = Right (FrameChannel (i), 3)
    NEXT ' I

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • Read/write PDM files

    I'm looking for TDMS files as a way to save disk space for long trials.

    I have trouble finding a clear tutorial on how to write several channels (but I think I got including this one), but more specifically, how to read several channels on a sort of a waveform graph. My research did not give much.

    Is there a better data format to use?

    Rick

    Talk wrote:

    So if I understand well to do a PDM read function for each registered channel?

    No. one is the reading of many channels.  In this case it receives all channels waveform data in the data group measured.  You could also provide an array of channel names if you want to be more specific.  But all channels from a single reading must be of the same data type.  That's why the other two readings are separated.

  • Executable file do not write in tdm/PDM files.

    Hello

    I wrote a wrapper around a VI that controls the entries to designed the hardware and monitors the outputs for the prolonged lifetime of testing purposes.  We use compact DAQ for control and data acquisition.  We do not wish to moor a LabVIEW license for six months to run the desired test, I compiled an executable and built an installation program.  Everything worked without problems on a PC with LabVIEW and everything seemed to work well on a PC without LabVIEW with the executable... until I decided it was time to start analyzing the outputs recorded (tdms files).  The application is able to not control my material, no problem, I could see it passes through different States and key measures that I display on the user interface are valid, but the log files are simply cannot be created, not even an empty file.  At the lowest level, the open storage VI [TDM] is called to open or create the file (filename is entered by the user or created with timestamp if he did not) and each 'bit' of data is written by writing data [group of channels] and write data [channel] live on the PC with LabVIEW, the output files are created without problem.

    Did not work with executables before.  How can I start to debug (without installing LabVIEW on the PC in question - and when all goes well when run on a computer with LabVIEW installed)?  Have tried to build the executable with active debugging, but do not know how to "enable" debugging or a walk through as in LabVIEW... or if it's even possible...  I don't get warnings or errors during the race.  Is there something special I need to do in the construction of my executable or installer, particularly writing executables TDMS files?

    Thanks in advance

    -Andy


  • 6008 USB channel power for specific times

    Hello

    I am new to Labview, so I don't know if it's easy or hard to do.

    I have an attached VI who writes exits Digital 12-channel.

    What I´d wants to be able to write each channel for a specified time (avoiding the is fine - it doesn´t have to be super accurate, but he needs to turn off automatically after a certain time).

    For example:

    When I click, channel 1, I want him to be for 1 second, then turn automatically cut and wait for the next command.

    When I click, channel 2, I want it turn on for 0.5 seconds, before turning automatically turn off and wait for the next command.

    When I click, channel 3, I want him to be for 5 seconds, then turn automatically cut and wait for the next command.

    etc.

    So when I click Run, I could click on channel 1, wait a few seconds, channel 1 still once, wait a minute, then channel 3, wait 10 minutes, then channel 2, etc, in any order.

    Is how easy it to do? Is this possible?

    Thanks in advance for any advice.

    Jon

    Hi Jon,

    If you want to set the time separately, my guess is it would be easier for you to create the channels separately. It's more manual work, but I think it's better to come up with an algorithm of time-supervision to all channels at once.

    To trigger the output, I think that it is better to share entries, then perhaps it would be good to get out them of the matrix as well.

    In a loop, you can check the value of the button and then just write 1 to the port, wait for the timeout with time delay vi, then wrtie 0 again.

    If you create tasks separately and do not merge error, the process for each channel will work in parallel, so a delay will not affect the actions of the other channel.

    Kind regards

    Mariana.

  • read or write to the fpga of e/s node

    I am unable to read or write to a knot of e/s FPGA.  The entry is grayed out.

    The DIO module channels started writing? You need to go into the properties of the module and select this option. Find the module in the project, right click and choose Properties. I don't know which module you have, but if it's 8 channels, you can usually do it in groups so that you can put channels 0-3 to read or write and channels 4-7 to read or write. But you will not be able to each channel individually have it's own settings, cordially. But it may be different on certain modules.

    I suggest you look at the settings.

  • A better way to make a continuous read/write on a NOR-6008

    Hello

    I use a USB of NOR-6008 module and have a loop of the software configuration where I acquire analog signals, digital signals, then, then put a digital high or low and repeat. I use digital multiplex outside the material so that I can use 6 of the analog inputs to read 12 signals. The digital inputs that I have are connected to the buttons on a panel that are used for the entry instead of the screen of the computer of the user. My loop is also to build a buffer zone of all the signals on the analog and digital lines that I read in so I can on average and this process elsewhere in the program.

    The question that I am running is because this loop is very slow and on the final product is performed on a touch screen, XP Embedded PC and just this acquisition loop begins again as much CPU as the rest of my program. I would say that drops of loops on 4 or 5 cycles per second, which means that my update of 2 multiplex signals or longer than a second time. I would really like to better performance and does not use as much of my CPU resources.

    I use a way simple enough to make the loop of the acquisition, by setting the parameters I, reading, deleting the task, defining the parameters DI, read, erase the task and then by setting the parameters, write about it and delete the task, which gives a slight delay and repeat.

    Any thoughts on a better way to start the read/write that what I'm doing?

    I have attached the code examples in the loop of the acquisition that I use.

    Thank you!

    First of all, the best plan is to move the chain DAQmx before the loop to create and use a start DAQmx, then write in the loop, then clear once the loop ends.  This configuration must be done once, not every time you write the channel.  This should speed things up considerably.

Maybe you are looking for