-
Jun 7th, 2014, 12:59 PM
#1
Thread Starter
New Member
A from to read data from an ECU
Gents/Ladies,
To cut a long story short I'm a PLC/SCADA guy but i have a bet with a guy at work who says i can't code normal software so its a bit of challenge for me , I'll start of and admit my knowledge is limited but have very basic understanding due to simple scripting.
I basically want a form to display 6 values using gauges and labels in real time. from an ECU so its serial comms. I've found out the data and got some info acquired from a hyper terminal type program, its in bytevalue etc and got the parity etc figured out, it'll need converted from a CHAR to DEC then outputted into a label or something.
The first question is i want to get a good library to add some gauges so i thin I'll have to install a library nd install via references?
Second, can anyone help me with a basic code structure? at the moment i have 6 label and a close button, i cant even seem to get time set in a lable to update in real time. After this I'm struggling.
thanks
-
Jun 10th, 2014, 08:09 PM
#2
Fanatic Member
Re: A from to read data from an ECU
Hi, can you post the code you have already? secondly to update values you need something to happen over and over, this can be in a loop or a timer control. may be best at this stage to use a timer control.
also what do you mean by gauges? like a graphical representation of the data?
My CodeBank Submissions
- Listbox with transparency and picture support - Click Here
- Check for a true internet connection - Click Here
- Open Cash drawer connected to receipt printer - Click Here
- Custom color and size border around form - Click Here
- Upload file to website without user logins, includes PHP - Click Here
- List All Removable USB Storage Devices - Click Here
- Custom On/Off Slide Control - Click Here
- Insert multiple rows of data into one database table using parameters - Click Here
- Trigger USB/Serial Cash Drawer - Click Here
-
Jun 18th, 2014, 03:48 PM
#3
Thread Starter
New Member
Re: A from to read data from an ECU
Hi there thanks for the reply.
I managed to use a timer for the clock, however stuck on the serial part. I have found out the ECU Data is sent 21 bytes at a time many times per second(10+ per second), so a total of 210 or more bytes per second.
Each 21 byte packet contains all 19 channels of data. Channel 1:RPM
byteValue: 84 which = 'T'
Offset: 0
Scalar: 100
RPM = byteValue * scalar + offset
RPM = 84 * 100 + 0 = 8400rpm
The current serial code i have is, but havent got much further. So each of these channels need put into i guess a buffer then a variable and updated every second should be suffice.
Public Class Main
Function ReceiveSerialData() As String
' Receive strings from a serial port.
Dim returnStr As String = ""
Dim com1 As IO.Ports.SerialPort = Nothing
Try
com1 = My.Computer.Ports.OpenSerialPort("COM4")
com1.ReadTimeout = 10000
Do
Dim Incoming As String = com1.ReadLine()
Incoming = TextBox1.Text
If Incoming Is Nothing Then
Exit Do
Else
returnStr &= Incoming & vbCrLf
End If
Loop
Catch ex As TimeoutException
returnStr = "Error: Serial Port read timed out."
Finally
If com1 IsNot Nothing Then com1.Close()
End Try
Return returnStr
End Function
-
Jun 27th, 2014, 03:43 PM
#4
Thread Starter
New Member
Re: A from to read data from an ECU
Bump
-
Jul 19th, 2014, 12:31 PM
#5
Thread Starter
New Member
Re: A from to read data from an ECU
No body
-
Jul 19th, 2014, 01:49 PM
#6
Re: A from to read data from an ECU
you are polling the serial port at a very high rate if you do this in a do loop, watch your cpu usage in taskmgr. the serial port has got an event datareceived you should use this instead. you need to concatenate all received chars until you reach your 21 bytes or better, there probably is a frame start byte or something that you should look for. then you need to extract the 19 values from the string
-
Jul 19th, 2014, 02:00 PM
#7
Re: A from to read data from an ECU
There is a link in my signature that might provide you some insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|