Showing results for 
Search instead for 
Did you mean: 

Serial Port Write

I am new to labview and need some help. I'm wondering if it's possible to have my very simple design reviewed. All I want to do is write a string to the serial port when the button is pushed.
0 Kudos
Message 1 of 11

its just that easy.

Add comments to diagram.

Close reference when you are done.

Check for errors if you care.

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 11

ok   good example  

write code ansi and display decimal in a micro atmega

how i can  write code decimal and display decimal ?

0 Kudos
Message 3 of 11
A couple more comments:

1) It is considered bad form to pass wires under things that they aren't connected to ( the wire from the "String to Write" input).
2) Always connect up the error clusters. The one from the serial configuration function to the serial write is not connected. The problem is that the code as written will return the wrong error if the initialization fails. All you will see is an error related to a serial write error, which isn't the real problem.
3) You should have an error input cluster as well to errors that are generated before this code starts can also be reported.


Message Edited by mikeporter on 05-20-2007 06:44 PM

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 11
Hi Talivan,

Is this question related to this (5 year old) post at all?

I do not really understand what you are trying to do: could you explain what you mean with write decimal and display decimal? What are you trying to communicate with?

Best regards,
-Sam F, DAQ Marketing Manager
0 Kudos
Message 5 of 11
Hi SamboNI
with a control numeric  (code decimal) i want converter  to code ANSI o ASCII  for  write visa.  with read visa no problem converter string-numeric but in write no work the converter numeric -string
the comunication serial is with a microcontroller  ATMEGA  family AVR
in a program with VISUAL BASIC 6  it´s ok   write and read for ATMEGA and VISUAL  BASIC             no problem
examples use  Research_TelB  (▲), basic and advanced serial read write (labview 7)
0 Kudos
Message 6 of 11

The code shown below does the same thing. If you can't get the basic serial write and read example to work by entering a numeric value into the string control, then using a numeric control on the front panel and converting to a string won't work either.

You have posted the same question over and over again and have been asked to provide additional information. Such as, does the micro code require a CR and LF at the end of each command? Are you sure it requires ASCII (there is no such thing as ansi)? Does it work with Hyperterminal? Answer some of these questions instead of just saying your LabVIEW program does no work.

If you are going to talk about some vb example that works, provide a link to the code or post the code itself. The statement 'Research_TelB ' is meaningless.

You might also consider posting your question in both English and your native language.

Message Edited by Dennis Knutson on 05-21-2007 09:27 PM

0 Kudos
Message 7 of 11

i put 'Research_TelB  because is the link above



code in VB          `work very well

Private Sub Command1_Click()
variable = Val(Text1.Text)

MSComm1.Output = Chr(variable)

End Sub

Private Sub msComm1_OnComm()

 y = MSComm1.Input
  Label1.Caption = y
End Sub
Private Sub Form_Load()

   MSComm1.CommPort = 1 'define puerto serial comm1
    MSComm1.InBufferSize = 1024 'default mayor tamaño
    MSComm1.InputLen = 0 'no limita tamaño
    MSComm1.Settings = "9600,n,8,1" 'define velocidad, paridad etc
    MSComm1.RThreshold = 1 'hab int al recibir
    MSComm1.SThreshold = 1 'hab int al transmitir
    MSComm1.Handshaking = comNone  'protocolo
    MSComm1.DTREnable = False 'lineas de protocolo NO
    MSComm1.NullDiscard = False 'no descarta los nulos
    MSComm1.PortOpen = True      'abrir puerto

End Sub


0 Kudos
Message 8 of 11
excuse my english
bien lo que quiero decir es que quiero poner un control numerico y el numero que aparece    sea el que mande al puerto serial.  tengo que poner un convertidor  pero no me ha funcionado como quisiera
con  el ejemplo Research_TelB  me referia al que esta en el primer mensage de este tema
tambien he ocupado los ejemplos de lab view 7 : basic y  avansado  serial visa write read
con estos ejmplos no puedo escribir en el puerto
el ejemplo Research_TelB  que mencionan aqui me ha funcionado bien solo  lo que quiero es lo que digo en el primer parrafo
disculpen mi ingles pero hago lo que puedo
0 Kudos
Message 9 of 11

The Chr command converts text to numeric I believe. So, it does not appear you want to send ASCII text. For example, to send a carriage return which is decimal 13 or hex D, you do a Chr(13). In LabVIEW, you can use the Byte Array to String function. You can use the Type Cast function. You can also right click on a string control/constant and select Hex Display. Enter the commands in hex.

p.s. you just put the text 'Research_TelB' in the post. You did not insert a link.

Message Edited by Dennis Knutson on 05-21-2007 09:55 PM

0 Kudos
Message 10 of 11