How to convert character array to ascii value in visual basic

Status
Not open for further replies.

anoop kr

Member level 4
Joined
Aug 6, 2010
Messages
69
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
kerala
Visit site
Activity points
1,885
This is my new project . I want to interface ATmega32 microcontroller with visual basic 6.0. I can communicate with visual basic through serial port bidirectionally. Aim of the project is that i have to monitor the ADC values of 2 channels in two text boxes in visual basic. The method i chose is that i use a timer in visual basic to send two characters to microcontroller and when the controller receives these characters the controller will send corresponding ADC values with one additional characters. When VB receives these character it will show the following value in the text box.

I use a string array to receive values coming from controller. When i use Asc() function in VB it showing some error. How can i convert the incoming values to ascii.

Also i giving the code in VB and the code for controller
 

Attachments

  • SERIAL.rar
    26.6 KB · Views: 101
  • serial-vb.bmp
    335.4 KB · Views: 111
  • serial-vb.txt
    2 KB · Views: 102
  • controller program.txt
    1,001 bytes · Views: 102

From micro to PC send data as characters that is 1 is sent as '1'. Just add 0x30 to digits if you are sending digits. Then use


Code Visual Basic - [expand]
1
2
3
Dim str as string
 
str = str & MSComm1.Input



Example send #1 to micro and micro sends back data1. Then send #2 to micro and micro sends data2.
 

thank you jayanth.. I got the solution for this problem in other way. I used error handler ie "On error goto label" and its working. When i interface the VB program to hardware its perfectly working and i can view individual data values of ADC from microcontroller in corresponding Text boxes. Now the new problem is how to log the data values in each text boxes to notepad. I have no idea about this. Now too i am searching in the internet. please help me
 


Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…