From HTML to Serial Port
Does anyone know the best way to activate the serial port on a PC from a html page?
Can this be done using Servlets? and if so could somebody give me a piece of sample code.
Joe
The webpage part can be whatever you want. Send a message from the client (webpage, app, etc.) to activate the port by http post/get with form parameters or xml. You can use the Java Serial APIs on the server to activate the Serial port on the server. Or you can use something like SerialPort - http://www.serialio.com.
Similar Messages
-
Hi,
I would like to use my aplication, i use a pic 16f84, in my vi application i modify the asm code, and save it. LAter i need to use mplab to compile to hex and use icprog to pass to the pic by serial port...
Is possible do all on labview???.
Or maybe call the mplab directly to open and convert to hex file, and later call the icprog to program the pic.. without use this programs. Directly with commands do it and close the programs...
I hope any help..!
Regards, Fonsi.Fonsi,
You certainly could write an assembler for the pic code in LV. I wrote an assembler for the old 6502 processor in LV4. The project got cancelled before everything was finished, but the concept is valid. It is a lot of work, parsing strings and tracking all the addressing modes, etc.
Whether it is worth the trouble as opposed to using the existing tools is something you will have to decide.
If the other software can be called from a command line, the system Exe.VI might be useful.
Lynn -
In lab view from RS-232 serial port we want to read and diplay that value
Hello,
In lab VIEW 8.0,we want to read some data values via
RS-232, how to read those values, we tried with visa read for read, but that is not displaying the buffer values.Hi,
There is a nice example that come with labview for writing and reading to an RS232 port, I suggest you take a look at this.
Regards
Ray Farmer
Regards
Ray Farmer -
How can I use the output value from SIMPLE PID to write something to the serial port?
I am working on my Senior Design Project that requires the use of incoming compressed air, propotional valves, continuous servo motors, and a serial servo motor microcontroller. I have figured out how to send byte sequences to the microcontroller through LabVIEW using the VISA serial write function. The motors are attached to the valves to control the flow rate. I have created my own simple feedback system using a bunch of case structures but I realized that I am basically trying to recreate the wheel (I basically was writing my own PID VI). I have an older version of LabVIEW (7.0 Express) and theres no way to upgrade or buy the PID toolkit, so I am stuck using the Simple PID VI. Also, the only way the motor works is sending an array of bytes to tell it to turn on/off, direction, and speed. Is there any way I can use the Simple PID VI in conjunction with the VISA SERIAL write function, or is there any other way I can communicate with the serial port using this pid vi? Any information would be appreciated.
Hi gpatel,
you know how to communicate to serial port, but you don't know how to send a value from SimplePID to serial port???
You know how to communicate, but then you don't know how to communicate???
You should explain this in more detail...
Edit:
From you first post you know what values your motor driver is expecting. You know which values the PID.vi is providing. Now all you need is a formula to reshape the values from PID to the motor. It's up to you to make such a formula. Unless you provide any details we cannot give more precise answers...
Message Edited by GerdW on 02-28-2010 08:35 PM
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
Plot more than one analog value to a waveform chart by reading from Serial Port
I have 4 LDRs and I want to plot their values to a waveform chart by reading them from the serial port. I have looked around and found an example of a VI plotting one value to a waveform chart (attached below) but I am unsure about how to expand this for 4 different waveforms, mostly because I don't particularly understand the way is being read currently. If someone could either point me in the way of a relevant example or explain/show me a solution, or explain howthe current VI I have works, that would be greatly appreciated.
Attachments:
LDRread.vi 20 KBSince I assume each LDR (whatever that is) has its own serial connection, you will need to read from 4 different serial ports. From there, just form an array of all the data and write to the chart.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions -
Write to Serial Port without splitting string data
Hi, all, thank you for your help in advance.
Problem:
I am trying to write to the serial port with VISA write module. Somehow the string I tried to send was splitted before it was sent. For example, if I want to send "127", it sends "7', "2", "1". I don't know if there's anyway to configure the module so that it sends out the whole string at once. I use the return count to indicate how many times it spits the data. So "127" now returns "3" (sent three times. I would like to have it to return "1" so that "127" was sent in whole).
Project:
I am working on an application where a DC motor is controlled by a controller talking to the PC's serial port. "127" stands for its maximum power. The controller devides the power into 128 steps. Therefore I need to input number from 0 to 127 to command the speed.
Any help or suggestion will be appreciated!Thanks for the prompt replies.
About Number/ASCII
I am using the Atmega128-Controller Chip to read in the signals sent from the computer serial port. Then it sends signals to the motor controller. The Atmega chip reads the ASCII string and converts it to hexadecimal number, sending that number to the motor controller. I can program the Atmega chip so that it either translates the ASCII string into hex as mentioned or accepts as it is. Either way, I want it to read two byte information at once (00 to 7F).
If the VISA serial write can send only one byte at a time, then I may have to program the chip so that it buffers the readings. I have tried using number/hex converter and number/string converter, either case, the fact that VISA Write spits one byte at a time hinders the programming. For example: I defined numbers 1 to 5 represents 20% to 100% power output with 20% increment Then I defined "10" as "90%" power, but it reads "1" "0" seperately, so the actual out put is "20%" then "0%".
I used the example VI provided by NI : advanced serial write/read. For convenience, attached here. Not all modification I made is saved. -
HELP IN KEITHLEY output source PROGRAM!(how to change GPIB to serial port)
As the topic suggest,can anyone help me in changing from GBIP to serial port?The file is found inside the .lib that i attached.
filename:2400 swI Linear Stair MeasV - LED.vi
thanks!
Attachments:
KEITHLEY PROGRAM.zip 434 KBzzz(yawn)!!!!!! I did not expect people to help me COMPLETE my work;i was just seeking advice on small portion of that program.Isn't what forum is used for?For posting questions and seeking advice from professonals and those willing to help?If you're just idling around here and doing stupid things just to show that you're an active forum user,i would think that you're a pathetic fool that have no life.Please seriously re-consider your words CAREFULLY next time before you post stupid things.Thanks=D
PS:btw i did try out the program;if not how can i ask a question?You expect the question to just pop out of my brain without thinking?and thanks the person for giving me INVALUABLE advice(the person before that lame "nyc aka joker") as it did worked,and i'm still trying out the test.Thanks for it again=D -
Communicate via serial port/ethernet from client app
Hi
Is it possible to communicate between the client serial port and an Apex application?
(or from the application to an ethernet device).
I need to link an application to a weighing machine and send/receive information via an Apex application. The interface will either be a serial port on the client or the weighing scales could also be connected as a network device.
Any ideas?
Thanks
KathrynThere are active-x controls that you can use (http://www.activexperts.com/activcomport/howto/html/).. Otherwise you could try writing a small java applet to do this on the client end, don't know enough about your requirements to offer more.. Does the vendor of hardware have a solution?
(Issue with this would be, non-ie browsers MIGHT not want to run vbscript or active-x controls..)
Thank you,
Tony Miller
Webster, TX -
Unable to capture data from Serial port using LVRT2010 in single core pentium 4 machine
I am using application written in Labview using windows Labview
Runtime environment 2010. Application creates a tunnel to intercept data from
Serial port.
My problem is, Currently, I am using single core Pentium
processor. When I am trying to intercept the data between COM1 and COM7 (COM 7
is a virtual port) it is not able to capture data.
When I am running Labview RT environment using dual core
processor machine it is running normally. I wonder whether it could be the compatibility issues with
single core Pentium processor.Hi Magnetica
Are both of the machines running the same runtime engine,
drivers ect?
Have you had RT applications running on this
machine before?
Is the development computer a 64bit machine?
The processor is a supported model (See link below).
http://zone.ni.com/devzone/cda/tut/p/id/8239
Regards
Robert
National Instruments UK & Ireland -
I am working on a wireless vital sign monitor. I have 3 signals; heart rate and temperature. I filter and amplify the signals before converting them into digital form. I then pass them via MAX232 before passing them to RS232 serial cable.
I am therefore working on a program to receive the combined signal and separate them.
I have come across serial read and write examples on ni.com but am looking for one where I can actually separate combined signals and display them separately.Reading the serial port will give you a string. How you divide the channels depends on how the data was formatted before it was sent over the serial channel.
If you are designing the instrument, as it seems from your query, then you can set up any form you wish. If your data is always floating point numeric, you could use space or tab characters to separate data words. You could use and XML format. If the instrument is provided by a vendor, contact them for the protocol.
If tabs are used between words and returns between sets of readings, the resutlant string can be interpretted by the Spreadsheet String to Array function in LV.
Things to avoid are characters often used by serial communications systems as control characters. Carraige returns are
often used as command terminators by serial protocols, but may also be used by the port.
Lynn -
How to get data from serial port to GUI textArea
From Serial Port.....
Messages from base (always 5 bytes):
0xAA, 0, 0, 0, 0xBB - IDLE Mode
0xAA, 0, 0x80, 0x80, 0xBB - Question Mode
messages from terminal (always 6 bytes):
0xAA, a, b, c, chksum, 0xBB
where chksum = a+b+c;
a = address (0-250)
the 2 MSB's of b represenet the answer:
0 0 - A
0 1 - B
1 0 - C
1 1 - D
the 6LSB's of b and 8bits of c is the time for answer, in milliseconds.
(0-16384 milliseconds)
I have VB Code for that but I want the same thing in Java ...
Can any one help me?
Here's VB Code..
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "Aakar GUI"
ClientHeight = 4665
ClientLeft = 60
ClientTop = 375
ClientWidth = 6105
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 311
ScaleMode = 3 'Pixel
ScaleWidth = 407
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdPort
Caption = "Open Port"
Height = 375
Left = 120
TabIndex = 4
Top = 600
Width = 1455
End
Begin VB.ComboBox cmbPort
Height = 315
ItemData = "Form1.frx":0000
Left = 120
List = "Form1.frx":0016
Style = 2 'Dropdown List
TabIndex = 3
Top = 120
Width = 2895
End
Begin VB.CommandButton cmdEnd
Caption = "End"
Height = 495
Left = 1560
TabIndex = 2
Top = 1320
Width = 1215
End
Begin VB.CommandButton cmdStart
Caption = "Start"
Height = 495
Left = 120
TabIndex = 1
Top = 1320
Width = 1215
End
Begin VB.TextBox txtMessage
Height = 2040
Left = 119
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 0
Top = 2475
Width = 5848
End
Begin VB.Timer tmrRead
Enabled = 0 'False
Interval = 1
Left = 2040
Top = 600
End
Begin MSCommLib.MSComm MSComm1
Left = 3120
Top = 360
_ExtentX = 1164
_ExtentY = 1164
_Version = 393216
DTREnable = 0 'False
ParityReplace = 45
SThreshold = 1
End
Begin VB.Label Label5
Caption = "Result Data:"
Height = 375
Left = 120
TabIndex = 5
Top = 2115
Width = 1320
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim PortIsOpen As Boolean
Dim Answers(4) As String
Dim RejectKeystroke As Boolean
Private Sub cmbPort_Change()
Debug.Print cmbPort.ListIndex
End Sub
Private Sub cmbPort_Validate(Cancel As Boolean)
'Cancel = True
End Sub
Private Sub cmdEnd_Click()
MSComm1.Output = "e"
txtMessage.Text = ""
End Sub
Private Sub cmdPort_Click()
On Error GoTo ErrorHandler
If cmbPort.ListIndex < 0 Then Exit Sub
If PortIsOpen Then
cmbPort.Enabled = True
MSComm1.PortOpen = False
PortIsOpen = False
cmdPort.Caption = "Open Port"
cmdStart.Enabled = False
cmdEnd.Enabled = False
Else
MSComm1.CommPort = cmbPort.ListIndex + 1
cmbPort.Enabled = False
MSComm1.PortOpen = True
PortIsOpen = True
cmdPort.Caption = "Close Port"
cmdStart.Enabled = True
cmdEnd.Enabled = True
End If
Exit Sub
ErrorHandler:
Debug.Print Err.Number
Debug.Print Err.Description
MsgBox Err.Description, vbExclamation Or vbOKOnly, "Error opening port"
cmbPort.Enabled = True
PortIsOpen = False
cmdPort.Caption = "Open Port"
cmdStart.Enabled = False
cmdEnd.Enabled = False
End Sub
Private Sub cmdStart_Click()
MSComm1.Output = "s"
txtMessage.Text = ""
End Sub
Private Sub Form_Initialize()
Dim tmp As Variant
tmp = InitCommonControls
End Sub
Private Sub Form_Load()
Answers(0) = "A"
Answers(1) = "B"
Answers(2) = "C"
Answers(3) = "D"
'MSComm1.Settings = "9600,n,8,1"
''MSComm1.Settings = "115200,n,8,1"
'MSComm1.PortOpen = True
On Error GoTo ErrorHandler1
MSComm1.CommPort = 1 ' comm port 1
MSComm1.RThreshold = 1 ' use 'on comm' event processing
MSComm1.Settings = "9600,n,8,1" ' baud, parity, data bits, stop bits
MSComm1.SThreshold = 1 ' allows us to track Tx LED
MSComm1.InputMode = comInputModeText 'comInputModeBinary ' binary mode, you can also use
' comInputModeText for text only use
PortIsOpen = False
cmbPort.ListIndex = 0
' open the port
MSComm1.PortOpen = True
cmbPort.Enabled = False
PortIsOpen = True
cmdPort.Caption = "Close Port"
cmdStart.Enabled = True
cmdEnd.Enabled = True
Exit Sub
ErrorHandler1:
Debug.Print Err.Description
PortIsOpen = False
cmbPort.Enabled = True
cmdPort.Caption = "Open Port"
cmdStart.Enabled = False
cmdEnd.Enabled = False
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If MSComm1.PortOpen Then MSComm1.PortOpen = False
End Sub
Private Sub lblOption_Click()
End Sub
Private Sub MSComm1_OnComm()
' Synopsis: Handle incoming characters, 'On Comm' Event
' Description: By setting MSComm1.RThreshold = 1, this event will fire for
' each character that arrives in the comm controls input buffer.
' Set MSComm1.RThreshold = 0 if you want to poll the control
' yourself, either via a TImer or within program execution loop.
' In most cases, OnComm Event processing shown here is the prefered
' method of processing incoming characters.
Dim i As Long
Dim sBuff As String ' buffer for holding incoming characters
Const MTC As String = vbCrLf ' message terminator characters (ususally vbCrLf)
Const LenMTC As Long = 2 ' number of terminator characters, must match MTC
Dim iPtr As Long ' pointer to terminatior character
' OnComm fires for multiple Events
' so get the Event ID & process
Select Case MSComm1.CommEvent
' Received RThreshold # of chars, in our case 1.
Case comEvReceive
' read all of the characters from the input buffer
' StrConv() is required when using MSComm in binary mode,
' if you set MSComm1.InputMode = comInputModeText, it's not required
'sBuff = sBuff & StrConv(MSComm1.Input, vbUnicode)
'If Len(txtMessage.Text) > 4096 Then txtMessage.Text = ""
sBuff = MSComm1.Input
Dim ch As String
Dim PacketStart As Boolean
Dim PacketLength As Integer
Dim Packet() As String
PacketStart = False
PacketLength = 0
While (Len(sBuff) > 0)
ch = Left(sBuff, 1)
If (ch = Chr(&HAA)) Then PacketStart = True
If (ch = Chr(&HBB)) Then PacketStart = False
If (ch <> Chr(&HAA) And ch <> Chr(&HBB)) Then
PacketLength = PacketLength + 1
ReDim Preserve Packet(PacketLength)
Packet(PacketLength) = ch
End If
'txtMessage.Text = txtMessage.Text + Format(Hex(Asc(ch)), " @@")
sBuff = Right(sBuff, Len(sBuff) - 1)
Wend
If (PacketLength = 3) Then
Debug.Print "Command packet recieved"
'txtMessage.Text = txtMessage.Text + vbCrLf + "Address =" + Str(Asc(Packet(1)))
'txtMessage.Text = txtMessage.Text + vbCrLf + "Address =" + Str(Asc(Packet(2)))
End If
If (PacketLength = 4) Then
Debug.Print "Response packet recieved"
txtMessage.Text = txtMessage.Text + "Address =" + Str(Asc(Packet(1))) + _
" Answer = " + Answers((Asc(Packet(2)) And &HC0) / 64) + _
" Time =" + Str((Asc(Packet(2)) And &H3F) * 256 + (Asc(Packet(3)))) + "mS" + vbCrLf
'txtMessage.Text = txtMessage.Text + vbCrLf + "Address =" + Str(Asc(Packet(1)))
'txtMessage.Text = txtMessage.Text + vbCrLf + "Option =" + Str((Asc(Packet(2)) And &HC0) / 64)
'txtMessage.Text = txtMessage.Text + vbCrLf + "Time =" + Str((Asc(Packet(2)) And &H3F) * 256 + (Asc(Packet(3))))
End If
If (PacketLength <> 4 And PacketLength <> 3) Then Debug.Print "Unknown packet of length" + Str(PacketLength) + " recieved"
txtMessage.Text = txtMessage.Text + vbCrLf
' An EOF charater was found in the input stream
Case comEvEOF
DoEvents
' There are SThreshold number of characters in the transmit buffer.
Case comEvSend
DoEvents
' A Break was received.
Case comEventBreak
DoEvents
' Framing Error
Case comEventFrame
DoEvents
' Data Lost.
Case comEventOverrun
DoEvents
' Receive buffer overflow.
Case comEventRxOver
DoEvents
' Parity Error.
Case comEventRxParity
DoEvents
' Transmit buffer full.
Case comEventTxFull
' Unexpected error retrieving DCB]
Case comEventDCB
DoEvents
End Select
End Sub
Private Sub tmrRead_Timer()
'MSComm1.Output = vbCrLf + vbCrLf
'MSComm1.Output = Chr(128)
End Sub
Private Sub txtMessage_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = 2 Or Shift = 4 Then RejectKeystroke = False Else RejectKeystroke = True
End Sub
Private Sub txtMessage_KeyPress(KeyAscii As Integer)
If RejectKeystroke Then
KeyAscii = 0
End If
End SubThanks in advance..I want to replicate the entire VB program as Java Program.
This has to be included in my project which i am doing in java. -
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 -
How to save a datas from serial port?
How to save a datas from serial port?
Hi
I need some help about rs-232 communication. I want to make a vi witch can do this things:
-read a txt file (to simulate a serial port like when the datas are coming)
i will get 3 different data in serial port (like this: 121 213 135)
i want to save in a txt file what datas get my vi
so
-write in a txt file or draw in a diagram (or both)
so my problem is: read in serial port and save in a file and draw a diagram.
if anybody can help pls HELP ME because im a beginner in this problem.
I already do something but Im not sure that good.
Thx for all. -
How to extract data from a .txt file & send it to a serial port automatically
Hi all
I'm a final yr B.Tech student. I am new to the entire LABVIEW thing. But i hear its really good. My dept. in collge has purchased labview & i'm tryng to use it
As i'm new to labview , i need help plz
" I want to open a .txt file (in my PC) & transmit all the contents of the file via serial (COM) port to an 89%! microcontroller. Also i want to read the feedback messages from the microcontroller thru the serial port & save it to the same file in the PC.All this must be done automatically. ie, no manual intervention after execution starts"
Kindly help me as i'm stuck here & unable to proceed further with my projecthere is my 20min try without debugging (needs a rs232 and loopback connector )
use the probe and highlight the dataflow to see how it works.
as always: there are many ways to solve your problem
Greetings from Germany
Henrik
LV since v3.1
“ground” is a convenient fantasy
'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'
Attachments:
read write file to RS232.vi 69 KB -
Parsing data from Serial Port one byte at a time
Hi everyone,
What I want to do is read in from the serial port byte by byte and parse each byte that I am reading in. The size of the data read in varies. How do I do that? I can do using .dll but I want to learn how to do it in labview. I searched through the forum for something similar but no luck. I have seen some that puts the VISA read in a while loop and others that puts the property node, "bytes at Port" in a while loop. What is the difference in doing either way? I am using Labview 7.1 Can anyone point me in the right direction?
ThanksHi guys..
I'm still a beginner in using labview tcp/ip function. for now, i have a project to read the labview data with java programming language so that i can monitor that data using any devices that using java, such as PC or cell phone. my task for now is to determine the format of data that being sent (its type, length, etc), coz as far as i done until now, the data that read in the java is still a raw material so that i dont know how to gain the information from that data.
my question is :
- how does the type cast work in changing the data format from one to another?
- how does the bytes to read in tcp read work? coz when i'm changing the length of bytes to read constant from 4 bytes to another, the data is becoming mess up. As far as i know, the bytes to read only read the first "constant number" byte in the tcp read to determine the length and type of the data..
thanks
Maybe you are looking for
-
Issues with Analysis Authorization checks in APO
Hi Friends, I am facing an issue with Analysis authorization checks in APO. We have setup user access based on Management Entity (Analysis authorization - AGMMGTENT and 0TCAACTVT) and core APO authorizations (based on the work profile - e.g: Demand P
-
JDBC 10g - Support for TNS name entries
Hello, I found the following statement: JDBC-Thin support for TNSNAMES.ORA Lookup: similar to JDBC-OCI, both client-side and server-side JDBC-Thin can now read the local TNSNAMES.ORA file to resolve service name or TNS alias. Consequently Java in the
-
AE with inbound SIP and RTP over UDP - Will not open ports
I am using a Linksys SPA962 IP Phone via an Airport Express with the latest firmware connecting to an Asterisk PBX (http://www.asterisk.org) over the internet. I may make outbound calls and have my incoming and outgoing audio over RTP with the approp
-
Best upgrades on a mac book pro for gaming
hello I have a mac book pro and it is five years old but just recently it had a virus and it erased my mac completely. I went to the apple store and they said to get a new hard dive I am an avid gamer and I want to know what are the best upgrades to
-
Can anyone help me I keep sending the verifying thing to my e-mail but I don't get it. I know that it is the right e-mail because if I change it to my other one it sends a e-mail saying that I changed it, but it won't send the e-mail to verify it cou