VS 2010 Truncate Charachters HEX Data Stream (Serial)?

Sep 4, 2010

The RX data from the serial port is as follows:

FE FE FA E0 00 23 45 FD

I need to truncate everything else and just have positions 5, 6 and 7 output in the hex in a TEXTBOX. See below:

452300

Instead it will put the the whole steam in the textbox and it will be in decimal format, not hex.

View 3 Replies


ADVERTISEMENT

Stream Read Return Length 0 While Stream Is Open And Has Valid Data In It?

May 25, 2012

in an winForm app in VS2010 win 7 compiling to x86, I try to do what Alvas.Audio seems to work. See (c# ex: [URL] for reference.

Dim data() As Byte = wr.ReadData(second * i, second)

The result give me data.length()=0. I do not have any exception, I can read format from it and whatever reader I use I got this problem.EDIT : After some tests, it seems like the uncompressed file I create in the first step (in PCM format, with .wav extension) can not be recognized by the Alvas.audio library for the second step. I must miss something around Audio file markups or something alike.

Here is the code that might be the source (basically this is step 1):

Dim functOut As String = String.Empty
Dim wr As Alvas.Audio.IAudioReader = Nothing
Dim fs As IO.FileStream = Nothing

[code]....

How can I write the resulted stream to be sure I can read it again later?

View 1 Replies

VS 2010 Truncate Lines In .txt File?

May 2, 2011

Im trying to truncate lines in a .txt file from 19chars to 13chars. Then copy the .txt file to another location and rename the extension to .lst. As below... Iam having issue with getting it to write the truncated number to the new txt file. Its some how returning a Null referance & i cant work out why??

Imports System.IO
Public Class Form1
Sub ProcessFile(ByVal SourceFile As String, ByVal DestFile As String)

[code].....

View 3 Replies

Redirect Audio Stream To/from The Serial Port?

Jan 19, 2011

I'm writing a program that will allow me to send SMS and call using a GSM modem.

I'm communicate with the modem using AT commands.

I have a problem with "connect" sound from the modem to the speakers.

After installing the modem is visible in the system as two ports.

On one of them sends and receives commands.

The second is just for voice communication.

I can't redirect PC audio input/output to the modem serial port. (So I can't hear callers and vice versa)

From what I've managed to find I have to use SAPI. (ISpVoice::SetOutput)

View 10 Replies

VS 2010 Make Shoutcast Stream Info Like The Stream Name

May 5, 2011

Im making a desktop player for a online web radio, and for the program I wanna make it show all the stream info. Like the stream name, and such. However I dont know how to do this? I looked everywhere

The server url is setup like this "[URL]" And it has all the stream info and that there. So is there a way I can get the info from there onto like say a label? Live updates btw.

View 1 Replies

Serial Data And Plotting In VB 2010

Dec 2, 2011

I'm fairly acquainted with VB but the underlying .Net and many of the controls and whatnot I'm not all that familiar with. Hence, I have a real hard time trying to come up with ways to solve certain problems. I figure the best way to start is try to get some general guidance and go from there.

I have an external electronic device that gathers data (no need for details here) and has an internal micro-controller that interfaces from the device to a USB port. I need to build a PC based program in VB 2010 that can get the data from the device and plot it on a graph...possibly a fairly customized graph. Let's assume there is already a driver for this device that sets up a COM port (pseudo-serial I guess it's called).

Now what part of the VB toolbox of methods, controls, objects etc (what's the terminology for that again?) should I be looking at to start such an application? I don't want specific code or anything like that but what areas in this "toolbox" should I be looking at to begin?

View 5 Replies

VS 2010 Incoming Serial Data?

Oct 29, 2011

I have a controller board that is built by us that sends strings to the serial port based on inputs that it receives. The app we are working on seems to be receiving the data fine but it is displaying it in an odd way and I'm sure it is a simple problem I am overlooking. Here is the incoming code so far:

Private Sub SecuritySerialPort_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SecuritySerialPort.DataReceived
ReceivedText(SecuritySerialPort.ReadExisting()) 'Automatically called every time a data

[code]....

View 4 Replies

VS 2010 Reading Data From Com / Serial Port?

Apr 3, 2012

Private Sub receive_data(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
Dim aBuffer(255) As Byte
Do While SerialPort1.BytesToRead > 0

[code]....

Basically, what I am trying to do is everytime I receive data from the serial port, I turn that data into an array (aBuffer) and I then call another sub using that info.The problem I'm having is that everytime I receive data, the array only fills up to the first 8 bytes! This isn't a problem when I receive smaller packets of 6 bytes but anything else gets chopped off.

What is really frustrating is that it seems quite fickle. I've read somewhere that this happens because the computer is handling the bytes received faster than they are being put in the buffer?? Not really sure but if I put a couple of breakpoints during debug, sometimes the array fills up correctly... Note the maximum size of any one incoming message would be 255 bytes.

View 4 Replies

VS 2010 Reading Hex Data From Serial Port

Apr 23, 2010

This is an amateur radio project. I have a TNC (modem) that receives a digital stream (AX.25) from my radio. The TNC decodes the AX.25 frames and translates them to KISS frames (the protocol used between the TNC and the PC, see documentation here: [URL] It sends the data as HEX values.

What I'm looking for on the serial stream is the beginning of a data frame marked by 0xC0 0x00 and ending with 0xC0. Should be easy. Using serialport.readbyte() I should get binary data that I can convert to hex and look for the beginning of a data frame and then convert the subsequent data to ascii, as it will be text from a chat session.

Just to try it out and see the raw data coming from the port, I use teraterm or realterm and capture the data and it's a mix of junk (control frames and what not) and valid text. When I display the same data in a text box in VB I get data that look like this:

[Code].....

View 5 Replies

Pass Serial Data From Serial Data Received Event

Dec 13, 2009

I'm trying to pass a data packet from the serial data received event.The code can capture the data without any issues.I'm spinning my wheels on getting the data packet out of the thread for further processing.[code]

View 4 Replies

VS 2010 Displaying Real-time Serial Data In GUI?

May 24, 2010

connected to my Arduino. Using the VB.NET (2010) GUI I request which LED I want on (via buttons) and the I2C device then sends a reply confirming which LED actually turned on (basic feedback). Ok, sounds great right? Here's where I get issues. Well when I try to read the serial data sent to VB and display the real-time stream on the GUI, a) I get a bit of a mess as an output (values are ok, just spewn across GUI) and b) when I select a new LED to turn on, the GUI data does not refresh to this change. The stream being sent from the Arduino is ok, I looked at the data in a serial monitor.

Public Class Form1
Dim ticktock As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles

[code].....

View 4 Replies

VS 2010 Receiving Data From Serial Port Monitor 4.0

May 30, 2012

i'm using serial port monitor 4.0. i need to know how to received the data and show in a textbox.

here is how my data look like in the serial port monitor:

40 03 04 05 00 00 00 80 05 04 01 00 00 00 11 00 @......�........
80 07 04 05 00 10 00 01 02 02 14 80 07 04 05 00 �..........�....
10 00 01 02 02 14 80 07 04 05 00 10 00 01 02 02 ......�.........

[Code].....

View 9 Replies

Sending Serial Data From Arduino To Visual Studios 2010

Dec 21, 2011

To send serial data from Arduino Mega 2560 to a VB.Net PGM, then the VB.NET pgm will read data then send to via FSUIPC (an Addin DLL) to ms flight simm 2004.OK that said here is the question: how can I write or phrase or construct the proper syntex needed to 1-limit the data sent,or in reading the data-limit the data read?I have enclosed the VB.NET code and the Arduino code. Please take a look. I am very new to both,but I try hard. all the code works but I get strange all most random data in VB. The FSUIPC end works OK, I can send to and receive from Ok.It's the VB pgm that gets the data wrong some of the time. say 8 out of 10 it is OK then button x will also turn on or off another check box then do what was aked. It seems that I am not clearing the receive buffer so I get a last chr sent before.I have tryed readline, readexisting,readbyte but I don't know how to phrase or construct any but the readline. I have tryed to flush the buffer in both codes but, well I am stuck. [code]

View 4 Replies

VS 2010 - Reading Data From Serial Port And Outputting To Screen And Access Db?

May 1, 2011

I have conquered the problem of the database however what i need is the serial port data sent to a database and outputted on screen however i keep getting cross thread errors ..

Imports System.Data.OleDb
Imports System
Imports System.ComponentModel
Imports System.Threading

[code]....

View 3 Replies

Error In Serial Port Data Capture Program In Visual Studios 2010?

Apr 11, 2012

I'm trying to make a rs232 serial data logging program, that accepts a 12 bit hex RFID tagID from an RFID module. My end objective is to save this RFID tagID into a database and assigned to a person for a personnel management system.I had to use button3 to add the value of the variable 'msg' into textbox1 because I was getting the following error "Cross-thread operation not valid: Control 'TextBox1' accessed from a thread other than the thread it was created on". It is a temporary workaround.When I do press button3, I get the incomplete hex number, instead of "4C00A2C82A0C", I get "A2C82A0C", and sometimes I get random digits like 1,A,C etc etc.

Public Sub OpenPort()
Try
If SerialPort1.IsOpen Then
SerialPort1.Close()

[code]....

View 4 Replies

Charachters In MASKED TEXTBOX

Jan 15, 2010

i wanna know about the main characters on Masked text box and meaning of them like CCCC, L, ?, 000, 999 and the second question is how i can use masked box to make user type a valid EMAIL.

View 1 Replies

Removing Charachters In Textbox

Jan 17, 2010

I use a button to locate a file, and it puts the location in the textbox as "C:file.exe"I need the "" so when a user select a folder with a space in it it wont see it as a new input.[code]But later i need the same location of the textbox but without the "" (Chr(34))charachters.How can i make it so it removes those characters out of the textbox?

View 1 Replies

VS 2010 Saving Data From Applications By Saving A Text File Via A Stream Reader As A String

Feb 12, 2012

Currently I am saving data from my applications by saving a text file via a stream reader as a string. I have come to a problem. In my current application, I have an array of the following structure:

[Code]...

View 7 Replies

HSD 32 Bit Data Bus To Serial Converter Via A Microcontroller - Data Sniffer To Read The Data Bus (32Bit)

Sep 3, 2008

Im working on a HSD 32 bit data bus to serial converter via a microcontroller. Now first I want to make a sort of data sniffer to read the data bus (32Bit) .All on the controller side is working and the stream of bytes are coming in via RS232 as 4 bytes in HEX like FD,A5,45,8B . I already converted the bytes in Dec and ASCII to determine what is passed true the bus and how fast and stuff.. Now that is all correct and working very well if the LSB (least significant bit) of the 32 data bus is Data line 0 and the MSB (most significant bit) is Data line 31 but if that is not the case I need to invert the 32Bits (like as I would invert the connector on the bus) . How do I best do this using the 4 bytes I send from the micro controller.

Example:

(MSB) 01001000 01100101 01101100 01110000 (LSB)
HEX= 48 65 6C 70
DEC= 72,101,108,112
ASCII= H E L P

I need to invert it with a button to:

(MSB) 00001110 00110110 10100110 00010010 (LSB)
HEX= 0E 36 A6 12
DEC= 14,54,166,18
ASCII= (SO) 6 : (DC2)

View 3 Replies

Reading Serial Port Read Data From Serial Port?

Aug 16, 2011

i am a absolute beginner and i want to use vb to receive data from micro controller through serial port using rs232 standards, i found this code to receive the data serially, can any one tell me where should i paste this code, so that the data received will be displayed in message box.Private Sub DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) HandlesSerialPort1.DataReceived

[Code]...

View 9 Replies

How To Implement Truncate To A Row

Jun 22, 2010

[TEX]Hello[/TEX] How do i use truncate in vb 2008?my database its in Access and i want to implement a truncate table in vb but i don't know how to do it.

View 1 Replies

How To Truncate An Array

Sep 3, 2009

is there a simple way to truncate an array ? Something like placing an end characted in the array which would signify its end ?

Basically I have two arrays of slightly different sizes and I want to shorten them so they both have the same size. The end data I am truncating I don't need.

View 4 Replies

VB 2003 - Handling Data - Transmitting Data From A Comm Device Via Serial Port

Nov 10, 2009

I'm currently working on a project where I am transmitting data from a comm device via the serial port and resorting the raw data (in binary) to its respective ascii values. The problem I'm facing is determining the most efficient method to accomplish my goal. Essentially, I have 68 bytes coming in, the first and second bytes represent the page and packet number and the data itself ranges from 3 to 64, the remaining for my checksum.

What I am needing to do is, grab 50 consecutive bytes per variable in my array, and that is where I'm confused. I have easily pulled my 3-64 bytes and stored that data to a string. I just don't know the most efficient method to accomplish my goal. Should I write directly to file all my data, as there are like 8 pages, of 128 packet data. [Code] I can capture the the first 50 by using a for-loop easily, but what would be the preferred method to track what data chunk I've taken? The more I think about it, I think I may just want to write to file, all my data, and then just take them back to back in 50 byte chunks. Is that the most efficient method?

View 3 Replies

VS 2008 Serial Data - Make Sure The Correct Data Is Received?

Jun 28, 2009

I am using Visual Basic express to create a serial interface to a multi-room audio controller. I have started by creating a form that can connect to the controller and I can receive data from the Controller and display Zone status, volume etc in corresponding texts box thaks to help from Stanav and Tassa in my previous thread.

My next problem is to do with receiving lots of data from the serial port and my application getting out of sync. This is mainly caused by turning the volum control as each time it is turned a little bit the controller sends out the new status of the Zone being effected

eg
****Turning Volume knob on Zone 1***
Status returned from Controller:
#Z01PWRON,SRC3,VOL05<CR>

[Code].....

View 7 Replies

Truncate String Value To 17 Characters Only?

May 19, 2010

how to truncate my string value to 17 characters only.

in my program, the acceptable number of characters for First Name is 17. Characters more than 17 should be truncated but it may cut words in the middle. I need to make the length max 17 characters, but, if it cuts a word, it should also remove this half-word completely.

View 7 Replies

Truncate The Beginning Of A Log File In .NET?

Feb 24, 2010

I have an VB.NET app that writes the status to a log file in text format. Over time, the file is getting large and I wanted to know if there is an efficient way to truncate the beginning of the file.

To make things easier, I am looking to specify a file size (say 2-3 mb) and I am writing the log using a StreamWriter:

Using strm As New IO.StreamWriter(filelocation.log, True)
strm.WriteLine("msg to write")
strm.Close()
End Using

I thought about using the strm.BaseStream.Length to determine how much of the file to cut off, but by using the .SetLength it would cut from the end - not the desired result.

View 4 Replies

VS 2008 : Don't Use Int() To Truncate Numbers

Oct 4, 2009

I've been using it and even saw a method in a MSDN search given that suggests that it should be used but have found that there are defects using it. An example of problem occurring.

Dim db As Double
db = Int(10.12 * 100) / 100

db should be equal to 10.12 but the result you get will be 10.11. In the above example nothing is being truncated. If you added some digits right of the 2 it would give a good result. But if you're using a variable and it sometimes is equal to 10.12 or 9.12 etc. then a problem would occur. Also if 10.12 was replaced with 10.03 you'd get a result of 10.02. 10.04 gives a result of 10.03. 10.2 gives a result of 10.19. I'm now using code such as what is seen below instead of using Int() :

bd = Decimal.Truncate(CDec(10.12 * 100)) / 100

You could declare bd as a Decimal and then you wouldn't have to use CDec(). If I try Int(1012) the result is 1012 but Int(10.12 * 100) will give 1011. Pretty weird in my opinion.

View 5 Replies

VS 2010 Socket Using FTP Stream?

Jan 29, 2012

I am successfuly connecting to an FTP server and have no problems with uploading / downloading files and initiating general file transfers. However, when attempting to list the directory I get a strange exception and it seemed to just start happening of its own accord.

Cannot access a disposed object. Object name: 'System.Net.Sockets.NetworkStream'. This is confusing! I am certainly not manually disposing any of the connection of stream reader objects, nor am I disposing anything else in this entire sub routine. On setting breakpoints, it seems that the array list is filled correctly but then the error fires when the status code is 226 despite me clearly specifying that the while loop should not run under these circumstances. (226 is equal to FtpStatusCode.ClosingData)

View 6 Replies

VS 2010 Stream Video Over Lan?

May 22, 2011

I'm trying to find source code for vb.net(2010). i want to stream video file (picture and sound) from my computer(server) over lan to another computer(client). on the server side i open the video into "Windows media player controller". how i stream the picture and sound over lan network?

View 1 Replies

DataGridView - Displaying Data From TCP Stream

May 24, 2012

I am using a Data Grid View to display data that come in from a tcp stream. When the stream receives data, the data is parsed and placed at the top of the grid. These are my top 3 lines of the cell clicked event of the Data Grid View.

Code:
If SpotsGrid.CurrentRow.Index = Nothing Then Exit Sub
i = SpotsGrid.CurrentRow.Index
tempFreq = CStr(SpotsGrid.Item(1, i).Value)

I placed the top line there to prevent errors when a user clicks on a blank grid before any data has been placed in the grid and to stop selecting anything if a user clicks on a column header. But my problem is as data is added to the to the top line that line of data is not click-able because the index=0 or Nothing. So my question is what would be the best way to code this so it is protected from the user clicking on a blank grid and the column headers but still allow the user to click on the first line of data?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved