How do I read DAQ at every state change on a quad encoder over RTSI

I have successfully routed either A or B encoder phase to the DAQ card over RTSI, but this gives you 1/4 of your encoder counts to the DAQ. Is there a way to trigger the DAQ clock with both the rising and falling edges, A and B signals so you get a DAQ reading with every encoder count?

mikema111,
From your explanation I am assuming that you are using an X4 encoder. Unfortunately there isn't a way to combine both Phase A and Phase B (rising and falling edges) into a DAQ scan clock without external circuitry.
However, one possibility would be to use a sort of XOR circuit to merge the two phases into one signal and then pass that signal into one of your analog input channels. You could then setup that analog input channel for windowed analog input triggering. As the TTL pulse rises through the window an AI Start Trigger pulse is generated and then another pulse is generated as it passes back down through this window. Pass the AI Start Trigger pulse into a counter setup for retriggerable single pulse generation and you will have your DAQ scan cloc
k on the output pin of the counter.
If you are just interested in counting the pulses in both Phase A and Phase B you can configure one counter to count on the rising edge and the other on the falling edge as described in the following Knowledge Base:
http://digital.ni.com/public.nsf/websearch/15170E05F0F4B65C86256E2400812CD9?OpenDocument
I also recommend reading the following document that discusses several different options when using a quadrature encoder with an E Series board (DAQ-STC).
http://zone.ni.com/devzone/devzoneweb.nsf/Opendoc?openagent&36BD71244BB26FC886256869005E541B
Ames
Applications Engineering
National Instruments

Similar Messages

  • How to cancel email advice of every event change on a shared calendar?

    Since I migrated to iCloud and re-shared my calendars, my wife gets an email every time I add, delete, or modify an event in a shared calendar. I can't find the setting to shut this off. Where do I look?

    as far as i understand iCal it is on the "receivers/subscribers" side to deal with email-updates (and not on the "senders/changers" side):
    snippet from my Re: How do you stop receiving notifications about updated calendar events? (there is a screenshot as well):
    to NOT get email notification about updated events from a shared calendar you subscribed to you have to uncheck "events affect availability" in that calendars "info" (mac os X.7 and X.8: iCal —> calendars dropdown —> right click on the subscribed calendar —> choose "get info" from the context-menu —> uncheck "events affect availability")

  • How to read back the output state for digital output or anlog output ?

    I use NI-pci 6221(68PIN) Accquistion card to do measurmet,after i do digital output ,or anlog output ,I find that the output will be maitained by the card.even after i exit my accquistion program.But if i reset the card ,the ouptut also will be reset.
    Now if i don't reset the card ,how can i read back the output state,?

    Hi Mike,
    There is no way for you to internally route an analog output to an analog input. The only solution is to physically connect the two lines together with a wire.
    I came to this conclusion through the following steps:
    1- Start MAX and select the DAQmx device under "Devices and Interfaces>>NI-DAQmx Devices" that you want to internally route signals through.
    2- Click on the "Device Routes" tab on the bottom of the right hand window (It defaults to the "Attributes" tab)
    3- Line up the Source with the Destination to see if the connection can be internally routed (either direct or indirect)
    I came to the above conclusion by following these steps for a PCI-6251 DAQ device (the analog output & input do not exist in the "Device Routes" tab therefore they do not support internal routing), but you should verify this for your specific hardware. Let me know if you have any other questions/concerns.
    Cheers,
    Jonah Paul
    Applications Engineer
    National Instruments
    Jonah Paul
    Marketing Manager, Embedded Software
    Evaluate the LabVIEW RIO Platform! - ni.com/rioeval

  • How to read each and every word from a string.

    Hi all,
       I have a string which is having many label numbers. if the string is lv_str, its value is like, 11111111111111##22222222222222##3333333333333.
    I need to move the values alone into internal table. each value should be updated as a single row into one internal table. How to read each and every word of the string and move to an internal table.
    the internal table should be like this.
    11111111111111
    22222222222222
    3333333333333
    Can any one give me a suggestion in this regard.
    POINTS PROMISED.
    Regards,
    Buvana

    Hi,
    If you know the format and length of the data
    Use split at '#' so that you will get the individual values.
    Thean append it to internal table.
    Reward iof helpful.

  • How do I read the FIFO correctly on an M series DAQ card?

    I have a PCI-6229, which I have working with the exception of a bug or two.  The program continuously reads multiple inputs from the FIFO buffer, which is being filled at around 100 kHz.  Every ms or so, the program reads all the values in the FIFO.  To keep track of the input channel being read, the program currently indexes a channel variable every time it reads a value from the FIFO and continues until the FIFO is empty.  The next time it starts reading the FIFO it continues from the last input channel read.  This works correctly sometimes, but other times the tracking system gets off by one then associates the values with the wrong input channels.
    As an example, reading two inputs at 100 kHz the DAQ card appears to read one input every 5 microseconds and put that value in the FIFO.  When the program reads, sometimes it reads an even number of values and other times an odd number.  The program tries to keep track of this, but several unmonitored variables that I'm aware of and several that I'm probably not aware of can lead to my tracking error.  The FIFO filling up is one example, I believe.  Many times when the card is started it is already off by one.
    Is there a way to know what input a value in the FIFO is associated with?  I'm trying to have the DAQ card run continously, empty the FIFO periodically, process the data, and continue this process.  I don't want to start the AI task for 1 ms, read the values, process the data, and restart the AI task for 1 ms if I don't have to.  Thanks.
    Aaron

    You could try using DMA. This thread has a code example and some corrections. I did not have to delete the acdReset, but your mileage may vary.
    Good luck
    Neil

  • How can we read some bytes from every line of the file

    How can we read some bytes from the every line of the file moving on to the next line
    without using the read line

    Actualiy readLine() takes more execution time
    for reading a part of line if we can do so without
    readLine() we can save some time...Well, if you knew, beforehand, the length of each line, you could use RandomAccessFile and its seek method, but, since you don't, you would have to read the rest of the line character-by-character, checking to see if it is a newline, in order to place the "cursor" at the beginning of the next line in order to read the next few characters you want.
    So, as you can see, you will need to read the entire line anyway (and if you do it yourself you also have to do the checking yourself considering all three possible end-of-line sequences), so you just as well use readLine().
    Some people may suggest Scanner and it's nextLine() method, but that also needs to read the rest of line (as evidenced by the fact that it returns it), so that is no different than the readLine() (or read it yourself) solution.

  • How to write read dataset statement in unicode

    Hi All,
    I am writing the program using open dataset concept .
    i am using follwing code.
        PERFORM FILE_OPEN_INPUT USING P_P_IFIL.
        READ DATASET P_P_IFIL INTO V_WA.
        IF SY-SUBRC <> 0.
          V_ABORT = C_X.
          WRITE: / TEXT-108.
          PERFORM CLOSE_FILE USING P_P_IFIL.
        ELSE.
          V_HEADER_CT = V_HEADER_CT + 1.
        ENDIF.
    Read dataset will work for normal code.
    when it comes to unicode it is going to dump.
    Please can u tell the solution how to write read dataset in unicode.
    Very urget.
    Regards
    Venu

    Hi Venu,
    This example deals with the opening and closing of files.
    Before Unicode conversion
    data:
      begin of STRUC,
        F1 type c,
        F2 type p,
      end of STRUC,
      DSN(30) type c value 'TEMPFILE'.
    STRUC-F1 = 'X'.
    STRUC-F2 = 42.
    Write data to file
    open dataset DSN in text mode. ß Unicode error
    transfer STRUC to DSN.
    close dataset DSN.
    Read data from file
    clear STRUC.
    open dataset DSN in text mode. ß Unicode error
    read dataset DSN into STRUC.
    close dataset DSN.
    write: / STRUC-F1, STRUC-F2.
    This example program cannot be executed in Unicode for two reasons. Firstly, in Unicode programs, the file format must be specified more precisely for OPEN DATASET and, secondly, only purely character-type structures can still be written to text files.
    Depending on whether the old file format still has to be read or whether it is possible to store the data in a new format, there are various possible conversion variants, two of which are introduced here.
    After Unicode conversion
    Case 1: New textual storage in UTF-8 format
    data:
      begin of STRUC2,
        F1 type c,
        F2(20) type c,
      end of STRUC2.
    Put data into text format
    move-corresponding STRUC to STRUC2.
    Write data to file
    open dataset DSN in text mode for output encoding utf-8.
    transfer STRUC2 to DSN.
    close dataset DSN.
    Read data from file
    clear STRUC.
    open dataset DSN in text mode for input encoding utf-8.
    read dataset DSN into STRUC2.
    close dataset DSN.
    move-corresponding STRUC2 to STRUC.
    write: / STRUC-F1, STRUC-F2.
    The textual storage in UTF-8 format ensures that the created files are platform-independent.
    After Unicode conversion
    Case 2: Old non-Unicode format must be retained
    Write data to file
    open dataset DSN in legacy text mode for output.
    transfer STRUC to DSN.
    close dataset DSN.
    read from file
    clear STRUC.
    open dataset DSN in legacy text mode for input.
    read dataset DSN into STRUC.
    close dataset DSN.
    write: / STRUC-F1, STRUC-F2.
    Using the LEGACY TEXT MODE ensures that the data is stored and read in the old non-Unicode format. In this mode, it is also possible to read or write non-character-type structures. However, be aware that data loss and conversion errors can occur in Unicode systems if there are characters in the structure that cannot be represented in the non-Unicode codepage.
    Reward pts if found usefull :)
    Regards
    Sathish

  • In iCal how do i set an event every 3 months

    In iCal how do i set an event every 3 months.

    Sk8trdad,
    I presume that your question relates to the Calendar App on the iPad.
    You have to use the "repeat>Custom" setting on the Desktop version of iCal.

  • How to get a list of every application on my computer?

    I'm trying to figure out how to get a list of every application on my computer using applescript. I know it is possible for the system to do this, as evidenced by the dialog you get when you use the "choose application" function. Other examples are doing a spotlight search for "kind:app" or programs like Namely or QuickSilver.
    Is there a way to do this in applescript? The only solution I've come up with so far is to use the command:
    <pre>set everyapplicationaliases to choose application as alias with multiple selections allowed</pre>
    and manually select all on the resulting dialog. I can then take the results and go from there, however there are a few significant problems with this approach.
    1. It requires user interaction. (I have an idea for some future applications that could use this functionality if it can be done without user input.)
    2. It's horribly slow. As a test run I choose all the applications from the dialog, extracted some basic info and put the result on the clipboard. It took a couple of minutes to complete this relatively basic task. In comparison, running the aforementioned spotlight search took maybe ten seconds.
    Thanks in advance!
    best,
    peter

    For these specific queries my results are...
    set appList to paragraphs of (do shell script "mdfind \"(kMDItemKind = 'application'c) || (kMDItemKind = 'widget'c)\"")
    3082
    set appList to paragraphs of (do shell script "mdfind \"(kMDItemKind = 'Application'c) || (kMDItemKind = 'Widget'c) ||
    ((kMDItemContentTypeTree = 'com.apple.application') && (kMDItemContentType != com.apple.mail.emlx) && (kMDItemContentType != public.vcard))\"")
    3115
    I think I finally found some numbers that make sense!
    When I search for Kind:Application by the Command+F method in the Finder, I get a total of 2521 items, of which 2477 are "Applications" and 44 are "Other".
    (Just by eyeballing it, "Other" seems to include some Classic Apps and some .bundle files.)
    The total # found by this method (2521) plus the number of Widgets found using mdfind (318) equals the number of total number of items found by spotlight (2839).
    I also noticed that these numbers almost equal the spotlight number:
    mdfind results for kMDItemKind:
    Widgets: 318
    Applications: 1684
    Classic*: 795
    and
    Command+F "Other" items: 44
    3181684+79544 = 2841
    It may be a fluke that this is so close to the 2839 spotlight gives, or maybe there's an overlap somewhere...
    Tying this back into my initial question, it seems like the original mdfind command for Applications is probably the best answer for what I was looking for,
    since I wasn't really thinking about Classic apps and Widgets anyway.

  • How do I make a web page that changes every time the user refreshes it? Is it possible in Muse?

    Hi, i'd like to make quite a simple website where the main text in the centre of the page changes every time the user refreshes the page in their browser. I assume i'll have to make one master, and multiple pages that are all the same except for the changes in the text, but i'm not sure how to make it so that every refresh directs to a different page and not just the home page? Is this even possible in Muse?
    This is an example of what i'm going for: :: procatinator ::
    Thanks!

    You can't do it with Muse alone. Would probably be fairly simple to do with a bit of Javascript. Check the widget directory as it is possible someone has made a widget for random content. If not, maybe I will make one this weekend. ;-)

  • How can I read pdf files from LabVIEW with different versions of Acrobat reader?

    How can I read pdf files from LabVIEW with different versions of Acrobat reader?
    I have made a LabVIEW program where I have possibility to read a PDF document.  When I made this LabVIEW program it was Acrobat Reader 5.0.5 that was installed on the PC. Lather when the Acrobat Reader was upgraded to version 6.0, there was an error when VI tries to launch the LabVIEW program. And Later again when we upgraded to Acrobat Reader 7.0.5 I must again do some changes and rebuild the EXE files again
    It isn't so very big job to do the changes in one single LabVIEW program, but we have built a lot of LabVIEW programs so this take time to due changes every time vi update Acrobat Reader. (We have build EXE files.)
    The job is to right click the ActiveX container and Click "Insert ActiveX Object", then I can brows the computer for the new version of acrobat Reader. After this I must rebuild all the "methods" in the Activex call to make the VI executable again.
    Is there a way to build LabVIEW program so I don't have to do this job every time we update Acrobat Reader?
    This LabVIEW program is written in LabVIEW 6.1, but I se the problem is the same in LabVIEW 8.2.
    Jan Inge Gustavsen
    Attachments:
    Show PDF-file - Adobe Reader 7-0-5 - LV61.vi ‏43 KB
    Read PDF file.jpg ‏201 KB
    Show PDF-file - Adobe Reader 5-0-5 - LV61.vi ‏42 KB

    hi there
    try the vi
    ..vi.lib\platform\browser.llb\Open Acrobat Document.vi
    it uses DDE or the command line to run an external application (e.g. Adobe Acrobat)
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"

  • How can I initialize all TabNavigator Tabs upon a state change?

    Here's the basic goal. I want to provide two views to the
    user that display the same panels. I configured each view as a
    separate state but I am having trouble initializing each of the tab
    views since they are only created by Flex when the user first
    selects it. I need them all created when the user changes to that
    state so that I can insert my view objects. Does that make sense?
    Ok, how about an example program. I define three view objects
    in ActionScript which will be used in two different states. I use
    AddChild to put them in the proper layout location. The problem is
    with the Tab state. The AddChild operation only works for the first
    tab because it is visible. The other two tabs don't get setup
    properly. Can anyone help me resolve this?
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical"
    creationComplete="onCreationComplete()">
    <mx:Script>
    <![CDATA[
    import mx.containers.VBox;
    import mx.controls.Label;
    [Bindable] public var view1:VBox;
    [Bindable] public var view2:VBox;
    [Bindable] public var view3:VBox;
    private function onCreationComplete():void
    var label1:Label = new Label();
    var label2:Label = new Label();
    var label3:Label = new Label();
    label1.text = "This is view 1.";
    label2.text = "This is view 2.";
    label3.text = "This is view 3.";
    view1 = new VBox();
    view1.label = "View 1";
    view1.addChild(label1);
    view2 = new VBox();
    view2.label = "View 2";
    view2.addChild(label2);
    view3 = new VBox();
    view3.label = "View 3";
    view3.addChild(label3);
    currentState = "wizardState";
    private function changeState():void
    switch(stateBox.selectedItem.data)
    case 0: currentState = 'wizardState'; break;
    case 1: currentState = 'tabState'; break;
    ]]>
    </mx:Script>
    <mx:Panel id="mainPanel" title="Tab View Bug" width="400"
    height="320"/>
    <mx:ComboBox id="stateBox" change="changeState()">
    <mx:dataProvider>
    <mx:Object label="Wizard" data="0"/>
    <mx:Object label="Tabbed" data="1"/>
    </mx:dataProvider>
    </mx:ComboBox>
    <mx:states>
    <mx:State name="wizardState">
    <mx:AddChild relativeTo="{mainPanel}"
    position="lastChild">
    <mx:HBox width="100%" height="100%"
    verticalAlign="top">
    <mx:ToggleButtonBar id="wizardButtonBar" width="20%"
    direction="vertical"
    dataProvider="{wizardViewStack}"/>
    <mx:ViewStack id="wizardViewStack" width="80%"
    selectedIndex="{wizardButtonBar.selectedIndex}"/>
    </mx:HBox>
    </mx:AddChild>
    <mx:AddChild target="{view1}"
    relativeTo="{wizardViewStack}" position="lastChild"/>
    <mx:AddChild target="{view2}"
    relativeTo="{wizardViewStack}" position="lastChild"/>
    <mx:AddChild target="{view3}"
    relativeTo="{wizardViewStack}" position="lastChild"/>
    </mx:State>
    <mx:State name="tabState">
    <mx:AddChild relativeTo="{mainPanel}"
    position="lastChild">
    <mx:TabNavigator id="tabViewStack" width="100%"
    height="100%">
    <mx:VBox label="Tab 1" id="tab1"/>
    <mx:VBox label="Tab 2" id="tab2"/>
    <mx:VBox label="Tab 3" id="tab3"/>
    </mx:TabNavigator>
    </mx:AddChild>
    <mx:AddChild target="{view1}" relativeTo="{tab1}"
    position="lastChild"/>
    <mx:AddChild target="{view2}" relativeTo="{tab2}"
    position="lastChild"/>
    <mx:AddChild target="{view3}" relativeTo="{tab3}"
    position="lastChild"/>
    </mx:State>
    </mx:states>
    </mx:Application>

    Ok, here is an even simpler scenario. I take each view from
    the default state and put them in the new tab view when the state
    changes. If you compile and run this example, the only view that
    makes it into the tabview is the one that was active when the state
    changed. Why is that?
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical">
    <mx:Script>
    <![CDATA[
    private function changeState():void
    switch(stateBox.selectedItem.data)
    case 0: currentState = ''; break;
    case 1: currentState = 'tabState'; break;
    ]]>
    </mx:Script>
    <mx:Panel id="mainPanel" title="Tab View Bug" width="400"
    height="320">
    <mx:HBox id="wizardView" width="100%" height="100%"
    verticalAlign="top">
    <mx:ToggleButtonBar id="wizardButtonBar" width="20%"
    direction="vertical"
    dataProvider="{wizardViewStack}"/>
    <mx:ViewStack id="wizardViewStack" width="80%"
    selectedIndex="{wizardButtonBar.selectedIndex}"
    creationPolicy="all">
    <mx:Canvas id="view1" label="Part 1" >
    <mx:TextInput text="This is view 1"/>
    </mx:Canvas>
    <mx:Canvas id="view2" label="Part 2">
    <mx:TextInput text="This is view 2"/>
    </mx:Canvas>
    <mx:Canvas id="view3" label="Part 3">
    <mx:TextInput text="This is view 3"/>
    </mx:Canvas>
    </mx:ViewStack>
    </mx:HBox>
    </mx:Panel>
    <mx:ComboBox id="stateBox" change="changeState()">
    <mx:dataProvider>
    <mx:Object label="Wizard" data="0"/>
    <mx:Object label="Tabbed" data="1"/>
    </mx:dataProvider>
    </mx:ComboBox>
    <mx:states>
    <mx:State name="tabState">
    <mx:AddChild relativeTo="{mainPanel}"
    position="lastChild">
    <mx:TabNavigator id="tabView" width="100%" height="100%"
    creationPolicy="all">
    <mx:Canvas label="Tab 1" id="tab1"/>
    <mx:Canvas label="Tab 2" id="tab2"/>
    <mx:Canvas label="Tab 3" id="tab3"/>
    </mx:TabNavigator>
    </mx:AddChild>
    <mx:RemoveChild target="{view1}"/>
    <mx:AddChild target="{view1}" relativeTo="{tab1}"/>
    <mx:RemoveChild target="{view2}"/>
    <mx:AddChild target="{view2}" relativeTo="{tab2}"/>
    <mx:RemoveChild target="{view3}"/>
    <mx:AddChild target="{view3}" relativeTo="{tab3}"/>
    <mx:RemoveChild target="{wizardView}"/>
    </mx:State>
    </mx:states>
    </mx:Application>

  • How can i read a stored picture in oracle Long Raw datatype? blob or clob?

    How can i read a stored picture in oracle Long Raw datatype? Like a blob or clob?....i am using jdk 1.3
    This is because...i tried to read it like a blob but i obtain a exception...about Type of column no valid......but the column exist....and it contains the long raw datatype of the pictures.....this is my code:
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.InputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.OutputStream;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.DriverManager;
    import oracle.sql.BLOB;
    import oracle.sql.BLOB.*;
    import oracle.jdbc.driver.*;
    import java.sql.*;
    class rec_ima1
    public static void main(String h[])
    Connection con = null;
    Blob bl;
    final ImageIcon image1;
    JPanel photo;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    con= DriverManager.getConnection("jdbc:oracle:thin:@123.3.12.213:1521:db_name","user","password");
    String query = "Select * from pictures where ID = '18840'";
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery( query );
    if (!rs.next())
    System.out.println("Empty Result Set");
    bl = rs.getBlob(5);
    if (bl == null) {
    System.out.println("Null Blob");
    return;
    InputStream is = bl.getBinaryStream();
    int imageLength = (int) bl.length();
    System.out.println(imageLength);
    System.out.println(bl.length());
    byte[] imageData = new byte [imageLength];
    is.read(imageData, 0, imageLength);
    image1 = new ImageIcon(imageData);
    photo = new JPanel() {
    public void paint(Graphics g){
    g.setColor(Color.lightGray);
    g.drawImage(image1.getImage(), 0, 0, this);
    } catch (Exception e) {
    e.printStackTrace();
    Now i tried using clob:
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.InputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.OutputStream;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.DriverManager;
    import oracle.sql.CLOB;
    import oracle.sql.CLOB.*;
    import oracle.jdbc.driver.*;
    import java.sql.CallableStatement;
    class rec_ima4
    public static void main(String h[])
    Connection con = null;
    Clob cl;
    JPanel photo;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    con= DriverManager.getConnection("jdbc:oracle:thin:@123.3.12.213:1521:db_name","user","password");
    con.setAutoCommit (false);
    String query = "Select * from pictures where ID = '18840'";
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery( query );
    while (rs.next()) {
    oracle.sql.CLOB clob = (CLOB) rs.getObject(5); //line 47
    } catch (Exception e) {
    e.printStackTrace();
    This is the runtime exception:
    java.lang.ClassCastException: [B
    at rec_ima4.main(rec_ima4.java:47)

    Thanks by answering to me......
    Well....i did that....but what is ImageIO?....
    I declared a ImageIcon imageIO, but this give me the following:
    rec_ima3.java:49: cannot resolve symbol
    symbol : class BufferedImage
    location: class rec_ima3
    BufferedImage bi = ImageIO.read(bInput);
    ^
    rec_ima3.java:49: cannot resolve symbol
    symbol : variable ImageIO
    location: class rec_ima3
    BufferedImage bi = ImageIO.read(bInput);
    ^
    What classes i have to import?.....what is ImageIO?
    Thanks

  • How can I read Extended APDU input to the same buffer

    The following is the code I am currently using where inBuffer is an intermediate array of 1000 length. However, I do not want to allocate any buffers at all, and just want to send a command apdu of 1000 byte length and modify it in the code and return the modified buf in the response APDU.
    // Read extended APDU input
    byte[] buf = apdu.getBuffer();
    short bytesRead = apdu.setIncomingAndReceive();
    short dataOffset = apdu.getOffsetCdata();
    // store first chunk in our intermediate byte array <-- how do i get rid of the intermediate array
    Util.arrayCopyNonAtomic(buf, dataOffset, inBuffer, (short) 0, bytesRead);
    // what is the overall length?
    short overallLength = apdu.getIncomingLength();
    short messageOffset = bytesRead;
    if (bytesRead != overallLength){ // otherwise we're finished, all bytes received
         short received = 0;
         do{
                   received = apdu.receiveBytes((short)0);
                   Util.arrayCopyNonAtomic(buf, (short)0, inBuffer, messageOffset, received);
                   messageOffset  += received;
              } while(received != 0);
    * REST OF CODE IN PROCESS METHOD
    I have also tried replacing the above code with the following
    short bytesLeft = (short) (buffer[ISO7816.OFFSET_LC] & 0x00FF);
    if (bytesLeft < (short)55) ISOException.throwIt( ISO7816.SW_WRONG_LENGTH );
    short readCount = apdu.setIncomingAndReceive();
    while ( bytesLeft > 0){
      // process bytes in buffer[5] to buffer[readCount+4];
      bytesLeft -= readCount;
      readCount = apdu.receiveBytes ( ISO7816.OFFSET_CDATA );
    as shown in the javadocs API, but it does not compile.
    This is my command APDU:
    /send 800100000003E8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003E8
    As you can see:
    CLA - 80
    INS - 01
    P1 & P2 - 00
    LC - 0003E8
    Data - 1000 0s
    LE - 03E8
    I am using JavaCard 3.0 with JCOP in Eclipse. How can I read the extended length apdu to the same buffer? I have no problem in returning an extended length response APDU. Thanks a lot for the help.

    You should not call the convenience method setIncomingAndReceive() in your first code. Please find out about the different APDU states. Furthermore, your Applet should implement the ExtendedLength tagging interface.

  • How do I read in a 1 Hz pwr level file and send it out at 1Hz to the signal generator?

    I would like to be able to read in a 1 Hz file and use the format into string and send it out at 1 Hz to a signal generator to vary the levels to match a timestamp. I was trying to use the format into string but I can't figure out how I could read in this file.
    00:00.0
    -113.586
    00:01.0
    -113.598
    00:02.0
    -113.61
    00:03.0
    -113.622

    If the file is a .csv file as you said in your other post, then you should just be able to use Read From Spreadsheet File, making sure to set the delimiter to comma rather than tab. If it's a small file, you can just read in the whole thing, then use a loop with a Wait For Millisecond Multiple node (the metronome) to send the data once every second.
    If the file is very large, and you don't want to read it all at once, you can tell the Read From Spreadsheet File node to read only one line at a time. Put the read node and the data sending node in the same While loop, and use a shift register to carry the Mark After Read value from one iteration into the Offset or Mark At Start terminal in the next iteration. That way, you start reading each line at the end of the previous one. Use some form of flow control (such as a Stacked Sequence Structure) to make sure things happen in the right order - read data, wait for the right time, send data. 

Maybe you are looking for

  • Error in ODS activation : URGENT

    Hi ! <b>ODS object 0FIAP_O03 was built incorrectly. Cannot update request REQU_CAZ1PIIRCEYV2WX9Z3H7MIZBU</b> <i><b>Diagnosis     The data request was a delta update, meaning, the data basis in the     source system has not changed since the last upda

  • Mad Men - "Unable to process your request?"

    Purchased Mad Men Final Season 2 weeks ago - but when I click your link it ain't working. Come on Apple!!! Please fix!! Thank you.

  • Adobe Reader X won't download

    Hi all, I am a Windows XP Home SP3 user with Kaspersky 2011 antivirus software.  I went to the Adobe Reader download page and clicked on the download link, which took me to the "Downloading Adobe Reader" page.  After giving the website permission to

  • Unknown Form Type while saving

    I am working on Devloper 2000 and developed a form for transfering data from SAP server to SQL server. The form is working fine.But I have one problem that while saving the form as <form name>.fmb it is saved as devloper form of unknown type and give

  • Call transaction and session method -urgent

    Hi,    can anybody tell me the diffence between call transaction and session method . what are the advantage of each method and when we go for it. how to see log file in session method. i will really appricitate