Receive data from serial cable
hello;
i am building a program which recive data from serial port... and to tes it i constructed a circuit where i connect the pin 2 to a power source.
c=inputStream.read();
readBuffer.append( c);
System.out.println("ok "+ readBuffer.toString() );
the prevouse sentence is to print out the result, but the result is numbers ,0,10,255,16,8 collection of numbers at any time i connect the circuit.
so can any one discuss to me what is these results?
I agree with Dennis that the timing characteristics of the USB-6008
would be insufficient to implement a serial interface with, but there
are other issues as well which would prevent you from doing this.
RS-232 has a maximum voltage of +/- 25V, which is higher than the
limits of your device no matter how you connect it. You may be
able to read the incoming data line on the analog lines if you use
differential mode (+/- 20V Range), but you would be unable to output
any data. The analog output range is 0-5V, so you wouldn't have
any way to output the voltage levels needed for a RS-232 interface.
Both the digital lines and the analog output are software timed, so you
would not be able to produce the accurately timed I/O needed for a
RS-232 interface.
You could overcome the voltage issues by using a line converter such as
a MAX232 chip to convert between RS-232 and TTL votlage levels, but you
would still have timing issues which would make it difficult to produce
a working serial interface.
I would recommend that you look into purchasing a USB Serial interface. National Instruments offers a full line of USB Serial Interfaces which allow you to easily interface with RS-232 devices on a computer without a serial port.
Similar Messages
-
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 -
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 use sda6810 to receive data from a rs485 channel?
I want to use sda6810 to anlyze data from a rs485 bus. So I use Labview to progame the sda6810 with the drivers.Firstly,I intilite the card,then I cofigued an channel to send data from a buffer,and configued another channel to receive data from the first chanel . But unfortunatly the data I received was not equal to the data I sended.And there are not any error messages indicated in Labview
And when I try to use the GP channel,I found it worked properly.please tell me how I can solve the problem?I really apreciate your help.You told me that
I should use the exameples which shipped with sda driver firstly. I do used them,and it worked correctly.So I think the connections was being setup properly.And I
used labview to progame the rs485 channel
. It do received something .But it was incorrect.
I would be grateful if you could send me an
example writted by labview,or you could tell
me you e-mail address.
Here is my code .
Attachments:
youyou2.zip 110 KB -
Pick Data From Serial/USB ports
How can I pick Data from Serial/USB ports Machines
I want to put Results into Database from Haematology MachineYou will have to write a Java program to do this and then use a Java Pluggin Commponent (JPC) to read the data into Forms.
Look on the Internet for code showing how to work with USB ports, and see Francois web site about PJCs.
http://sheikyerbouti.developpez.com/index_en/ -
Partner Profile type : Receiving Data from an 3rd party sys & Posting IDoc
Hi all,
My scenario is Receiving Data from a third party system and sending it to a R3 system as an IDoc...
It is a B2B scenario.....
So please tell me what should be my Scheme for the indentifier that i will be mentioning in the sender party...
Should it be ALE#KU or ALE#LS.........
it is working fine with ALE#KU...i m getting an error if i define it as ALE#LS......
Is there an extra setting that should be done for configuring it as ALE#LS or , it is not possible configuring using ALE#LS
Thanks in Advance,
Sushil H.Hi Sushil,
I have a similar problem and opened a thread: Unable to convert the sender service ABC_Service to an ALE logical system
i was able to do it without specifying any identifier ...and mapping the sender information in the message mapping,,,,
Can you please tell me:
1) What value you specified in the mapping for sender (was it 3rd party/ PI/ R3)? Did you disable the other fields like RCVPRN/ RCVPOR etc?
2) Did you make any change in the receiver channel for IDOC (in identifier section)?
It will be very helpful to me if you reply.
Thank you,
Pankaj. -
Hello.
Assuming that I send data into PayPal (with the use of "HTML Variables for PayPal Payments Standard"):
var variables:URLVariables = new URLVariables();
variables.cmd = "_xclick";
variables.business = "A8AJGG5PS2GKE";
variables.upload = "1";
variables.item_name = "some item";
variables.amount = "123";
variables.currency_code = "USD";
variables.lc = "pl";
variables.page_style = "PayPal";
variables.return = "my site";
variables.re = 2;
variables.no_note = 1;
variables.no_shipping = 1;
variables.notify_url = "[email protected]";
var request:URLRequest = new URLRequest("https://www.paypal.com/cgi-bin/webscr");
request.method = URLRequestMethod.POST;
request.data = variables;
navigateToURL(request, "_blank");
Does anyone managed to integrate PayPal IPN - "Instant Payment Notification"-
(https://www.paypal.com/ipn/) with AS3 in order to receive data from PayPal?
Could you please show any example of using it.My idea is as follow:
1. .swf on you page sends variables into PayPal
2. After finishing the payment on PayPal, the customer is auto-redirected to your page ("return" variable)
3. Customer returns to your page. PayPal does NOT send any payment data there.
Separately in the background, you receive a form POST from PayPal at a different URL (notify_url variable) - (here resides the php that I added below).
4. You post back a form with cmd=_notify-validate and all fields you received from PayPal. PayPal responds with a single word VERIFIED or INVALID
5. If you receive VERIFIED, you can process payment
This method means that you can easily update for example your MySQL database but unfortunately you have to reload .swf file each time - and that's why it is not a perfect solution in my opinion;
PS:
- variables.return and variables.notify_url must be absolute urls
- notify_url must also allow anonymous access from outside of your network
- firewall must be opened to host: notify.paypal.com
- in your business PayPal account:
Auto Return = Enabled in account profile
PDT = Disabled in account profile
IPN = Enabled in account profile
- php file:
<?php
// read the post from PayPal system and add 'cmd'
$req = 'cmd=' . urlencode('_notify-validate');
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.paypal.com/cgi-bin/webscr');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: www.paypal.com'));
$res = curl_exec($ch);
curl_close($ch);
// assign posted variables to local variables
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];
if (strcmp ($res, "VERIFIED") == 0) {
// process payment
else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
?> -
I use LabVIEW 7.1 but I have some problem when, I use LabVEW to read the data from serial communication.
I use LabVIEW to read the data from serial communication then, i open the example (.vi) from Serial Communication - Advanced Serial Write and Read from LabVIEW Example. BUT it have some error message that : Error - 1073807202 occured at property node in visa configure serial port (instr).vi -> advance serial write and read .vi
this error code is undefined. no one has provide a description for this code, or you might have wired a number that is not an error code to the error code input.
I don't know why? please help me. thank you.When I copy that code into "Explain Error" I get: "VISA: (Hex 0xBFFF009E) A code library required by VISA could not be located or loaded."
You may have a bad install of VISA or the wrong version of VISA loaded. Try re-installing VISA. You can get the latest version from the NI support site: http://digital.ni.com/softlib.nsf/webcategories/85256410006C055586256BBB002C0E91?opendocument&node=1....
Also ensure that you are not pointing the example towards a serial port that does not exist.
Please let us know what you find and what gets this working for you.
Rob -
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 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 -
VISA Read gets incorrect data from serial connection
I am having difficulty using the VISA functions in LabVIEW to read data from a virtual COM port. Data is being sent from a serial to USB chip via a USB connection using OpenSDA drivers. I have a python program written to read from this chip as well, and it never has an issue. However, when trying to achieve the same read in LabVIEW I am running into the problem of getting incorrect data in the read buffer using the VISA Read function.
I have a VISA Configure Serial Port function set up with a control to select the COM port that the device is plugged into. Baud rate is default at 9600. Termination char of my data is a newline, which is also default. Enable termination char is set to true. A VISA Open function follows this configuration, and then feeds the VISA Resource Name Out into a while loop where a VISA Read function displays the data in read buffer. Byte count for the VISA Read is set to 20 so I can read more of the erroneous datat, however actual data will only be 6-12 bytes. The while loop has a wait function, and no matter how much I slow down the readings I still get incorrect data (I have tried 20ms thru 1000ms).
The data I expect to receive in the read buffer from VISA Read is in the form of "0-255,0-255,0-255\n", like the following:
51,93,31\n
or
51,193,128\n
And occasionally I receive this data correctly, however I intermittently (sometimes every couple reads, sometimes a couple times in a row) get incorrect readings like this:
51,1\n
51,193739\n
\n
51,1933,191\n
51,,193,196\n
51,1933,252
51,203,116203,186\n
Where it seems like the read data is truncated, missing characters, or has additional characters. Looking at these values, however, it seems like the read was done incorrectly because the bytes seem partially correct (51 is the first number even in incorrect reads).
I have search but haven't found a similar issue and I am not sure what to try from here on. Any help is appreciated. Thanks!
Attachments:
Serial_Read_debugging.vi 13 KBThe first thing is that none of the error clusters are connected so you could be getting errors that you are not seeing. Are you sure about the comm parameters? Finally, I have never had a lot of luck looking for termination characters. You might want to just capture data and append each read into one long string just to see if you are still seeing this strangeness.
What sort of device is returning the data? How often does it spit out the data? How much distance is there between it and your computer? Can you configure it append something like a checksum or crc to the data?
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
How do you receive data from multiple people on a single port?
I am trying to make a server where it receives the data from multiple users and then send it back to them all- multicasting audio to be exact. I tried setting it up but when i open the RTP session i get "can't open local data port" if i have more than one used connected to me. Does anyone have a solution? I didnt find much on the samples page and the multicast example from http://java.sun.com/products/java-media/jmf/2.1.1/apidocs/javax/media/rtp/RTPManager.html
didnt help either- i used the same ipaddress for the initialize and addtarget but i get "Local Data AddressDoes not belong to any of this hosts local interfaces". I am really in a pickle... If anyone can help me out that would be great!
EX: If A,B,C want to multicast they will all send to Server S using port 3000. Server S will create listeners for each of them using port 3000 and when received data it will send back to all of them at 4000. This is what i am trying to do... should i make multiple threads? would that help? thanks and please help!To send to everyone, you can send to a multicast address (choose one from 224.0.0.0 to 239.255.255.255), on a given port (2000). I don't have any code example here but it should very similar to unicast. As you said, you just have to register the Session and add a target with this same address.
I don't have any example myself, but you should find code example of both server and client around. It is a very common usage of jmf rtp.
I don't know how to mix several audio streams together (never had to do this), so I'm afraid I can't answer your other questions, sorry... The only way to know if it will slow down the transmission is to try. :) -
Port number on which SAP receives data from extrernal systems
Hi,
We have an external application which sends/receives data to/from SAP. I am trying to figure out the port on which SAP server getting/sending data. Every time on SAP server side, the port opened is sapgw01( sapgw<system number>). Can anyone tell how to figure out the correct port on which SAP is operating in this case ?Hi
check the following link
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4e515a43-0e01-0010-2da1-9bcc452c280b -
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
Maybe you are looking for
-
E51 Drops Bluetooth connection with Car Radio afte...
Hi Guys, Just wondering if anybody has seen this before. It seems like a few people are seeing this but I have yet to find a solution. My phone pairs perfectly and works as it should for about the first 30 mins, then for no reason, it drops the bluet
-
Turn metronome off ... once and for all ...
I've seen the same question both here and other places on the web ... But I've yet to see a definitve answer/solution ... :-/ So : Is there a way to disable/turn off the metronome ONCE AND FOR ALL ! ? Now I have to turn it off every time I start a ne
-
Suppressing alerts while opening a file in Illustrator
Hi all, Am very new to illustrator scripting (started only a couple days ago), and have a very basic question. I get these warning messages when some fonts are missing. I would like my script to ignore these and continue. This is what I tried, but it
-
Upgraded to iTunes 9 Always wants to restore
I have a 3G iPod, Windows XP. The system rrepeatedly wants me to restorew the iPod. I have to re-boot the system with the iPod attachewd to get it to sync. Version 9 has too many problems for me. How can I get iTunes 8? Also, I must sync everything.
-
How to add my 1 year premium code
Hello , i recently received a code for a 12 months subscription for premium on skype. When i add the code i get this message : Sorry, you have reached your monthly voucher redemption limit. Please try again later. I never added any code or anything