Read/write on a single line with 6518 IO Board

Hello

I'm trying to control inputs (line 16) and the output (line 16) a card NI6518 with visual C++.
To do this, I want to read line by line. I tried the following code, but what does'nt seems to work.
I wrote a class with below method: ReadLine and writing. Perhaps, I get confused with the sense/line output, uInt8...

Can someone explain to me my error? Thank you very much!

READ ENTRY:
bool CTORInterface::ReadLine (int number, bool & value) number 0 to 7
{
HTask TaskHandle = NULL;
CString szNameBoard = "IOBOARD1".
CString szLineID;
szLineID.Format ("IOBOARD1/port0/line%d", number); channel with 1 line

retrieve the handle on the task
DAQmxCreateTask ("IOBOARD1", &hTask);)

create an input line
DAQmxCreateDIChan(hTask,szLineID,"",DAQmx_Val_ChanPerLine);

Start the task
DAQmxStartTask (hTask);

reading
uInt8 data [8];
Int32, read, bytesPerSamp;
DAQmxReadDigitalLines(hTask,1,10.0,DAQmx_Val_ChanPerLine,data,8,&read,&bytesPerSamp,);

stop the task
DAQmxStopTask (hTask);

opening handle
DAQmxClearTask (hTask);

value of multiple bits of data extraction
value = (bool) data [number];

Returns true;
}

WRITE OUTPUT
bool CTORInterface::WriteLine (int number, Boolean value)
{

HTask TaskHandle = NULL;
CString szNameBoard = "IOBOARD1".
CString szLineID;
szLineID.Format ("IOBOARD1/port2/line%d", number); channel with 1 line

retrieve the handle on the task
DAQmxCreateTask(szNameBoard,&hTask);)

create the output line
DAQmxCreateDOChan(hTask,szLineID,"",DAQmx_Val_ChanPerLine);

Start the task
DAQmxStartTask (hTask);

write the value online

uInt8 data [1];
Int32 numWritten = 0, regenMode;
uInt32 bytesPerChan;
data [1] = value? 1:0;
DAQmxWriteDigitalLines(hTask,1,1,10.0,DAQmx_Val_ChanPerLine,data,&numWritten,0);

stop the task
DAQmxStopTask (hTask);

release of the handle
DAQmxClearTask (hTask);

Returns true;
}


Tags: NI Hardware

Similar Questions

  • How to read/write tdms 2.0 files with the TDM C DLL?

    Hello

    How to read/write tdms 2.0 files with the TDM C DLL?

    How consequently the datas in interlaced with the TDM C DLL mode?

    Thank you

    Confirmation: TDM C DLL always wrote the file in TDMS version 2.0.

  • Arrow line (single line with an arrowhead) in MS Paint Win7

    Is there anyway that I can draw an arrow line (straigt single line with an arrowhead at the end) in the new MS Paint in Win7?

    The following items may be worth a visit:

    Windows 7 - paint help
    http://Windows.Microsoft.com/en-us/Windows7/using-paint

    Windows 7 - getting started with paint - tutorial
    http://Windows.Microsoft.com/en-us/Windows7/getting-started-with-paint

    Windows 7 - How to add an arrow to a screenshot
    http://www.allsandiegocomputerrepair.com/693/how-to-add-an-arrow-to-a-screenshot/

  • Text single line with background Image field

    Hello

    I have the following requirement for a small number of topics on BasicEditField, but I couldn't find answers to my requirement, so post to the same

    My requirement

    1 must be the only editor of line text field with a width and a predefined height.

    2. If a background Image(For better look-rounded edge image like in Broswer)

    3. If the number of characters exceeds the single line, it has scroll horizontally right and from characters to scroll left with the appropriate property of the ellipse.

    4. in entering an Enter key (Center of select navigation Keys), it should call my method to perform an action.

    Enjoy a quick help on this

    Thanks in advance

    Q1. BasicEditField.NO_NEWLINE will stop people pressing enter and get a new line.

    Regarding your second question, I recommend that you check out the two videos on screens and area managers.

    As a general rule, a field is laid out (i.e. tells his manager what size he needs and then this rectangle is placed), then painted.  Exhibitor is managed by managers and put sublayout on the page for the fields.  The more important than sublayout and put thing in page do is specify the scope (width and height) they need, which fiddles and managers to make using the measure.

    Once all fields was laid out, then the visible parts of each field are painted using paint.  I've never used subpaint.

    I hope this helps.

  • How to make a single line with 6-8 images in css?

    I would like to do a header line with 6-8 icons of different sizes and use them as links.  I can't get them to line up horizontally in a container. How can I do this?

    You can do this by making the area the same size icons. that is, all the images are the same size, it's just the icons in the image control that are different sizes.

    If you don't want to do this then probably a good reason to use a table with cells of 6/8 otherwise, you will need to adjust padding/margin on each icon to align individual, doable but somewhat tedious.

  • Maximum latency to read/write for PCI-DIO-32HS with NOR-DAQmx?

    I was asked to evaluate using the PCI-DIO-32HS and NOR-DAQmx on MacOS X to essentially close a control loop.  My first concern is whether or not it can run fast enough.

    So my questions are: what is the maximum latency from the moment of receiving a signal strobe reading data from external hardware, then read a single 16-bit sample and sending it upward by NOR-DAQ to a user space application?  And, similarly, what is the maximum latency of sending a unique 16-bit value from a space application user down through NOR-DAQ, then write a port and affirming a strobe signal of external-data writing material?

    Thank you.

    Hi AliasMe,

    Thanks for posting and welcome to the Forums EITHER!

    Do you need to process the data in the software and generate a value on this basis?  DIO-32HS (alias PCI-6533) offers in the buffer of inputs and outputs, but you'd have a latency in your control system relying on the OS to do treatment.  Since this period is dependent on the system, I can't give a specification for the amount of time it would take.  However, integrating data in memory, processing and writing back to the card would likely be on the order of several milliseconds.

    Generally, we recommend FPGA in situations of control like this, so you can do all the processing in hardware.  However, if provide you more details on your request we can look into all the options available.

    -John

  • How to display the column single line with function of nested groups

    SQL > select deptno, Max (sum (sal)) SalSum
    2 of PEM
    3 Group of deptno;
    Select deptno, Max (sum (sal)) SalSum
    *
    ERROR on line 1:
    ORA-00937: not a single group group function

    Can you please help me to get the Max (sum (sal)) with Deptno...

    Or:

    select max(deptno) KEEP (DENSE_RANK LAST ORDER BY SalSum) deptno,
    max(SalSum) from  (
      select deptno,sum(sal) SalSum
      from emp
      group by deptno
    );
    
  • How to read / write to a HID device with call a library function?

    I had tons of problems to read from a device USB HID in VISA. I had no problem make a driver for him and write it in LabVIEW. However, whenever I try to read using Read Visa, Visa USB Control In or interrupt USB event get different types of error messages.

    I decided to give up this route and talk to the device through hid.dll, setupapi.dll and any other .dll that I need to use. The problem is that I'm not sure I correctly use the nodes to call a library function... I've seen several KB articles that explain how to set up the nodes call library feature, but I need more information. I can configure stuff and sometimes get things to work, but I don't always know what each specific selections in Settings tab is doing. Can someone give me more detailed information on what do the settings tab and all of its components?

    Thank you

    Matt

    Have you looked HERE?

    Shane.

  • Development of a feature of single line with list items

    Hello
    I am new to Oracle forms. Currently using Oracle forms 6i.
    I am facing a problem when you check the condition of the components of a line while choosing the "item in the list. I basically multiple data block. On the block of data I assigned to the property as 'Item in the list' to one of the element. This list item has three options 'MANUAL', 'AUTO' and 'ADVANCE '. When I choose the 'MANUAL' list item, corresponding line should be editable and the user can insert the record in the same row. But when I choose 'AUTO' or 'ADVANCE' only the specified element say for example the element 'Sr.no" only be editable while all other elements are unchangeable. I tried to use set_record_property for 'MANUAL' and that my point. But writing set_item_property to "AUTO" and "ADVANCE", which spoils the feature then 'MANUAL' for the line/record after having inserted a line 'AUTO' or 'FORWARD '.
    Please help as soon as possible because it is urgently needed.

    Published by: 1005292 on May 10, 2013 12:43

    I agree with Gregor uses WHEN-LIST-CHANGED-relaxation. But I wouldn't set the INSERT_ALLOWED and UPDATE_ALLOWED properties in a WHEN-NEW-FOLDER-iNSTANCE-trigger, but put in the WHEN-LIST-CHANGED-trigger and in the process of filling the block (I don't know how the block is filled, if its done using EXECUTE_QUERY the relaxation would be POST-QUERY-relaxation).

    The statement to make it a feature in the Insertable current record is

    SET_ITEM_INSTANCE_PROPERTY('BLOCK.ITEM', TO_NUMBER(:SYSTEM.TRIGGER_RECORD), INSERT_ALLOWED, PROPERTY_TRUE);
    SET_ITEM_INSTANCE_PROPERTY('BLOCK.ITEM', TO_NUMBER(:SYSTEM.TRIGGER_RECORD), UPDATE_ALLOWED, PROPERTY_TRUE);
    
  • Splitting of multiple lines on a single line with different fields

    Hi all

    I have a table. A Course_Code have section_codes several other words ('NUM' column is not sectype is just an order!)

    Code---num---Sec_code---Sectype---DESC---WEIGHT
    1603 1 - C 7427 - Coursework - 50
    1603--------2-------7428-----------E------------     Exam----------------     50

    I query this table I want to be able to see the course work, review divided on the same line. i.e.


    Code - Coursework - review
    1603 C = 50 - E = 50

    any help would be great

    Hello

    'Splitting' means take an element (such s as a string 'C = 50') and diviiding in smal; LER objects (such as the chains under "C" and "50"). Are you really trying to divide something, or are you trying to do exactly the opposite (for example, combine smaller chains in a larger string)?

    I think that what you are looking for is a Pivot . Like so many other things, exactly how do depends on your version of Oracle and your needs.
    Here's one way:

    SELECT       code
    ,       MIN (CASE WHEN descr = 'Coursework' THEN sectype END)
           ||  '='
           MIN (CASE WHEN descr = 'Coursework' THEN weight  END)     AS coursework
    ,       MIN (CASE WHEN descr = 'Exam'       THEN sectype END)
           ||  '='
           MIN (CASE WHEN descr = 'Exam'           THEN weight  END)     AS exam
    FROM       table_x
    GROUP BY  code
    ;
    

    It will work in Oracle 8.1 and higher. From Oracle 11.1, you can also use the SELECT... Function PIVOT.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all tables and also post the results desired from these data.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.

  • How to return a single LINE with Multiple value separated by a colon in a SQL query

    Hello

    I have a SQL, as shown.
    select deptno
      from dept
    I want to mofidfy this query, so that it should return me departments with colon delimeted list in a ROW.
    10:20:30:40.......
    Thank you
    Deepak
  • How to merge data from the table with a single line

    Hello

    I have three tables subscription_type, the address and the person. Here are the details of the table

    Person Subscription_type Address                                           

    Person_Id AdressType_id Address_id

    Person_name Description Address_type_id

    Person_id

    Address details


    There are three types of different address - home, postal and previous.

    Each person can have these three different addresses.

    I want to create a view that displays all addresses of three of each person in the table of the person in a single line.

    Any help please

    In your example, there are 2 rows of columns street1, TOWN, SUBURB etc for a single person. To convert this into a single line, with the new columns we could simply use CASES or DECODE in the select as the SQL below. To understand why consolidation function THAT MAX is used - remove the MAX and GROUP BY in SQL keyword and try.

    Select full_name

    , max (case when description = "Home" then end street1) Home_Street

    , max (case when description = "Home" then end suburb) home_suburb

    , max (case when description = end of the "Home" then City) home_city

    , max (case when description = "Home" then postal code end) home_postcode

    , max (case when description = "Home" then end state_name) home_state

    , max (case when description = 'Postal' then end street1) Postal_Street

    , max (case when description = 'Postal' and then end of suburb) Postal_suburb

    , max (case when description = 'Postal' then the city) Postal_city

    , max (case when description = 'Postal' and then end of CP) Postal_postcode

    , max (case when description = 'Postal' then state_name end) Postal_state

    , max (case when description = "Back" then end street1) Prev_Street

    , max (case when description = "Back" then end suburb) Prev_suburb

    , max (case when description = "Back" then city end) Prev_city

    , max (case when description = "Back" then postal code end) Prev_postcode

    address a

    S State

    No p

    Subscription_type att

    where a.person_id = p.person_id

    and a.state_id = s.state_id

    and a.address_type_id = att.address_type_id

    Full_name group

  • Feature SoftMotion Straight Line move read/write Targ Pos

    I read up to / study code on the packaging SoftMotion example of OR.

    I downloaded the code 'NOR week 2008 SoftMotion Development Module 2.1 and Compact 6-axis coordinated Motion Demo RIO' to discuss how I can implement a routine of homing on motor axes stepper and ran through a code without papers.

    I note that property to move to right Linr Targ Pos RW (target Position) can take in a meter target or the target tables.  The detailed help for this node does not detail the difference in operation.

    From what I can decipher, it seems that the table entry is for when you have mapped to several lines of a 'coordination' and the entry in table defines the position of the target for the individual axes in the coordinate.

    Is this true?

    Hi Rvallieu, you are right. It is the function that the table has. If you configure the system to work with multiple axes, the Position of the target of the right line to move read/write will have an entry level. This is something that should be mentioned in the help. This was reported to R & D (# 133028) for further investigations.

  • Reading single line of the text file

    I use the following code to read a .txt file

    private String readTextFile (String fName) {}
    String result = null;
    FileConnection fconn = null;
    DataInputStream is = null;
    try {}
    fconn = (FileConnection) Connector.open (fName, Connector.READ);
    is = fconn.openDataInputStream ();
    Byte [] = IOUtilities.streamToBytes (is) data;
    result = new String (data);
    } catch (IOException e) {}
    System.out.println (e.getMessage ());
    } {Finally
    try {}
    If (null! = is)

    is. Close();
    If (null! = fconn)
    fconn. Close();
    } catch (IOException e) {}
    System.out.println (e.getMessage ());
    }
    }
    return the result;
    }

    I want to print a single line instead of the file around so I read that I need to store the contents of the file into an array and then get the index of the line. Problem is that I couldn't find any information on how to do it. Can someone give me a shot. Thanks in advance.

    This isn't a problem with encoding. You just need to do a little extra accounting and adjust start and end indices to remove these characters. To treat the "\r\n" of line termination style, you can maintain a flag (initially false) to indicate that the previous line ended with a \r; If a line begins with \n, it should be treated as the end of a line (empty) if the flag is true (in which case it should be ignored).

    If you want to extract all lines (not just the first), then it may be easier to do this accounting while avoiding a separate function. Something like this (untested):

    // read the file into a byte array 'data'; then:
    Vector lines = new Vector();
    boolean endCR = false;
    int start = 0;
    for (i = start; i < data.length; ++i) {
      if (data[i] = 0xD) {
        lines.addElement(new String(data, start, i - start));
        endCR = true;
        start = i + 1;
      } else if (data[i] = 0xA) {
        if (endCR && i == start) {
          start++;
          endCR = false;
        } else {
          lines.addElement(new String(data, start, i - start));
          start = i + 1;
        }
        endCR = false;
      }
    }
    String[] results = new String[lines.size()];
    lines.copyInto(results);
    
  • How can I "automate" a question of a single line and response? the answer starts with the right margin and ending on the right margin as it is typed. The sequence would be: 1 type question 2. Tab at the right margin. 3 type the answer ending on the margin

    5.6.1 MacBook early 2015 OS X 10.11.3 pages

    Question: How can I easily format a series of "a line of questions / answers" (questions and answers on the same line.)

    How to easily create a long series of a single line of questions and answers to the question aligning it on the left and the end of the response by aligning right?

    For example

    !. Type the short question on the left margin.

    2. tab at the right margin.

    3. type the answer with the end of the answer on the right margin.

    Insert a right tab at the right margin.

    Peter

Maybe you are looking for