problem with VB6 code

Thread Starter

ravinaval

Joined Apr 14, 2012
7
- I m using P89V51RD2
I want to read data from PORT-2 of microcontroller using VB-6 software

while reading data form port, VB-6 shows the ASII value of the data but I want the decimal value

PLEAZ HELP
 

Thread Starter

ravinaval

Joined Apr 14, 2012
7
please help me in wrting code in VB-6.0 for reading the data from port of P89V51RD2 and displaying the exact decimal equivalent of data at the port.

storing it into the data and den displaying it in VB6.0


PLZ HELP
 

Thread Starter

ravinaval

Joined Apr 14, 2012
7
Use the ASC function.
ASC function is not working in our case

this is my code , plz suggest me or give me modified code


Public i As Integer
Dim values() As Integer
Public Temp_In As Variant
Public Data_In As Variant
Dim k As Variant
Public j As Integer

Private Sub Form_Load()

MSComm1.PortOpen = True

End Sub

Private Sub MSComm1_OnComm()
Temp_In = MSComm1.Input

Text1.Text = Text1.Text & Temp_In
Data_In = Asc(Temp_In)
Text2.Text = Text2.Text & Data_In


End Sub
 

Thread Starter

ravinaval

Joined Apr 14, 2012
7
What numbers are you getting and what are you expecting ?

I am giving data = 0011 1001=(39)"hexadecimal" at port -2 of of microcontroller
but Im getting ascii value of 39HEX ie 9 at the hyperterminal and as well as VB-6 gui textbox.

I want the same number 39 in my GUI.

thanku
 
Last edited:

MrChips

Joined Oct 2, 2009
30,824
0011 1001 is not 39- decimal
It is 57-decimal = ASCII "9"

There are 10 types of people in the world, those who understand binary and those who don't.
 

DumboFixer

Joined Feb 10, 2009
217
Why not use the str function ?

This will convert a number into a string so 59 will become "59".

The application help will tell you how to use the str function.
 
Top