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
Similar Messages
-
Unable to capture data from drop down list in custom added field in migo tcode at item level
Hi guys,
need bit help in resolving query related to custom added field in Tcode migo.
i have added a field in migo at item level ,in this i have used drop down list
to get data but unable to capture data from drop down list.gown through
many blogs in scn but unable to resolve.
Please help me out in this.
Thanks,
Umakant.Hi,
U can use following code to fill the list box
write this code in PBO
In layout editor please select listbox in dropdown attribute of input field and put some fctcode attribute
TYPE-POOLS vrm.
DATA values TYPE vrm_values WITH HEADER LINE.
TABLES: <ur custom Database table>.
clear values, values[].
SELECT * FROM <ur custom Database table>.
values-text = <TABLE FIELD TO DISPLAY IN DROPDOWN> .
values-key = <TABLE KEY FIELD TO DISPLAY IN DROPDOWN>.
APPEND values.
ENDSELECT.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = '<SCREEN INPUT FIELD NAME>'
values = values[]
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
Also please define the following before accessing the listbox value
data: <listbox input field name> type <table field name>,
<inputfield name where text to display> type string in top include
In PAI, select the text from the table into <inputfield name where text to display> depending on value selected which will be called when enter key is pressed or any vale is selected -
Problem while reading data from Serial Port
Hi All,
I am facing some problem while reading data from Serial Port.
As per the requirement I am writing the data on Serial Port and waiting for response of that data.
Notification for data availabilty is checked with method public void serialEvent(SerialPortEvent event) of javax.comm.SerialPortEventListener.
When we are writing data on the port one thread i.e. "main" thread is generated and when data availability event occures another thread "Win32SerialPort Notification thread" is generated. This creates problem for me as we can't control thread processing.
So can anybody pls explain me how to overcome this problem?
Regards,
NehaMy Problem is:-
I am simoultaneouly wrting data on port & reading data from port.
First I write data on port using outputStream.write() method. Now when target side sends me response back for the request on serial port DATA_AVAILABLE of SerialPortEventListner event occured,we are reading data from serial port.Now till the time we didn't get the response from target next command can't be written on the serial port. When we are writing data on port main thread is executed.Now my problem starts when DATA_AVAILABLE event occured.At this point another thread is created.Due to this my program writes data of next command without reading response of previous command.To solve this prob. I have used wait() & notify() methods as follows.But again due to this my pc hangs after execution of 2 commands. (PC hang in while loop in a code provided below.)
From SOPs I could figure it out that after 2 commands we are not able to write data on serial port so DATA_AVAILABLE event doesn't occure n pro. goes in wait state.
Can anybody help me to solve this issue.
Neha.
Code:
public void serialEvent(SerialPortEvent event)
switch (event.getEventType())
case SerialPortEvent.BI:
case SerialPortEvent.OE:
case SerialPortEvent.FE:
case SerialPortEvent.PE:
case SerialPortEvent.CD:
case SerialPortEvent.CTS:
case SerialPortEvent.DSR:
case SerialPortEvent.RI:
case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
break;
case SerialPortEvent.DATA_AVAILABLE:
try
dataThread = Thread.currentThread();
dataThread.setPriority(10);
dataAvailable = true;
byte[] tempArray=new byte[availableBytes];
inputStream.read(tempArray);
catch (IOException io)
SOP(io, "Error in serialEvent callback call for event DATA_AVAILABLE");
public void writetoPort(byte[] data) throws IOException
outputStream.write(data);
while(finalTimeOut >= actualTime)
if( ! dataAvailable)
actualTime = System.currentTimeMillis();
else
synchronized (mainThread)
mainThread = Thread.currentThread();
mainThread.wait();
public void sendDatatoUser(byte[] b) throws Exception, HWCCSystemFailure
obj.returnData(b);
synchronized(mainThread)
mainThread.notify();
-
How to read a data from USB port using JAVA
hi all,
i need to know how to read a data from USB port using java. any API are available for java ?.........please give your valuable ideas !!!!!!!!!
Advance Thanks!!You can do this. Please use this link
[http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=uHu&q=java+read+data+from+usb+port&btnG=Search&meta=&aq=f&oq=]
What research did you do of your own? Have you done some testing application and tried yourself?? -
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. -
Read data from serial port or TCP port of frontend PC
Hello Friends,
I have requirement to read data from device connected to frontend PC which will provide meter reading data.
Vendor has given me two option.
1. Device can be connected to seiral port and data transfer will be done through MODBUS RTU protocol.In that case data need to capture from serial port.
2. Device can be connected to TCP port and Socket program can be provided for data transfer. In that case SAP will act as client and communicate with TCP port.
There will be multiple workstation with individual meters connected to them.
I am aware of text file interfacing through front end tools using custom code using VB,JAVA or others.
Is there any solution availble to achieve above things using ABAP other than text file , like direct communication?
I am using ECC 6.0.Hello,
Socket programming in not available on ABAP, but you may use RFC for the same.
Use the below links for more details
[Link 1|http://help.sap.com/printdocu/core/print46c/en/data/pdf/BCFESDE2/BCFESDE2.pdf]
[Link 2|http://forums.sdn.sap.com/thread.jspa?threadID=1820233]
Regards,
Abhishek -
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. -
Problem in reading data from serial port continuously- application hangs after sometimes
I need to read data from two COM port and order of data appearance from COM port is not fixed.
I have used small timeout and reading data in while loop continously . If my application is steady for sometime it gets hangs and afterwards it doesnt receive any data again.
Then I need to restart my application again to make it work.
I am attaching VI. Let me know any issue.
Kudos are always welcome if you got solution to some extent.
I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
Attachments:
Scanning.vi 39 KBbillko wrote:
Ranjeet_Singh wrote:
I need to read data from two COM port and order of data appearance from COM port is not fixed.
I have used small timeout and reading data in while loop continously . If my application is steady for sometime it gets hangs and afterwards it doesnt receive any data again.
Then I need to restart my application again to make it work.
I am attaching VI. Let me know any issue.
What do you mean, "not fixed?" If there is no termination character, no start/stop character(s) or even a consistent data length, then how can you really be sure when the data starts and stops?
I probably misunderstood you though. Assuming the last case is not ture - there is a certain length to the data - then you should use the bytes at port, like in the otherwise disastrous serial port read example. In this case, it's NOT disastrous. You have to make sure that you read all the data that came through. Right now you have no idea how much data you just read. Also, if this is streaming data, you might want to break it out into a producer/consumer design pattern.
Not fixed means order is not fixed, data from any com port can come anytime. lenght is fixed, one com port have 14 byte and other 8 byte fixed..
Reading data is not an issue for me as it works nice but I have a query that why my application hangs after sometime and stops reading data from COM PORT.
Kudos are always welcome if you got solution to some extent.
I need my difficulties because they are necessary to enjoy my success.
--Ranjeet -
I already stablish communication with my serial port using VISA, selecting COM1 as the resoure name.
After that, I tried to read the data from the port (as we know the data was in string format )but I need to convert the data to numeric value to hadle it (no arrays).
Another main thing is that I'm develoing a new based Embedded design and tthe info that will trhow out from the device to the PC is binary.
How can I solved the problem, and if I want to make bidirectional communication with my system how can I do it? The VISA intructions as *IDN? and so forthetc can be recognize by the external system if the COM1 port is recognized by NI Max as ADSRL1::I
NSTR1?Hello,
For an example of bidirectional serial communication in LabVIEW, please see the shipping example LabVIEW <-> Serial.vi. This can be found from LabVIEW by going to Help >> Find Examples. From the example finder, select Hardware Input and Output >> Serial >> LabVIEW <-> Serial.vi.
Once you are able to read the string data in, you can use the VIs in the String/Number Conversion palette to convert the data to numeric format. To access these, right-click on the block diagram >> All Functions >> String >> String/Number Conversion.
Let me know if this does not help.
Regards,
Sean C.
Applications Engineer
National Instruments -
URGENT: Capturing data through serial port
Hi,
My problem is with the use of javax.comm API. I have an RFID tag reader connected to
the serial port. It is a handheld reader and reads tags when its trigger is pulled. The
data that is read is sent to the serial port. This is what I want to capture.
I tried to test the reading operation by running the SimpleRead sample. What I see is
that I pull the trigger once to read 1 tag, but that generates 3 DATA_AVAILABLE events.
The tag ID that is read is 16 bytes, preceded by a 3 byte AIM Identifier (that declares
the following data was read from an RFID tag, and not a barcode which has different
AIM Identifiers for the different symbologies - but I digress.) By inserting some println's,
I was able to see that the 19 bytes of data are read 8 bytes at a time. The first 8 bytes
are read on the first DATA_AVAILABLE event, the next 8 are read on the second event
and the last 3 bytes are read on the 3rd DATA_AVAILABLE event.
This is strange & not good for me. How can my application know that the data read in
these 3 separate DATA_AVAILABLE events is to be concatenated to form a single
tag ID? Why is the single trigger-pull & tag read operation broken up into chunks of
8 bytes? Is there some configuration setting that will give me the behavior I want?
(I cannot rely on the length of the tag ID being 16 bytes always, because the same
reader will also be reading barcodes where the data may have varying length)
Thanks for any help. This is really urgent.
- Ajoyplease use the [ code ]and [code ] tags for code.
I don't think you have a problem with the code, it's more like understanding how to make it work.
to make the read method return.You do not have a read() method.
The code is behaving as it should.
You need to use the SimpleRead class as a thread, add and remove the Serial port listener as needed.
You read all data available, then send it to a method to parse the buffer.
You can count how much data was read so you know how much to parse.
I never used receive threshhold.
Here is example (sample)of my serial port reader
//SerialIO
public void serialEvent(SerialPortEvent event) {
switch(event.getEventType()) {
case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
break;
case SerialPortEvent.DATA_AVAILABLE:
this.dataManager.readData();
//DataManager
public void readData() {
String str;
int bytes = 0;
long endTime, now;
try {
while (this.owner.isComPortOpen
&& (SerialIO.inStream.available() > 0)) {
bytes = SerilIO.inStream.read(this.buffer);
if (bytes > 0) {
if (bytes > this.buffer.length) {
System.out.println( ": Input buffer overflow!");
**Here is where you parse your buffer
sendDataToParser(bytes, buffer);
} catch (IOException ex) {
System.out.println( ": Cannot read input stream");
* Stops the serialEvent listener
protected void stopSerialEvent() {
SerialIO.serialPort.removeEventListener();
try {
Thread.sleep(2000);
flushInputStream();
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
* Starts the Serial event listener
protected void startSerialEvent() {
// TODO Auto-generated method stub
try {
SerialIO.serialPort.addEventListener(SerialIO);
} catch (TooManyListenersException e) {
// TODO Auto-generated catch block
//System.out.println("startSerialEvent in dataManager");
e.printStackTrace(); -
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 -
Stoping VI inbetween when program seeking data from serial port.
I have an application in which I need to read data from two serial port one after other.
One read will read 14 byte and other 08 bytes(Just info).
Now in between if user need to stop the VI then how to stop it?
Kudos are always welcome if you got solution to some extent.
I need my difficulties because they are necessary to enjoy my success.
--RanjeetA state machine could do this easily. Just have a state to check for the stop (or any other events).
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Reading data from serial port needs optimisation
Hi,
We have got a class which reads input from some hardware connected to the serial port.
The data coming from the device can cross over 1mb at a time.
We would like to optimize the speed of the program such that no data is lost during the readings.
Hence, we would like to store the entire reading into memory such that it can be stored into a file or database once the readings have been completed.
The serialport class returns a byte[] of the current data in the buffer. There could be over 8000 such readings.
Would it be better to convert the byte[] into a char[] and append into a StringBuffer
or append the byte[] as is into an ArrayList and perform the conversions and operations on it later?
Reg,
ChetanThe ArrayList will not only be much faster but it will preserve the original data. Unless the incoming data really is a String there is no point in converting it.
-
Reading datas from serial port (palm)
Hi,
Because read methods (DataInputStream, stream on palm serial port) are blocking, how do I know if there is at least one available byte that can be read ?
ThanksHi,
I thought the method available() resolve the problem but this method gives the number of byte available without blocking.
I use :
public DataInputStream dis = null;
public int readDataBuf(byte[] buf) {
int status = -1;
try {
if (dis.read(buf, 0, 1) > 0) {
status = (buf[0] & 0xFF);
catch(IOException e) {
System.out.println(e.toString());
return status;
but with the read method if there is not byte the program stop wainting a byte.
Thanks -
Hi,
I've been stuck with this problem for weeks and really need some help. I've been searching a lot but I can't find a proper solution.
I am trying to use Labview to plot and display some parameters of a data acquisition system for a project.
The data acquisition system is connected to a computer via serial connection through COM 1 port.
The data acquisition system sends a serial stream of data (ASCII string with baud rate 19200), as shown below (from HyperTerminal),
01:00:26,933.24,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
01:00:27,931.54,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
The serial data stream consists of a time stamp (as 1st data), followed by 16 individual channel data, separated by comma "," and each stream ending in return "\n". Each value of the data ranges from 1 to 6 digits (value of -5000 to 15000).
I have no problem reading this values correctly using HyperTerminal, but I have problem to plot and display individual parameters of this serial string in Labview. I want to save the entire data in a “.csv” file corresponding to all the 16 channels with time stamp and plot each individual channel parameter in a graph with time on X-axis.
I am relatively new to Labview hope I can learn a lot from your help.
Thank youThank you Dennis.........
Now I had modified the program incorporating1D array for gauge display.....but currently I have a new problem. The program is running updating the file, waveform graph and Gauge very slowly. Approximately once in every 15 seconds 16 data streams are getting updated in a bunch with gauge sticking to the last value rather than indicating real time value.
eg.
12:33:41,-3728.78,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
12:33:42,-3730.47,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
12:33:43,-3729.81,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
12:33:44,-3733.80,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
12:33:45,-3733.57,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
12:33:46,-3729.27,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
12:33:47,-3725.97,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
12:33:48,-3730.14,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
12:33:49,-3733.20,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
12:33:50,-3733.60,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
12:33:51,-3732.24,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
12:33:52,-3734.51,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
12:33:53,-3728.07,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
12:33:54,-3732.54,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
12:33:55,-3732.24,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
12:33:56,-3731.58,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
gets updated in a bunch after 15 seconds, rather than in every second. I thought the problem is with while loop but, i realised there is no delay associated with it..... Can u kindly help me in modifing the program so as it can update the waveform, file data and gauge in real time? (I have attached the modified VI file "suitcase new.vi" and the data gathered after executing the same as in "Trail.txt".)
Thank You,
Rahul
Attachments:
trail.txt 85 KB
suitcase new.vi 44 KB
Maybe you are looking for
-
Users changes the address of Business Partners
Hi Everyone, We are using SAP Business One 2007A. We have different locations set up for "ship to address" in business partners master data and all the ship to address have been saved as unique locations so that when a sales order or a work order is
-
PeopleSoft Connected Query in XML Publisher Report - Error
Hello - I'm getting this weird error when trying to run an XML Publisher report off a PeopleSoft Connected Query. The Connected Query runs fine to an XML File. Any ideas? The parent/child queries in the connected query don't use any prompts. PCodeWTL
-
HELP!!! i have a mac g 5 and i uploaded Microsoft Office 2008 for my 90 year old mother. Now when she tries to open earlier word docs, they won't open at all :-( what happened? I SEE THE WORD IN THE NAVIGATION BAR BELOW, but when she tries to open
-
Determining if PhotoStream Images are also elsewhere in database
i am trying to figure out if the images in my PhotoStream Projects in Aperture on my Mac Pro are also showing up somewhere else in my Aperture database on this computer. i have been /manually/ importing these from my iPhone via USB into my MAC PRO Ap
-
My ipod touch got stolen and i would like to know how to track it from my computer
tell me how i can track my ipod that just got stolen, it has the ipod finder in it but i dont have another apple device to use to find it. is there a way to do it from my computer