Implementar protocolo de comunicação serial UART no LabVIEW

Boa Tarde,
Estou querendo implementar o protocolo de comunicação serial UART no LabVIEW.
A descrição do projeto é mais ou menos essa:
- Uma Interface no LabVIEW para receber o dados enviados pela serial UART;
- Uma DAQ NI USB-6212 irá receber o dado por um pino digital ou analógico (a princípio estou usando um pino analógico);
- Um microcontrolador que envia dados através da serial UART;
- Sistema operacional Windows 7;
Estou querendo implementar o protocolo de comunicação pelos motivos:
- Usei o Visa da comunicação serial e um cabo USB-Serial genérico, mas não consegui taxas de recepção rápidas como eu preciso, quando eu tentava transmitir dados de forma mais rápida, eles chegavam corrompidos;
- O exemplos que encontrei do protocolo implementado usam o LabVIEW FPGA, e pelo que eu li minha placa de aquisição (NI USB-6212) não suporta FPGA.
Tem algum exemplo ou sugestão de como devo proceder.
Desde já agradeço.
Atenciosamente,
Fernando Esquírio Torres

Good morning,  Fernando,
Here are some links to help in its implementation. Any questions please contact us.
What Is the Basic Architecture for Serial Communication?
http://digital.ni.com/public.nsf/allkb/E0D95CB9249FB8CF86256C68007B1F81?OpenDocument
Can I Do 9-bit Serial Communication Instead of 7 or 8 bits?
http://digital.ni.com/public.nsf/allkb/3BDC7FF03541F772862564990057F919?OpenDocument
9-Bit Serial Writing in LabVIEW
http://digital.ni.com/public.nsf/allkb/E0D95CB9249FB8CF86256C68007B1F81?OpenDocument
Serial Communication Starting Point
http://zone.ni.com/devzone/cda/tut/p/id/4049
Serial Communication - Basic Serial Write and Read
http://zone.ni.com/devzone/cda/epd/p/id/2669
Enviar ou Receber Dados Binários / Hexadecimais Utilizando NI-VISA no LabVIEW
 http://digital.ni.com/public.nsf/allkb/33C1056D66078118862577450061E683?OpenDocument
Sending and receiving serial commands using VISA
http://zone.ni.com/devzone/cda/epd/p/id/2423
Sincerely,
Mauro Vera
Applications Engineer
National Instruments

Similar Messages

  • Projeto - Reconhecimento de Voz e Comunicação Serial

    Olá, estou desenvolvendo um projeto no qual devo reconhecer comandos de voz e enviar posteriormente informações através de comunicação serial.
    A idéia do projeto é a seguinte :
    - Reconhecer comandos de voz como "POSIÇÃO 1, POSIÇÃO 2"
    - Para cada comando reconhecido, uma mensagem deve ser enviada via comunicação serial.
    No entanto, não venho conseguindo reconhecer comandos de voz através de alguns VI's fornecidos pela NI, então venho pedir ajuda para procurar um caminho para começar a construir tal projeto.
    Grato desde já.
    Gilberto Neto
    Estudante de Tecnologia em Mecatrônica Industrial
    Faculdade de Tecnologia Termomecanica

    Olá, achei bem interessante este projeto, porém tenho algumas perguntas:
    Existe alguma especificação quanto ao Hardware para capturar o sinal?
    Quando você diz: "Reconhecer comandos de voz como "POSIÇÃO 1, POSIÇÃO 2", você está se referindo que o conteúdo da mensagem falada é "POSIÇÃO 1,POSIÇÃO 2" ou que isso é uma mera identificação para uma mensagem diferente?
    Capturar o sinal emitido pela voz é relativamente fácil,porém a identificação e interpretação desse sinal que é algo mais complexo (Relativo a segunda pergunta que eu fiz). Com as VI's da paleta (Sound), você irá apenas coletar esse sinal, porém a análise heurística para interpretação fica a cabo do desenvolvedor. Felizmente, existem algumas Library como o SAPI e outras para abreviar este processo.
    Sobre a serialização deste sinal, você será basicamente "obrigado" a trabalhar com filas de tamanho fixo , pois os dados devem ser armazenados em sequência e serem despachados em blocos ANTES de serem repassados as funções VISA. Uma dica é repassar essa informação utilizando dados do tipo Digital (0,1) em vetores bidimensionais para assegurar que a mensagem seja serializada completamente (sem perder nenhum bit pelo caminho)
    Você irá precisar de 3 Loops: Um para a captura dos dados, um para interpretação e arranjo e outro para envio das informações. Pesquise sobre a arquitetura QMH ou P/C. Não é necessário usar nada mais complexo neste quesito
    Espero que eu tenha ajudado
    "In theory, theory and practice are the same. In practice, they’re not."

  • String comunicação serial

    Boa noite!
    Estou fazendo um programa no Lab View que recebe dados via comunicação serial através de 1 câmera que busca posicionamento de 2 objetos, que um outro software tem que passar a posição de cada um dos objetos nos eixos x e y, e então os dados são passados pro Lab View. Recebi a indicação de utilizar a VI Basic Serial Write and Read, mas não faço ideia de como faço para integrar com a VI de controle (com a integração, eliminarei os 4 indicadores de entrada)
    Obrigado.
    Anexos:
    Basic Serial Write and Read.vi ‏21 KB
    robo10.vi ‏17 KB

    Oi Ricardo, tudo bem?
    Este VI Basic Serial Write and Read é um exemplo de comunicação serial na qual o VI primeiro envia um string de comando (por dafault está enviando o comando "*IDN?\n"),  e posteriormente aguarda pela resposta do equipamento. Normalmente os dispositivos com comunicação serial funcionam dessa maneira: você primeiro faz a requisição do dado que você quer saber e o dispositivo responde de volta.
    Na sua aplicação, pelo que entendi, você precisará ler esses dados constantemente. Então você deve utilizar o VI Basic Serial Write and Read como um subVI dentro do seu While Loop, passa os valores para as entradas do subVI e trabalha com os dados de saída.
    Entretanto esta não é melhor solução para o caso. O ideal é você estabelecer a comunicação fora do seu loop e apenas enviar/receber os dados na estrutura de repetição, finalização a comunicação após o loop finalizar.
    Não sei se fui muito claro. Qualquer dúvida é só perguntar!
    Abraços,
    Ricardo Ramos
    Engenheiro de Vendas - Sul
    National Instruments Brasil

  • How would I interface an instrument with a serial UART output to LabVIEW?

    I am trying to gather some information on a upcoming project. I have a instrument that outputs a serial UART stream. I would like to interface this with LabView. This is the product that I am planning to interface with. http://www.pressureprofile.com/products-digitacts.php I am just learning how to use LabView so this is all new to me, any help would be greatly appreciated.

    First- I would recommend takinga look into the Basic serial read and write example that ships with LabVIEW.  Second, RTFM (Read The Friendly Manual) for the device.  A Google search for serial comms will provide a reasonable backround for how serial comms can be configured. 
    As to how to implement the specific serial protocol in LabVIEW-- well, use a VISA call to the serial port to configure the various properties of the VISA ser:instr class and IF you learn the equipment's expected settings and what, and when, it responds, the "nuts-and-bolts" of wiring your device driver becomes reasonably simple.
    Jeff

  • How to transfer file from PC to PC via serial port using labview

    I need to transfer files(.txt, .doc, .xls) from PC to PC via serial port using LabVIEW. Is it possible to transfer files, if so how to transfer?
    Solved!
    Go to Solution.

    Yes, it is possible to transfer files with the serial port using LabVIEW.  Files are just collections of bytes and the serial port is pretty good at shipping bytes from one PC to another.  You need to connect the serial ports together with a null modem cable.
    First, take a look at the example for serial communication.   In LabVIEW, go to the Help menu and select "Find Examples...".  From there you can search for "serial" or navigate to Hardware Input and Output >> Serial.  Select the "Basic Serial Write and Read.vi".  Experiment with that example to gain confidence on the serial communication methods.
    Next, it's time to learn about how to read and write files.  For that, the examples could be somewhat confusing since they all deal with files that are presumed to have data of a specific type in them.  I would recommend just getting familiar with the functions on the File I/O palette.  Specifically, get to know the following functions.
    Open/Create/Replace File - On your destination side, you'll need to create the copy of the file that you are trying to transfer
    Close File - When you are finished reading from or writing to a file, you should close it.  It cleans up the memory being used and finalizes any write operations that are still floating in the write buffer.
    Read From Binary File - The best way to read from a file when you do not really care what type of file it is.  In your case, you just want to get those bytes read and sent out so they can be written down at the destination.
    Write to Binary File - At the destination side, this is what will store those bytes to the file you created with number 1.
    Get File Size (under the Advanced File Functions sub-palette) - You need to know how big the file is so you know when you are finished.
    OK, so once you are able to create files, write bytes to them, and read bytes from existing files you can move on to transferring.
    The basic method I would suggest is to have the user specify a source file on the source PC and a destination folder on the destination PC.  Then, find out the size of the source file using number 5.  Divide that size number by the number of bytes you feel like transferring at once.  The serial buffers are usually around 32k (if I remember correctly) so do not exceed that.  Now begin sending data by reading some number of bytes and wiring that string output to the VISA Write function.  On the destination side, you'll want to be monitoring the serial port for bytes and reading them when they arrive.  Wire that string to the Write to Binary File function to add them to your destination file.
    That is the basic outline of how to do it.  You have to be careful not to overload the write and read buffers on the serial ports.  Initially you can use delays on the sending side to make sure the reading side has enough time to digest.  To get things moving faster, you can bring in some flow control.
    If all that sounds a bit intimidating, there are Alliance Member companies out there (such as PrimeTest Automation) who can write such code for you and even provide a turnkey solution for you.
    Happy wiring,
    Dan Press
    Certified LabVIEW Architect
    PrimeTest Automation

  • Communication through RS232c serial interface using labview

    i am trying to communicate with a device through RS232c serial interface using labview 6.1....i have tried to run the example "Serial communication.vi" provided in 6.1 and it doesnt work....do i need any special hardware or do i need to configure my hardware to communicate through RS232c...
    thanks in advance
    shri

    Seems like I placed a small (maybe 30ms) delay at the end of the serialcommunications.vi structure.. for some reason my PC didn't like running as fast as it tried to go. Also look into the actual serial communication.vi and open the vi's inside it - check that the port setting (0 or 1) are ok, the baud rate (probably 9600) are ok. I'm running with only three wires in my application, TX, RX and Common. The PC may need to be rebooted to enable the com port - or use device manager and see if it says the com ports 0 and 1 are both OK..
    Try buildinga loopback plug with TX to RX, RX to TX, and Common to Common and see if hyperterminal (or other serial communications program works - there is also Loopback.VI in the NI library somewhere that can be used. Good Luck!! Dave

  • How to display the serial waveform on Labview

    Hi,
    I'm a newbie in Labview Programming. Is it possible to display the serial waveform on the display using Labview?
    From
    Don

    RS232 transmits binary. If you transmit the character A, that gets converted to hex 41 or 01000001 (assuming 8 data bits). There is also start, stop, parity bits. The logic levels for RS232 can between +3 to +12 volts or -3 to -12 volts. When you use LabVIEW to read a serial port, the UART in the pc will convert that digital data back into the character A and that's what LabVIEW or any other communications program like Hyperterminal will read. What exactly do you have hooked up to the serial port of the pc? Is it some kind of instrument or what? If it's an instrument sending data, then how the data is interpreted is dependent on the instrument. It might send back a reading as text. A 1 volt measurment might be transmitted as the ASCII characters "1" and "v". Other instruments might encode the data differently. Measurements made over a serial port can be easily visualized. Plain text received over a serial port is usually displayed as text.

  • Serial IO using LabVIEW CLFN

    BACKGROUND
    I have written LabVIEW wrappers for a DLL device driver. One function of the DLL responds to hardware interrupts and one input to this function is a pointer to a user function (to be called when an interrupt occurrs). Since a LabVIEW CLFN can not accept a pointer to a function I wrote a wrapper DLL which accepts a Dynamic User Event Reference and internally calls PostLVUserEvent(userRec2, &testData);
    so far so good.
    The PROBLEM:
    Another input to the function accepts TYPE which defines the communication protocol. Options are ARINC 429 (an aviation standard), serial 232, serial 485. I tested this originally using ARINC429 and everything runs great. When 232 is selected, immediately upon an interrupt LabVIEW locks up requiring Task Manager to quit LabVIEW, or in somecases powering down the PC. In C code the sample runs fine. The problem (in LV) appears to be in handling the interrupt only when serial is selected. My wrapper DLL includes three header files: #include "extcode.h" #include "hosttype.h" & #include "std429.h"  I have confirmed with the client that their header "std429.h" includes serial IO and serial prototypes (I was hoping that was the issue). Would there be any other #includes necessary (or any other "known quirks") with using LabVIEW to access Serial IO through a DLL?
    thanx
    lmd2
    Lawrence M. David Jr.
    Certified LabVIEW Architect
    cell: 516.819.9711
    http://www.aleconsultants.com
    [email protected]

    Okay, more information: the code seems to be working to a point. The action that we are using to trigger the interrupt is keyboard input from a hyperterminal configured to 9600 baud. The VI runs fine until I type a single letter. At this point the processor gets pegged (Task Manager is open and minimized). Within the event structure I have just an increment (for the time being). Hitting a single letter should trigger a single interrupt and I should see my probbe go from 0 -> 1. Because everything is bogged down (processor pegged) the probe doesn't update for a while but when it does it says over 7K. As I am typing this I just saw another update (I have NOT typed more than 1 letter) the probe now reads 27084
    So what should have been a single one time event seems to have latched somehow ON and is continuously firing and using 100% of my processor.
    This make sense to anybody?
    thanx
    lmd2
    Lawrence M. David Jr.
    Certified LabVIEW Architect
    cell: 516.819.9711
    http://www.aleconsultants.com
    [email protected]

  • Has anyone implemente​d the Amulet Serial Protocol for LabVIEW?

    If not, is anyone interested in helping implementing one? I know a lot about the Amulet Serial Protocol, but nothing about LabVIEW. Willing to throw in an Amulet Starter Kit as well.

    Amulet Technologies (http://www.AmuletTechnologies.com) has a revolutionary technology which allows you to rapidly author a graphical user interface for LCD's (liquid crystal displays) using drag-n-drop HTML tools. In other words, Amulet is to LCD's like LabVIEW is to personal computers. Interfacing Amulet to an external device(s) for I/O is done through a serial connection.

  • Serial works in LabView and not in C++

    Hey,
    I’m using Qextserialport 1.2 alpha in my project. (QT C++ programing)
    I got invalid data when I use other windows application while I’m recording the data at hight rate of 400hz.
    BUT, when I first open the port via HyperTerminal or LabView and then I connect throw my SW, the problem is vanished.
    The problem doesn happend in low rate (1h,10h)
    Any Idea?!?
    port = new QextSerialPort(portName,QextSerialPort::EventDriven);
    if(!port->open(QIODevice::ReadOnly )) {
    qDebug("Cannot open serial port: %s Error: %s",
    portName.toAscii().constData(),
    port->errorString().toAscii().constData());
    return -1;
    connect( port, SIGNAL(readyRead()), this, SLOT(onReadyRead()));
    port->setBaudRate(BAUD921600);
    port->setDataBits(DATA_8);
    port->setParity(PAR_NONE);
    port->setStopBits(STOP_2);
    port->setFlowControl (FLOW_OFF);
    port->setRts( true );
    port->setDtr( true );
    My setup:
    Win XP sp3
    QT 4.7.0
    Thanx!

    Thanks for your replay.
    I'll try to be more clear about what I mean in "windows application".
    While I'm recording data with my SW, each change that happened i.e. maximize or minimize the SW window or opening other document can damage the recording data.
    This doesn't happened when I first open the LabView SW then connect and disconnect from the serial comport.
    And then open my SW, connect the serial port start recording data and I can maximize or minimize the SW while recording and it won't damage the record.
    P.S. I need to record the data with my SW and not with LabView.

  • How to set the number of packets to be send per second to the serial port in labview

    hi.
                  i have to send data to serial port such that each packet of data should be send at a rate of 4 packets per second?? how can it be done??
    thanks and regards
    Solved!
    Go to Solution.

    What defines a packet?
    You just need to have a while loop that has a wait timer in it of 250 milliseconds surrounding your VISA write function.

  • Using serial Ports in LabVIEW

    i am using LabVIEW 6.1 on windoes NT 4.0. what modes are supported? i need to use RS 422. is this possible?

    Be very careful about installing non-standard serial cards in a PC
    running NT. The NTSERIAL driver will try to control these non
    standard cards (but won't be able to) and won't let the manufacturer's
    driver control it unless you follow the card manufacturer's
    instructions to the letter. Typically this involves installing the
    manufacturer's software FIRST, setting the configuration, setting any
    dipswitches or jumpers on the card, and THEN LAST, powering down,
    installing the card, and powering back up. BUT PLEASE FOLLOW THE
    MFG's INSTRUCTIONS, not mine if they differ.
    Blackbox makes an RS422/485 card and I believe so does NI.
    Douglas De Clue
    LabVIEW programmer
    [email protected]
    Sanjay wrote in message news:<50650000000500000063
    [email protected]>...
    > 1) The standard/built-in serial ports on your computer are almost
    > certainly not RS-422 compatible (they're actually almost certainly
    > RS-232). NI (amongst other serial vendors) sells RS-485 serial
    > interfaces that are fully RS-422 compatible.
    > 2) From a software standpoint you can use the VISA-Serial VIs
    > (recommended) or the I/O compatibility VIs to control either RS-232,
    > RS-422 or RS-485.

  • How do I control serial power using LabView?

    I need to use LabView to alter the voltage coming from the serial port. Is it as easy as writing to the serial port? I know that if you write to the serial port that it'll produce a binary number, does this binary number correspond to a voltage.

    If you want to create a scalable voltage value coming from the serial port you must have a Dig -> Analog conversion circuit.
    If your goal is to vary a voltage from 1 - 10 vdc, then you must create:
    1) a an external circuit that will convert/buffer digital serial interfaced binary values to analog values (ni makes these things)
    2) labview code that transfers info to serial port. (driver/etc)
    hope that helps!
    did that answer your question?
    Chances are if you have seen VI in the forest it hasn't fallen.

  • "how to read serial port using labview 6.0"

    sir i am doing a project and is in a need to extract data from serial port. can anyone help me

    This link, and the links from it, are a great place to start:
    http://zone.ni.com/devzone/conceptd.nsf/webmain/8DECBF3E0B714BF3862568F9006E7851?opendocument
    2006 Ultimate LabVIEW G-eek.

  • Problems with Serial Communication using Labview 6 and Solaris 8

    I am working on a Driver for a Temperature Controller. But I am stuck at the very basics. I am using Labview 6 and the platform is Solaris 8 on a SUN Ultra 60 Workstation. I can not get the Serial communication to work. When I am running raw (uncompiled) code it works (I can read from and write to ttya and ttyb) but once compiled I get error code 37 (device not found). I have tried the following steps to fix this with no luck.
    1) I made sure that the "serpdrv" file is in the same folder with the executable. I also make sure the serpdrv file is added as a support file when building the app.
    2) I changed from using traditional serial VI's to labview 6's new visa functions. With these "new" VI's when
    I try to initiliaze the visa device and wire a control to the "visa reference" input only 1 serial port shows up (ASRL2, missing ASRL1). I am not sure if this is part of same problem or whole new issue.
    3) I reinstalled both visa and labview 6.0.2 update hoping this would help with no luck
    4) I placed the following entry into the ".labviewrc" file
    labview.serialdevices: "/dev/ttya:/dev/ttyb"
    If anybody has had the same problem I would love to hear about it and if you have any solutions
    Jamie Shea

    Hi Jamie,
    1. Do you have NI-VISA driver installed on the machine on which you are running this executable?? If you are trying to run the executable on the same machine on which the development program has ran fine, then you can ignore this point.
    2. If you have done all the changes that are suggested by other discussions related to this topic, then try changing the Port input to Visa Serial Configure.Vi from a control to a constant and try it. In some case, I have seen this to do the trick. I think this point should solve your problem. If it does do tell me. :-))

Maybe you are looking for