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

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."

  • 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

  • Envio de Trem de Pulsos pela porta SERIAL

    Olá pessoal. Eu preciso enviar  trem de pulsos de frequencia de 1Hz  com tempo em nível alto de 5us (micro segundos) durante uns 30 minutos  pelo pino 3 da porta serial ( Tx ). Ja montei o circuito de conversao de RS232 para TTL. E no programa ja fiz a rotina basica de envio de sinal pela porta serial e ja constatei seu perfeito funcionamento.  O meu problema é que nao consigo enviar um NIVEL 0 para a saida. No bloco respensavel pela escrita VISA SERIA WRITE o valor que coloco é representado em ASCII e nao consigo enviar um nivel logico zero na saida. Ja consultei a tabela e o codigo NUL que representa os bits 0 nao sai. Tentei usar o VI BREAK mas ele nao satisfaz meu projeto pois mantem o nivel baixo somente por 500ms e ocorre um certo delay.
    Resumindo COMO ENVIO UM BIT ZERO PARA SAIDA PELO VISA SERIAL WRITE EM ASCII??? Desejo que minha saida fique em zero por alguns segundos.
    Obrigado pessoal. Em anexo segue meu programa.
    Anexos:
    serial.vi ‏10 KB

    Oi Thiago,
    Na saída Serial, todos os valores '0' representam valores positivos e todos os '1' representam valores negativos. Para ficar mais fácil de entender, lembre que o MSB determina o sinal do valor:
    0xxxxxxx -> positivo
    1xxxxxxx -> negativo
    Este link fala um pouco mais sobre como medir os valores da porta serial e aborda esse assunto (as imagens não estão abrindo, mas você consegue abrí-las pelos arquivos em anexo):
    http://digital.ni.com/public.nsf/websearch/79B995C3638F4177862572C900593631?opendocument&Submitted&&...
    Para você que está trabalhando com comunicação serial, é legal também manter esse guia:
    http://www.ni.com/pdf/manuals/371253b.pdf
    Espero ter ajudado!
    Ricardo Ramos
    Engenheiro de Vendas - Sul
    National Instruments Brasil

  • How to get a signal from the serial port to start a labview program?

    I need to synchronize the data obtained from a program (which is not in Labview)with the data collected with Labview on a different computer. I can send some data strings to the serial port of the computer running the Labview program when the other program starts. However, I need to be able to read the trigger in my Labview program. Do you know what I should do? Thanks.

    If you don't have any other programs listening on the COM port, you need to let a LV program run BEFORE the signal comes, otherwise you won't be able to read it. You can have the program wait in a slow timed loop so that it doesn't use up too much CPU time, and when the required "trigger" comes, to move into the main part of the program.
    You basically need a while loop waiting for a certain string in the serial buffer. Once the string is found the while loop is exited, and the data acqquisition or whatever else you require from the progam can be performed.
    In the example attached the program wait for ANY text to be sent to the COM port. Please note that you need to configure the VISA resource before using it. Once there is something at the COM port, the loop will exit and the rest of the program will be executed.
    Hope this helps
    Shane
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
    Attachments:
    Wait for serisl message.vi ‏17 KB

  • Problem writing to serial port

    Hi All,
    I am very new to LabVIEW (just a couple of months). I need to communicate with a serial port of an Advanced Energy RF generator (Ovation) serial port (AE Bus)
    The manual talks about little endian conversion, CSR and checksum that I just can't make it work. does anybody know how to write and read to this serial port?
    I have used the write and read to serial port from examples with no luck and no response from the generator. I have attached the generator's manual here, the serial commands section starts at page 65 (4-25)
    Has anybody written a program to talk to Ovation RF generator? can anybody help me out and get me started? I am stuck!!!. ... appreciate your help. thanks.
    ~Johnny
    ~ Johnny
    Attachments:
    Ovation - AE RF generator.pdf ‏1444 KB

    Thanks... so I started with the basic serial write and read, enetered hex text strings into the serial write, including the checksum and what I read back is not always correct because for example I need to calculate the XOR in the program and not just eneter it as a hex value. I should also put the write and read into a loop because I will be writing and reading to serial port 2 dozen times.
    I am working with two devices, one is the generator, the other is a controller board that has a very similar serial bus structure as the generator's AE serial bus. the controller board has stepper motor drivers that move two variable capacitors. for the generator, I need to turn the power on and off and set to different power levels. for the control/stepper motor driver board: I need to read the values from a text file(attached). the text file has 3 table, table1, column1 is the number of steps that the stepper motor will move and column2 is the nominal capacitor values for C1. same thing table2; values are number of steps versus nominal cap values for C2. I need to creat a matrix such that to move the C1 to steps listed in the table, and for every step increment in C1, I need to move the C2 motor to 20 different position (listed in the table3 that has the desired percent value of total capacitance ) position and make a measurement of the impedance of the capacitors with agilant E5061 network analyzer and write the data back into the same text file at the end where it says "IMPEDANCE_REAL     in Ohm    one line per C1 position"  and into a excel sheet too while taking a measurement... and do the same thing all over again for C2 versus C1. I think  I need to use the producer consumer design pattern eventually when I get the details worked out first.
    any suggestion? .... much thanks.
    ~ Johnny
    ~ Johnny
    Attachments:
    Basic Serial Write and Read1.vi ‏24 KB
    cap-table.txt ‏7 KB

  • Delete in a string

    I need to send the following string to my serial port:   AT+BT!<del>!   where <del> is the backspace key
    How would I send the 'backspace' as described ?
    Thanks,
    Morné

    Concatenate a string constant to the string.  Set the representation of the constant to Hex display.  Put the value 08 into the string constant.
    Message Edited by Ravens Fan on 07-31-2007 10:47 AM
    Attachments:
    Backspace.png ‏2 KB

  • Storing foreign languages in a string

    Hi all.
    I have a multi-language application. It has a textfield that allows users to type in values in a language of their choice. This value is stored in a string. The class which contains this string will be serialized. My problem is how can I retrieve the value of that string, after de-serialization, and display it back to the user in the same language it was enter?
    My solution was to take the value the user has entered and convert it into unicode. Therefore, when I display the string, it will always be in the original language. Is there a better solution?
    thanks,
    Paul

    Strings are already in Unicode, you know. And you would have to do something to prevent the user from seeing what they typed in, if your code does what you say, so there must be something you haven't said.

  • Synchronise READ from Serial card when Counter on 6025 is incremented

    Hi!
    System description:
    I am using PXI-8423 (2-port RS-422) and PXI-6025 to measure the signal coming from 2 laser sensors mounted onto a mechanical stage with linear encoder.
    The laser sensors give RS-422 output (at 1KHz) and are connected to my serial card.
    The encoder gives quadrature output that I plan to connect to counters on my 6025 daqcard.
    Q:
    I want to read the laser data everytime the encoder gives a pulse signifying the mechanical stage has moved. How can I achieve this?
    We would be taking around 1000 serial reads (from each port) per second.
    Environment:
    We are using PXI-1031 chassis (4-slot) with PXI-8184 controller (850 MHz celeron). OS is Win2K prof. and LabVIEW 7.1
    Thanks,
    Gurdas
    [email protected]
    Gurdas Singh
    PhD. Candidate | Civil Engineering | NCSU.edu

    Hi Gurdas,
    We have some simple serial communication examples included in LabVIEW. Those example programs transmit any string of characters over the serial port. All you have to do is set which port you want to use, baud rate, stop bits, parity, etc. in the VI; this setting wil remain for each serial transfer while the program is running. Again, you can read/write any character string with the serial communication VI's. How the information is put into the character strings is up to you and the device you are communicating with. The serial communication is LSB before MSB.
    Regards,
    Salvador Santolucito
    Applications Engineering
    National Instruments
    Attachments:
    Basic_Serial_Write_and_Read.vi ‏66 KB
    Advanced_Serial_Write_and_Read.vi ‏105 KB

  • VISA Serial and Elapsed Time as a Timeout

    Hi folks,
    Still new to LabView, so please bear with me...
    I have a VI that sits and wait for a certain character string to arrive over the serial port, but I need a timeout that doesn't rely on the VISA timeout.
    I expect a bunch of text through the serial port for ~45 seconds, then my input string will compare the matching string and move on to the next VI.
    In the event of no string match, the serial port may keep on sending serial data, or may be inactive (non-determinisitic because this test is to see if a computer system booted correctly). But once the VI starts, I should have 60 seconds to find the match, or set the bool output 'selection' to fail.
    I have tried putting my Elapsed Time loop inside the main loop, outside, with/without SRs, and now I'm at a loss. I looked at the VI highlighted and the serial activity wasn't active until the 60 second timer expired.
    Please take a look at the attached, and thanks for taking a look at this post.
    Solved!
    Go to Solution.
    Attachments:
    Untitled 1 (SubVI).vi ‏33 KB

    I'm not entirely certain that I understand what you are trying to accomplish. However here are my thoughts:
    The VI you attached will wait 60 seconds before checking the serial port for waiting bytes ONCE then read bytes if they are availale and quit immediately. This is because you have the while loop around the elapsed time and it must execute completely before moving on to the serial communication loop.
    I assume you have setup the serial port and set termination characters, etc in a main vi
    Please try the modified VI attached and let us know if that helps
    Thanks,
    Charles Chickering
    Charles Chickering
    Architecture is art with rules.
    ...and the rules are more like guidelines
    Attachments:
    Untitled 1 (SubVI) Modified.vi ‏33 KB

  • Join two 8 bit integers and send via Serial Port

    I am trying to join two 8 bit integers and send the result via the serial port.
    I have a constant of hex value A that I need to join with a value from hex 0 - F (this is based on incoming data)
    When I use the Join VI, and type cast to change from hex to string for Visa Write, I recieve hex 0A0F.
    I have been able to use the hex 0-F with a case structure and then wire the corresponding constant ex A0 - AF.
    This makes the program very cumbersome and labour intensive to change. I have 22 commands I have to respond to with the address of 0-F.
    Currently, I have a Case structure that is selected with Message ID, then a case that is selected with subtype and then a case for address.
    Therefore I have to create a constant inside of each address case for each message as the responses are different.
    Thanks for any help
    Robin

    Gambin,
    As I understand it, you want to take the two bytes, put them together,
    and output the result as an ASCII string on the serial port.  This
    is easy.  Simply convert each number to an ASCII string,
    concatonate the two characters together, and send the resulting string
    to the VISA write function.  That's it!  I have attached a VI
    (ver. 7.1) that takes two hex numbers as input, converts them to ASCII,
    concatonates the results, and outputs the 'command' string.  Fell
    free to modify this vi and use it as you see fit.  I have left
    extra terminals in case you want to add error input/output for data
    flow, or whatever.  Notice that the display for the concatonated
    string is in '/' Codes Display mode.  This is because 0A hex is
    the newline character in ASCII.  You should also check to make
    sure that your VISA serial settings are not setup so that the newline
    character is the termination character.  If it is, the second
    character may not be recognised.  Hope this helps.
    Roy
    Attachments:
    HextoCommand.vi ‏17 KB

  • Acquisition of data serial

    Hello,
    I would like an information about LabView.
    I need to monitore a serial line through the C-rio and to convert this digital sign in a binary number or hexadecimal.
    To convert the digital sign for binario, it's necessary store the frames in a vector (the message can be from 8 to 572 bits).
    The problem is to store in the vector the bytes (the acquisition use a boolean signal).
    - How can I make this?
    - Do you know some VI to do this convertion?
    Already thanking!
    FabianoF.

    Fabiano,
    I'm not sure I understand your question, but I'll try an answer :
    you need to convert a series of bytes received as a string on your serial port. There is a string to byte array function to do this conversion, as shown in the attached png.
    Message Edited by chilly charly on 06-12-2005 05:19 PM
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    string to byte array.png ‏2 KB

  • How not to omit leading binary zeros with format into string

    I'm using format into string to format serial data .  The problem I'm having is that Format into String with "%b" format identifier omits leading zeros
    in the string..   ie...  "3" becomes "11" when I need it as "0011"
    Solved!
    Go to Solution.

    see figure:
    Attachments:
    Example_VI.png ‏3 KB

  • Splitting string into multiple string output

    Hello,
    I have this string input from serial port which looks like this:
    Voltage20Current10Temperature32
    They are all tab delimited. 
    And I need them to split into three outputs (possibly converted to numerals) -->
    Output1 --> 20 
    Output2 --> 10 
    Output3 --> 32 
    Your help will be appreciated. Thanks.
    Solved!
    Go to Solution.

    Hi Manu,
    Try the attached example.
    Regards,
    Nitz
    (Give Kudos to good Answers, Mark it as a Solution if your problem is Solved) 
    Attachments:
    Untitled 3.vi ‏6 KB

  • Corrupted serial data when reading

    Hello Friends
    Im working on a project that read a string through the serial port from a flow meter.
    the string that the flow meter sends has this pattern. its a comma separated string:
    0021,00029504,00032622,0115,0,0,00000000,00000006,​0000,00000000,00000000,0000,0,0,00000000,00000000,​18:14:48,12/04/12,2110,00000000,0
    i already proccesed the data with this VI (please fell free to give me any suggestions ). Please see 1.jpg
    I am having the following issue. when receving data from serial, several strings show up corrupted. please see good.jpg and bad.jpg. i have tried to read the serial data on hyperterminal, and all strings show up ok.
    i will appreciate any suggestions and advises on how to fix this!
    thanks in advance
    Attachments:
    1.JPG ‏71 KB
    good.JPG ‏14 KB
    bad.JPG ‏13 KB

    moreins1 wrote:
    hello
    actually, i have one more question.
    this is the data viewer i have on my vi. it shows each data string that my serial device is sending. this string will change 10 times in a second. this is OK. right now, its showing 1 string at a time:
    0021,00029504,00030816,0110,0,0,00000000,00000009,​0000,00000000,00000000,0000,0,0,00000000,00000000,​18:14:54,12/04/12,2173,00000000,0
    what i want now is to actually append all this data in the viewer so i can copy and pasted it to notepad. i would like it to show like this:
    0021,00029504,00030816,0110,0,0,00000000,00000009,​0000,00000000,00000000,0000,0,0,00000000,00000000,​18:14:54,12/04/12,2173,00000000,0
    0021,00029504,00031123,0107,0,0,00000000,00000009,​0000,00000000,00000000,0000,0,0,00000000,00000000,​18:14:54,12/04/12,2174,00000000,0
    0021,00029504,00030948,0104,0,0,00000000,00000009,​0000,00000000,00000000,0000,0,0,00000000,00000000,​18:14:54,12/04/12,2175,00000000,0
    0021,00029504,00030866,0103,0,0,00000000,00000009,​0000,00000000,00000000,0000,0,0,00000000,00000000,​18:14:55,12/04/12,2176,00000000,0
    0021,00029504,00030903,0105,0,0,00000000,00000009,​0000,00000000,00000000,0000,0,0,00000000,00000000,​18:14:55,12/04/12,2177,00000000,0
    0021,00029504,00030888,0105,0,0,00000000,00000009,​0000,00000000,00000000,0000,0,0,00000000,00000000,​18:14:55,12/04/12,2178,00000000,0
    0021,00029504,00030836,0104,0,0,00000000,00000009,​0000,00000000,00000000,0000,0,0,00000000,00000000,​18:14:55,12/04/12,2179,00000000,0
    0021,00029504,00030545,0095,0,0,00000000,00000009,​0000,00000000,00000000,0000,0,0,00000000,00000000,​18:14:55,12/04/12,2180,00000000,0
    and so on.........
    Can you please advise on how to do this without actually monkeying around with the VISA inicialize?
    thanks!
    You're gonna have to put that string into a shift register to bring it back around.  Then you'll have to concatenate it with the current string (add a return so they end up on different lines) and take the output to your indicator.  Be careful what you wish for... if it's updating 10 times a second, it will eat up memory like crazy.
    [edit]
    Didn't realize you wanted to cut n paste to notepad... why not just take the original output to a file instead of an indicator?  Cross beat me to it.
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

Maybe you are looking for

  • Microsoft written application connectin to Database

    My application is written in C++ using Microsoft Visual Studio. How would I connect to database & retrieve information (insert/update/...)?

  • Condtion record -Price element inactive -Inactive Via Formulas or Incorrect

    Hi experts, I am trying to use pricing condition in bespoke service order. When I add product to it, I don't get the net value. When I click on product then I get all condition records but condition record with bespoke condition type are marked red a

  • Touchpad of the Zen Touch doesn´t react anymore..

    Hey all, I got my old Zen Touch(20GB) for maybe more than 2 years and it was my best friend at all the time,never had any problems with it... But suddenly(yesterday) the touchpad is broken... Nothing happend... hasn?t fall to the ground or damaged...

  • Add intermediate certificate to signed jar

    Is it possible to add an intermediate certificate to a signed jar file? The users of my applet are asked to trust the certificate showing the hint that the source is not trusted. The root certificate of my code signing certificate is included in the

  • Conditional Branching with quiz slides not working

    Attempting to use conditional branches with quiz slidescauses the other quiz slides in my presentation to not work correctly. I am attempting to create a 'test-out' pre-quiz for a segment of slides in the presentation. I followed the instructions to