Reading 2 serial port in a same time

i want to monitor 2 type of data in a same time
 1- i have 6 sensor and i send them from micro avr and packed in this format >> 
printf("%4d%4d%4d%4d%4d%2d@%4.2f\r\n",a,b,d,c,e,p,f);
i want to recive all 30 data bytes  in one port then unpacked them...
2- i have a gyro sensor that sends data very slow every 500ms thats data like this   >> 
x+40.2\s\s\Y+42.3\r\n
i want recive all 16 data byte in another port and send feed back (write serial) too.
i recive gyro sensor data recive in fix 16 byte and dont have any problem  .
but i have problem that i dont recive fix data from 30 data(from micro) its hangs or recive lower.
its becuse i use 2port in same time if i use it alone there is no problem.i recive it fix.
plz help me.
also im sory im not good at english.
Attachments:
8-28-2012 8-07-41 PM.jpg ‏289 KB
read and write in 2 serial port.vi ‏28 KB

Hey,
I would first add some error handling to your loops.  The way you have it setup, the loops could be running in error and you will never know about it.  The code I have attached will stop the loop if an error occurs.
Does it throw any errors when you run it?
Lewis Gear CLD
Check out my LabVIEW UAV
Attachments:
read and write in 2 serial portv2.vi ‏28 KB

Similar Messages

  • How can collect the data from laptop sound card and serial port at the same time?

    I'm working on a project, I need to collect the data from laptop sound card, and also from serial port at the same time.
    The attachments are my VIs for sound card and serial port communication, I'm wondering that can I combine these two VIs together? Or can I run these two VI at the same time?
    Thank you!
    Attachments:
    AC_Radar_Receive.vi ‏46 KB
    RadarAudioPlug.vi ‏774 KB

    A smarter way is just to put all your code in the same VI.
    Two parallel loops if rates are different.
    Attachments:
    RadarAudioPlug.vi ‏450 KB

  • Write to serial port and digital port at the same time

    hello,
    I need to write to the digital port and the serial port at the same time. Right now I have the two vi's (to write to the serial port, write to the digital port) in the sequence structure. First I write the digital port, then write the serial port. Using the oscilloscope, the interval between these two executions is 10 ms; and I need to reduce this interval to as small as possible. I would appreciate help in any way. Thank you.

    Hello;
    This is a little tricky. Since the transition from one sequence to another is completely Software timed, and windows manages all tasks that are running at one given time, there isn't a method to reduce that transition time.
    The most you can do is try to optimize your code so all the time expent on the transition is due only to the task management.
    Hope this helps.
    Filipe A.
    Applications Engineer
    National Instruments

  • Re: if weblogic can serve two ports at the same time?

    That's not true. WebLogic supports a non-secure and secure listener port at the
    same time. That was one of the selling points for my organization.
    Michael Girdley wrote:
    If, you mean the same port on two different IP addresses, then the answer is
    yes.
    If, you mean two different ports on the same IP address, then the answer is
    no.
    Thanks,
    Michael
    Michael Girdley
    Product Manager, WebLogic Server & Express
    BEA Systems Inc
    fxy <[email protected]> wrote in message
    news:8fdk99$t9$[email protected]..
    <URGENT QUESTION>
    I'd like to know if weblogic can support two ports at the same time.
    thank you in advance.
    <URGENT QUESTION>

    Well, the question was really meant to see if any change was made to WL to support
    this, not because I didn't believe Michael Girdley.
    P.S., this is something Websphere 4.0 let's you do...In case this encourages someone
    to add this support.
    "Mike Reiche" <[email protected]> wrote:
    >
    If you don't believe Michael Girdley, then I don't know why you would
    believe anyone
    else. I believe the answer is still 'no'.
    Why do they 'have to be on different ports'? We block requests by URI
    - so just
    block all requests to /youradminapp/* at the firewall. Or you can block
    them at
    your Web Server. Or restrict them by user in WL.
    Mike
    you"Anil Arora" <[email protected]> wrote:
    Is it still true that WL 6.0 cannot host multiple (non-secure) HTTPports
    on one
    server? We need this capability within one JVM to allow one web application
    to
    be accessed from one port while another through a second port. Forexample,
    we
    have a application to be exposed through the firewall at port 7001.
    Then we have
    another admin application to only be accessed within the firewall. But
    they need
    to be deployed within the same JVM since they may have shared statebetween
    them.
    Thanks,
    Anil
    "Michael Girdley" <[email protected]> wrote:
    I'm sorry, to clarify my statement: I was speaking about nonsecure
    communications. Weblogic can only support one listener port at a time.
    Thanks,
    Michael
    Michael Girdley
    Product Manager, WebLogic Server & Express
    BEA Systems Inc
    Allen Akers <[email protected]> wrote in message
    news:[email protected]...
    That's not true. WebLogic supports a non-secure and secure listenerport
    at the
    same time. That was one of the selling points for my organization.
    Michael Girdley wrote:
    If, you mean the same port on two different IP addresses, then
    the
    answer is
    yes.
    If, you mean two different ports on the same IP address, then theanswer
    is
    no.
    Thanks,
    Michael
    Michael Girdley
    Product Manager, WebLogic Server & Express
    BEA Systems Inc
    fxy <[email protected]> wrote in message
    news:[email protected]...
    <URGENT QUESTION>
    I'd like to know if weblogic can support two ports at the same
    time.
    thank you in advance.
    <URGENT QUESTION>

  • Can two different local ips use the same port at the same time?

    Can two PS3s use the same ports at the same time. So let's say you have two PS3s and they need to open the exact same set of ports at the same time to be able to play the same game online. Is that possible on a regular consumer router such as the wrt310n? If so, then how would someone go about that. I am just asking out of curiosity.
    I don't work for Cisco. I'm just here to help.

    Use port range Triggering instead of Port forwarding. When you use port triggering then those ports will be opened for the entire local network.

  • MBA will not allow me to use both usb ports at the same time.

    My MBA will not allow me to use both usb ports at the same time. as soon as i plug the second in the first is disabled. trying to use a modem and printer.

    What kind of peripherals are you connecting? Sometimes if an external device is drawing too much power, then it will shut down one of the USB ports. Make a test connecting two usb flash drives, it should work ok.

  • I have a DAQ Assistant configured to read multiple channels at the same time. When I wire a graph indicator to the output, I see all of my signals jumbled together. How do I split them up into seperate signals?

    I have a DAQ Assistant configured to read 2 channels at the same
    time. When I wire a graph indicator to the output, I see the 2
    signals jumbled together. How do I split them up into seperate signals?
    When I wire any type of indicator it is showing just one output of a single channel.
    I want 2 indicators showing 2 different signals as expected from the 2 channels configured. How to do this?
    I have tried using split signal but it end up showing only 1 output from 1 signal in both the indicators.
    thanks in advance.
    Solved!
    Go to Solution.

    Yes you are right. I tried that but I did not get the result.
    I just found the way. When we launch split signal, we should expand it (split signal icon) from above and not from below. It took me a while to figure out this. 
    thanks 

  • I want to transfer data through the serial port in the same coding that hyperterminal uses. How can i do it?

    The serial port seems to be working, and labview seems to be sending the data, but the problem is in which format does it send the data, because in hyperterminal i just input the string "JDX" and it sends it to my device, with labview it sends something but my device does not recognize it.

    nobuto wrote:
    > I want to transfer data through the serial port in the same coding
    > that hyperterminal uses. How can i do it?
    >
    > The serial port seems to be working, and labview seems to be sending
    > the data, but the problem is in which format does it send the data,
    > because in hyperterminal i just input the string "JDX" and it sends it
    > to my device, with labview it sends something but my device does not
    > recognize it.
    Hyperterminal adds the carriage return/line feed to the string which is
    generated by the return key to send out the current line. LabVIEW simply
    sends out what you tell it, so try to set the string to "Show \ Display"
    format and add a \r or \n or \r\n to the command you want to send out.
    Assumes of course that you set the right baudr
    ate/bits/parity etc in
    LabVIEW with the VISA property node, when opening the serial port.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Reading and recording at the same time with AudioUnit

    Hi,
    I am trying to read and record at the same time on the iPhone with AudioUnit. For the reading part I made an AUGraph which works fine, constructed like that:
    NewAUGraph(&_graph);
    _outputUnitComponentDescription.componentType = kAudioUnitType_Output;
    _outputUnitComponentDescription.componentSubType = kAudioUnitSubType_RemoteIO;
    _outputUnitComponentDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
    _outputUnitComponentDescription.componentFlags = 0;
    _outputUnitComponentDescription.componentFlagsMask = 0;
    AUGraphAddNode(_graph, &_outputUnitComponentDescription, &_outputNode);
    _mixerUnitComponentDescription.componentType = kAudioUnitType_Mixer;
    _mixerUnitComponentDescription.componentSubType = kAudioUnitSubType_MultiChannelMixer;
    _mixerUnitComponentDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
    _mixerUnitComponentDescription.componentFlags = 0;
    _mixerUnitComponentDescription.componentFlagsMask = 0;
    AUGraphAddNode(_graph, &_mixerUnitComponentDescription, &_mixerNode);
    AUGraphConnectNodeInput(_graph, _mixerNode, 0, _outputNode, 0);
    AUGraphOpen(_graph);
    AUGraphNodeInfo(_graph, _outputNode, NULL, &_outputUnit);
    AUGraphNodeInfo(_graph, _mixerNode, NULL, &_mixerUnit);
    _generatorUnitComponentDescription.componentType = kAudioUnitType_MusicDevice;
    _generatorUnitComponentDescription.componentSubType = kAudioUnitSubType_RemoteIO;
    _generatorUnitComponentDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
    _generatorUnitComponentDescription.componentFlags = 0;
    _generatorUnitComponentDescription.componentFlagsMask = 0;
    for(int i=0; i< [_urlList count]; i++)
    SoundBuffer* soundBufferTemp = [_bufferSoundList objectAtIndex:i];
    AURenderCallbackStruct renderCallbackStruct;
    renderCallbackStruct.inputProc = MyFileRenderCallback;
    renderCallbackStruct.inputProcRefCon = soundBufferTemp;
    AudioStreamBasicDescription* inputAsbd = [soundBufferTemp getASBD];
    err = AudioUnitSetProperty(_mixerUnit,
    kAudioUnitProperty_StreamFormat,
    kAudioUnitScope_Input,
    i,
    inputAsbd,
    sizeof(AudioStreamBasicDescription));
    UInt32 zero = 0;
    err = AudioUnitSetProperty(_mixerUnit,
    kAudioOutputUnitProperty_EnableIO,
    kAudioUnitScope_Input,
    kInputBus,
    &zero,
    sizeof(zero));
    err = AUGraphSetNodeInputCallback(_graph,
    _mixerNode,
    i,
    &renderCallbackStruct);
    This works well, for the recording AudioUnit I did the following:
    OSStatus err;
    AudioComponentDescription audioComponentDescription;
    AudioComponent audioComponent;
    audioComponentDescription.componentType = kAudioUnitType_Output;
    audioComponentDescription.componentSubType = kAudioUnitSubType_RemoteIO;
    audioComponentDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
    audioComponentDescription.componentFlags = 0;
    audioComponentDescription.componentFlagsMask = 0;
    audioComponent = AudioComponentFindNext(NULL, &audioComponentDescription);
    err = AudioComponentInstanceNew(audioComponent, &_audioUnit);
    UInt32 size;
    size = sizeof(AudioStreamBasicDescription);
    err = AudioUnitGetProperty(_audioUnit,
    kAudioUnitProperty_StreamFormat,
    kAudioUnitScope_Input,
    1,
    &_soundFileDataFormat,
    &size);
    _soundFileDataFormat.mSampleRate = 44100.00;
    AudioUnitSetProperty(_audioUnit,
    kAudioUnitProperty_StreamFormat,
    kAudioUnitScope_Input,
    kInputBus,
    &_soundFileDataFormat,
    size);
    AudioUnitSetProperty(_audioUnit,
    kAudioUnitProperty_StreamFormat,
    kAudioUnitScope_Output,
    kOutputBus,
    &_soundFileDataFormat,
    size);
    AURenderCallbackStruct renderCallbackStruct;
    renderCallbackStruct.inputProc = MyRecorderCallback;
    renderCallbackStruct.inputProcRefCon = self;
    UInt32 one = 1;
    UInt32 zero = 0;
    err = AudioUnitSetProperty(_audioUnit,
    kAudioOutputUnitProperty_EnableIO,
    kAudioUnitScope_Input,
    kInputBus,
    &one,
    sizeof(one));
    err = AudioUnitSetProperty(_audioUnit,
    kAudioOutputUnitProperty_EnableIO,
    kAudioUnitScope_Output,
    kOutputBus,
    &zero,
    sizeof(zero));
    err = AudioUnitSetProperty (_audioUnit,
    kAudioOutputUnitProperty_SetInputCallback,
    kAudioUnitScope_Global,
    0,
    &renderCallbackStruct,
    sizeof(AURenderCallbackStruct));
    err = AudioUnitInitialize(_audioUnit);
    Then in I setup a file to write in:
    - (void) openFile
    OSStatus err;
    err = ExtAudioFileCreateWithURL((CFURLRef) _soundFileUrl,
    kAudioFileCAFType,
    &_soundFileDataFormat,
    NULL,
    kAudioFileFlags_EraseFile,
    &_extAudioFileRef);
    err = ExtAudioFileSetProperty(_extAudioFileRef,
    kExtAudioFileProperty_ClientDataFormat,
    sizeof(AudioStreamBasicDescription),
    &_soundFileDataFormat);
    err = ExtAudioFileWriteAsync(_extAudioFileRef,
    0,
    NULL);
    All this things works well (I check by printing err in the log which I removed here for clarity).
    And then in the callback for recording I do the following:
    static OSStatus MyRecorderCallback(void *inRefCon,
    AudioUnitRenderActionFlags* inActionFlags,
    const AudioTimeStamp* inTimeStamp,
    UInt32 inBusNumber,
    UInt32 inNumFrames,
    AudioBufferList* ioData)
    OSStatus err= noErr;
    AudioUnitRecorder* auRec = (AudioUnitRecorder*) inRefCon;
    [auRec allocateAudioBufferList:1 size:inNumFrames*4];
    err = AudioUnitRender(auRec.audioUnit,
    inActionFlags,
    inTimeStamp,
    inBusNumber,
    inNumFrames,
    auRec.audioBufferList);
    err = ExtAudioFileWriteAsync(auRec.extAudioFileRef,
    inNumFrames,
    auRec.audioBufferList);
    return err;
    (Then I close the file after recording at the same time I close the AudioUnit)
    Now the strange thing is that all this works perfectly well in the simulator: I can record and play at the same time but on the device, the callback for recording is not ran (I check by trying to print something in the log in the callback function.) which men no writing in the file and an empty file in the end.
    Any one has any idea of what could be causing this?
    Thanks
    Alexandre

    Just in case some one might need it, I solved my problem:
    I simply needed to initialize the AudioSession before playing/recording. I did so with the following code:
    OSStatus err;
    AudioSessionInitialize(NULL, NULL, MyInterruptionListener, self);
    UInt32 sessionCategory = kAudioSessionCategory_PlayAndRecord;
    err = AudioSessionSetProperty (kAudioSessionProperty_AudioCategory,
    sizeof (sessionCategory),
    &sessionCategory);
    AudioSessionSetActive(TRUE);

  • Read Serial port @100 us

    Hi guys,
    I'd like to know if Labview can read serial port @ 100 microseconds?
    Is it necessary any specific HW for  that? What HW can I use to read at that rate?
    Regards
    Kito

    Take 5-10 minutes and explain your problem much better. Like this. I have an instrument xyz. This instrument use a ZZZ communication protocol, over a YYY link. In my Labview program I want to achieve this XXX. This is what I have done so far.
    Remember good questions draw good answers.
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Is there an app for iPad which will allow me to read 2 books at the same time? 2 Books side by side.

    Is there an app for iPad which will allow me to read 2 books at the same time? 2 Books side by side. For example, one in English and the same book in Swedish. I'd use this in helping me to learn different languages. Any help would be appreciated.
    Regards,
    LB

    Have you searched for one? This is a technical forum. Look for what you want at the iTunes Store.

  • HT2470 how do i open finder whilst reading mac 101 tutorial at same time

    How do I open finder whilst reading mac 101 tuturial at same time?

    Click the Finder icon    left side of your Dock.

  • Can I play music and read a book at the same time?

    Can I play music on my iPad and read a book on my iPad at the same time?
    Little Fat Boy

    Little Fat Boy wrote:
    Why don't I try WHAT?
    Playing music and reading a book at the same time.

  • Occasional freeze when reading serial port

    I've a labview application which is a gui for a remote device via RS422.  The host computer is a quad core running XP SP3.  Initially I was developing with labview 7.1.1.  At random intervals (anywhere between 10 minutes and 5 hours observed), labview will freeze.  Using a port monitor during this freeze, I'm able to observe repeating calls for IOCTL_SERIAL_GET_COMM_STATUS followed by IRP_MJ_READ.  VISA is configured for 0.5s timeout.  The serial card is a MOXA, CP-114EL (4port RS422).  During the freeze, Labview cannot be closed.  Sometimes it will try by displaying the "Resetting..." text but it never completes.  A hard reset is then required.  After the freeze, processor usage is 25% (on average, 1 processor working full time for labview, but bouncing between cores).  Before the freeze, its less than 2%.
    At first I investigated the serial card driver via emails with MOXA.  After running a terminal emulation program and a loopback connector they gave me for several days without their program freezing, they're confident the problem isn't with their card or driver.  During discussions with them, I installed the evaluation of LabVIEW 2009.  The program still freezes except now I have less access to the VI (I used to be able to switch to the block diagram and via the highlighter tool observe it stuck in the read operation.  In either version though, the above mentioned port monitor output is the same.
    My instinct is that the source of the problem is in the multi-core application, some kind of timeout race condition.  My VI is fairly simple in summary, write a command (read temps, read status, write new params, etc) and wait for reply timing out if there's a problem.  Repeat.  Serial port is configured for 115kbps and transfers are in binary.  Before the freeze, the communication works well.
    I appreciate any suggestions.  I've looked around the net and this forum and didn't find anything similar.  Long time reader, first time poster.  I've a lot of experience in labview but can't solve this - the random interval doesn't help.  I think I'll start logging all serial transfers and see if anything always occurs before the freezing.

    This morning I updated the labview drivers to the most recent online (I hadn't done that yet when I installed LV2009, download was large).  It was something I planned to try if the LV2009 change alone did not resolve things.  The update also did not solve the serial freezing problem.
    I've attached two captures from NI Spy, one during normal operation and one of the last capture (up to the arrow).  I did a brief probing of a different VI that isn't a part of this afterward.  You can see the Read request of Com 2 for 266 bytes.  In the before image, red lines are timeouts.  So this read request is hung up waiting for bytes and never timing out.  That's at least my interpretation.
    I appreciate your and tbob's suggestions.  I've a new serial card (Brainboxes PX-310 card) to try coming soon, not that I don't want to solve this, I just can't spend too much time on it.  If it still gets hung up on the new card, I'll look into the motherboard PCIe port, maybe a failing transaction.  I would've went with the NI card but I need electrical isolation and 8 ports is excessive.
    Attachments:
    NI Spy - before freeze.JPG ‏104 KB
    NI Spy - after freeze.JPG ‏108 KB

  • How do I read and write at the same time using the NI-CAN channel API?

    Here's the situation.  I have one CAN bus, and I need to read and write channel data (using the channel API) at the same time both at an interval of 20 ms.  It's easy to do one or the other using the channel API, but you can't setup a channel task to do both.  It's either input or output, not both.  Is this even possible?

    Hi,
    yes , this is possible. But you have to create two tasks, one for input and one for output. see the attached example for LabVIEW.
    If you download and install NI-CAN 2.4 you will get this example and one for C and VB as well.
    DirkW
    Attachments:
    Single Sample Input Output same Port.vi ‏79 KB

Maybe you are looking for

  • Movie or Digital Copy Download Problems

    Hello everyone! I have a problem when downloading movie or digital copys here is a Cature of the error I get. Does anyone know how to fix this? Thank You!

  • Creative Cloud menu app switches desktop when opened

    Every time I open the Creative Cloud menu icon it switches my OSX view to a random other desktop space, usually my fullscreen Evernote. This is either a strange bug or very silly default behavior. I don't want to have to unpin it from the menu bar ju

  • About login_parameter 'use_sapgui' and 'abap_debug' in jco3.0.

    hello. in jco2.1.8 createclient,there is parameter  'use_sapgui' and 'abap_debug',but in JCO3.0 connectProperties,whether have the two parameter? how to write in java script? it's better to give example script. best regards. vera pang.

  • Vendor return delivery error

    Hi SAP , I have very critical issue to be resolved immediately in the area of Excise for CAPITAL GOODS, please help! The things is.... 1. At GR level using mvt 101, system is posting all BEDECSSECess to correct RG23C register, fine Quality people hav

  • Link error AIX 5.1 Ora 9.20 Perfstat library

    I cannot install 9.2.0 on my AIX 5.1. The links fail looking for libperfstat. I have bos.perf.perstat installed. Does anyone know what is wrong here? TIA, Paul