473,498 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

recieving Serial data from microcontroller

1 New Member
I am sending Data from the micro controller through RS232 (COM1) every second. The ADC on the micro controller converts the data from Light detecting resistor and every second it sends it out through the serial. From VB I connect through the comport from the event button click, then receive the data on the timer_click event every second. The code to connect and read line is included:
Expand|Select|Wrap|Line Numbers
  1. Private Sub tmrLight_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrLight.Tick
  2. Dim currentStat As String
  3. 'Dim cStat As Integer
  4. 'Dim lightper As Double
  5. 'currentStat = com1.ReadLine() 'ReceiveSerialData()
  6. 'cStat = CInt(currentStat)
  7. 'lightper = CDbl((cStat - 130) * 1.56)
  8. 'lblLightLvl.Text = CStr(lightper) & "%"
  9. 'currentStat = ""
  10. End Sub
  11. Private Sub btnConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnect.Click
  12. If com1.IsOpen Then
  13. com1.Close()
  14. End If
  15. Try
  16. With com1
  17. .PortName = "COM1"
  18. .BaudRate = 2400
  19. .Parity = IO.Ports.Parity.None
  20. .DataBits = 8
  21. .StopBits = IO.Ports.StopBits.One
  22. End With
  23. com1.Open()
  24. lblAlert.ForeColor = Color.Blue
  25. lblAlert.Text = "COM Port Connected"
  26. btnConnect.Enabled = False
  27. btnDConnect.Enabled = True
  28. Catch ex As Exception
  29. MsgBox(ex.ToString)
  30. End Try
  31. btnOnOff.Enabled = True
  32. btnSetTimer.Enabled = True
  33. cbAuto.Enabled = True
  34. tmrLight.Start()
  35. End Sub
  36.  
Apr 1 '08 #1
1 1310
Dököll
2,364 Recognized Expert Top Contributor
Not sure how this can be handled, bubsaboey!

Please stay tuned for added support.

Dököll
Apr 1 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
4718
by: Steffen | last post by:
Hello! I'm excanging data with an microcontroller (Atmel) via the serial port. My C++ programm is written in Microsoft Visual Studio .net (7) I have the following problem: If I disconnect...
0
1211
by: sandeepa | last post by:
Hello all I am using the serial port to receive data(7 bytes per second) from the microcontroller,receiving the data as a string and then splitting the string in two,to display 2 different...
15
8164
by: xkenneth | last post by:
Hi, I'm writing a couple python applications that use the serial port (RS-232) quite extensively. Is there any way I can monitor all activity on the serial port and have it printed as the...
2
1164
by: pmishu20 | last post by:
I`m working on an embedded project that implies an external device equiped with microcontroller to communicate via rs-232 with a pc application. I`ve written the pc application in .net C# that...
4
17826
by: boonboy28 | last post by:
I have a BS microcontroller sending data over the serial port to a pc with php. the data is indeed sent as it is displayed within the terminal window. So I have sent and received data over the serial...
1
1495
by: Narjis | last post by:
Hi everybody? hope y'r all fine I need a small help.. can anyone give me a c++ program that reads the serial port data? (i.e. that data are burned in a microcontroller chip and i want to connect...
0
1087
by: alvatar | last post by:
I am doing a project on microcontrollers and want to be able to send and receive data via RS232 serial cable. Right now, my PIC microcontroller code is able to send string data to the computer and...
2
3622
by: JimmyC | last post by:
Dear All, Two separate questions... I am using pyUSB with python 2.5 and libusb-win32 version 0.1.12.1. My code is able to connect to my device (AT91SAM7X256) but is unable to do bulkwrites...
5
2751
by: kwstas86 | last post by:
Hello I have a project which i need to build an interface in vc++.Net to communicate with a serial port with a microcontroller.I am a little bit amateur in programming.I search the web but i haven't...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7004
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7208
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6890
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5464
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4593
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3095
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
657
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.