473,626 Members | 3,201 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 1326
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
4735
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 my controller, then the programm hangs up in the following line: WaitCommEvent (m_hCommPort, &dwEvtMask, 0);
0
1224
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 values.Am using the Oncomm event to detect reception of data.All was working fine till recently. I then changed my controller program to send 7 bytes/10msec.The rest of the settings are same(9600 baud rate). However now,after a few cycles of receiving...
15
8182
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 transactions occur? I'm trying to reverse engineer a microcontroller serial routine and I'd like to see any response the chip sends back. Regards, Ken
2
1171
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 receives data using the serial port object provided by .net framework. If I don`t put a delay after the transmit USART function in the embedded device the .net application loose data. If a put a delay the application works fine. Time is critical for my...
4
17857
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 link. But I cannot seem to capture the data using php, all I want to do is capture the data and display it on a web page. I Have used fread, fgets, looked into the uart fifo buffer and also looked into data streams, but there is so much I'm a bit...
1
1503
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 the chip to the PC and let the c++ program read this data) Regards to all..
0
1096
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 HyperTerminal will output the strings. However, in order to manipulate such data I found out that Visual Basic is needed. So I tried creating a basic Visual Basic window application using VB Express 2008 just to read bytes sent from serial, using...
2
3629
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 even though the bulkwrites are fine. I get a "usb_reap: timeout error". I tried to change the timeout to various values but still get that error. Has anyone experienced this before or knows what causes it and the solution to it? I am using pySerial...
5
2758
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 find sth for this in this language.Is there anyone who knows sth?I just need how to open a serial,establish the serial,close serial,send data to serial and read from serial. Because I have find some projects with serial in other languages if someone...
0
8265
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8196
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8637
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7193
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5574
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2625
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1808
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.