Comport Read Code(how I Wil Convert Ascii To Decimal)
Respected Sir
I am facing problem to read data from comport I have used MSCOMM but i am getting data in ASCII code But i want it in decimal format How i will get it ?
Your help (sample code) and guidance is greately appreciated!
Regards
Bama
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Convert Hex To ASCII, Code Is Attached
Arnout, I don't see CLng() returns a Decimal value from Hex. I tried as follows but a mismatch error happens. It only takes values 0 to 9
Option Explicit
Dim SMSOctetOutput
Dim StrHextoDecimal, StrDecimalToAscii
Dim strText
Private Sub Command1_Click()
SMSOutput = Text1.Text
StrHextoDecimal = CLng(SMSOctetOutput)
StrDecimalToAscii = Str(StrHextoDecimal)
Text2.Text = StrDecimalToAscii
End Sub
My intention is to convert a Hex value to ASCII
Convert ASCII Code To Character
I am able to get the ASCII code for a character by using the Asc function, but how do I go about getting the character for that ASCII code? If there a command that is pretty much the opposite of Asc?
-Matt.
<('.')>
"Unthinking respect for authority is the greatest enemy of the Truth."
Convert Character To Ascii Code?
hi,
Is there anybody help me on this.
How can i convert Character A or B or C and other, to ASCII code
Thank you very much
Regards
Ooi
Convert Ascii Constant To Ascii Value With Program
How would I go about doin the following? If a string contains "vbKeyF1", how would i get vbKeyF1's ASCII value equivalent (ie: 112) to be written in another string?
Edited by - Marce22 on 10/10/2003 7:04:38 PM
Read From Comport And Send String To Active Apllication
Hi
I need to write a VB6 application which runs in the background and listen to the com port. If there something comes, manipulate this information and send it to the cursor of the activ application (SAP).
I now how I can get the sting from the com port and also the manipulation is not a problem. But I don't know how I can run th application in the background and send the information to the active application. Any help?
Thanks
Michael
Problem With ReadFile() To Read From COMport On Chinese Systems
I use the winapi function ReadFile() to receive strings (bytes) from the serial port.
This works fine in most cases.
But when I receive binary data on system with languages settings chinese (simple) set as default, the function ReadFile() returns false strings!?
I use win2k and have set in the control panel->language settings-> 1st tab:
scheme: english (USA)
language settings for the system:
chinese (simple) as standard
In this case the string returned by ReadFile() returns ascii &h00 instead of ascii &h80.
Is there a ReadFileW() function for wide ascii?
Or do I have to modify the DCB?
In BuildCommDCB I have set in DCB the fBitFields to (&h1011), fBinary is set.
Sending and receiving text strings does work.
And sending binary data using the ApiFunction WriteFile() seems to work because the device (which is connected at the other side of the serial cable) answers. Well this could be a answer with an error as well, so I am not really sure.
Thanks for any hint.
Guenni
How I Can Convert Decimal To Hexa Decimal??
Hi,
I want to convert a decimal to hexadecimal in VB.
the value is more than signed32 bit.
i got one code ConvertDecimalToHexadecimal(ByVal Value As Double) from internet which is also giving overflow error.
Can anyone take up this challenge to help me out.
the decimal number for which i need hex(the number is a random generated one) = 11783197335
I need a quick response.
Thank you in advance
Decimal To Ascii???
Hey all,
I am reading a file For Binary for the first time, and I'm a little confused as to how the decimal relates to ascii (text characters). Here's an example of what I have done:
Code:
Open strWorkPATH & "Patd.dat" For Binary As #1
Do Until EOF(1)
Get #1, , strByte
Loop
I know that my patient's number is the first two bytes, so strByte represents that number very well, but Byte 10 begins the patient's name, and I'm still reading decimal numbers... The first "letter" of the patient's name is "83", which I then converted to the Hex value of "53", using Hex(strByte), but I think I'm barking up the wrong tree.
Any help would be greatly appreciated.
Thanks,
RichS
Decimal To ASCII
Does anybody know whether there are functions or methods to convert a decimal to ASCII and decimal to Binary?
ASCII To Decimal Conversion
How do I convert an ASCII value into a decimal value??? For example, if the ASCII value is 3231343536 the decimal equivalent is 21456. How do I achieve it in the program????
Decimal, Ascii, Conversion, Fuctions
hi, is there a function that i can use to convert my input into decimal or ascii?
MSComm1.Output = Chr(txtSend.Text) using this i can onli input decimal but i need to input letters from A-Z and numbers 0-9.
converting it to ascii will also help
my output is in binary.
thanks
nas
Converting A String To Ascii Or Decimal Or Hex
can anybody help me convert a string entered into a textbox into its binary/dec/hex/ascii value?
I want to then, after incrementing the value, place the new value into another textbox as a string that the numbers represent.
I've tried the chr command, but learned that it is ony for the first character in the string.
Please help me...
mMiniImManN
Convetring Decimal, Hexadecimal, Octal, ASCII ...
I am trying to make a Decimal, Hexadecimal, Octal and ASCII conveter.
I know what these do :
value- My decimal input
hex(value)- The HEX value of it
oct(value)- The OCTAL value of it
chr(value)- The 0-128 ASCII value (letters, characters, etc)
asc(value)- If my input is a letter, gives its ASCII value
Now i wanna know how the f*** do i convert 0x11 in hex to decimal (would be 17) ???
Anyone that can help, PLEASE DO !
Hex To Decimal Convert
Hi,
I'm receiving an hexadecimal data throught the serial port of a device, for example:
Buffer = Buffer + MSComm1.Input
and when you read that buffer it tells you the value: 0F56 for example.
Now my question is how can I convert that hex value into decimal value so that I can actually plot it on a graph.
Right now I'm using,
Vplot = Val("&H" & Mid&(Buffer, n+1, 4))
But unfortunatly I end up getting a Run-Time error "13", type mismatch error message and it won't let me continue. Does anyone have any ideas?
Thatk you for your help,
Dan
Convert Hex To Decimal
I'm trying to convert hex to decimal. This is what I have:
Code:
Dim HexStr As Variant
Dim T As Variant
HexStr = "C145F67H"
T = Left(HexStr, 2)
Text1.Text = Int(Left(T, 1)) * 16 + Int(Right(T, 1))
What it should be returning is number 193, but I keep getting the type mismatch error. Please help. Thanks.
Convert Hex To Decimal
I have an exported file that has a set of numbers in Hexadecimal format. I would like to convert this into straight decimal format. Anyone know how to do this?
Hex To Decimal Convert?
Our system (SAP) show this value '0000C4E0' like '50400'. How should I do to show the value '0000C4E0' like '50400' with VB?
Convert Hex Into Decimal
I have a string containing a hexadecimal value. How co I get a decimal value out of it's contents?
Convert Hex To Decimal
Can someone tell me how to convert an Hexidecimal number to a Decimal number please, as i want to convert a hexadecimal colour of say a form to that of a decimal one...any1 know how?
Convert .wav To ASCII
Hi,
I would like to convert a file in wav format into txt format, so to obtain a vector of numbers to create a graphic, with a program, like excel, that is not Matlab.
Exactly I've an algorithm in Visual Basic that analyses a vector of points (graphic) and then gives me in output a series of parameters.
In matlab this is easy, because it recognizes wav files but if I would like to do the same thing in Ms Access, I've to convert before, the wav file in txt file so that my algorithm in Visual Basic can analyse it.
Anyone knows if there exist some algorithm or code that convert wav files in ASCII text files?
Thanks
Bernd
Convert Ascii To Hex
ok i know to convert hex to ascii is simply Val("&h" & hexvalue), but how do you convert ascii to hex? using somthing simple like that (if existant), maybe i just need sleep to realize how to do it but right now i cant think of how to do it. help!!!
Convert *.Wav To ASCII
Is there a way to convert a *.wav file to a ASCII text that contains the sound in a numerical way. I also want to know the otherway around (converting ASCII to *.wav)
I f there's anybody who has a idee please let me know
Thanks
Christian
Convert Decimal To Binary??
Dumb question... is there a built in function to convert decimal numbers to binary?
ie. convert 164 to 10100100
Or am I going to have to write a function to do this?
lol, something I never thought I'd need to do.
How To Take H:M:S And Convert It Into A Decimal Number. ???
I had a post similar to this earlier. That I needed to take a decimal number and convert it to H:M:S. Got that working.
I need to know how to take the time that is entered into 3 text boxes ( one for hours, one for minutes, and one for seconds),,, and convert that time into a decimal number.
Also... i have a procedure that makes an answer in this format... H:M:S
Can you tell me how to seperate that up, and display it in the 2 text boxes?
Thanks alot, you guys are a great help.
Convert String To Decimal
How do I convert a string to integer value?
suppose I have a string "7498". This string is in hex value. I need to convert it to decimal. How do I do that?
I cannot find a function which allows me to convert from a string to hex then to a decimal. Please help.
Convert Decimal To Binary
Hello all,
I have just written a function to convert a decimal number into binary. The function works fine with just one problem, I need the number in eight bit binary format.
For example my code will convert the number ten into 1010. I need it to convert it so it reads 00001010. This is my current code;
Code:
Public Function inttobin(ByVal decnum As Long) As String
Dim binstring As Integer
Do While decnum <> 0
binstring = decnum Mod 2
inttobin = binstring & inttobin
decnum = Int(decnum / 2)
Loop
End Function
The only way I could think of achieving this was like this;
Code:
Public Function inttobin(ByVal decnum As Long) As String
Dim binstring As Integer
Do While decnum <> 0
binstring = decnum Mod 2
inttobin = binstring & inttobin
decnum = Int(decnum / 2)
Loop
Do While Len(inttobin) <> 8
inttobin = "0" & inttobin
Loop
End Function
but this seems a like a bad way to do it. Is there anyway I can make sure that the inttobin string is always 8 bits with any additional buffered bits being 0?
Convert A Decimal Into Its Digits?
Using VB6...
Is it possible (and can anyone give me help / code for) to isolate the individual values of a decimal? It certainly has me puzzled...
For example:
Say I had the value "18.20" in one text box, and I wanted to pass each value as a parameter to a different routine, which would display the number on a virtual LCD display. The values would have to be variables, obviously, and the Loop would have to work backwards from the 0, as there are always 2 decimal places.
I have already written the subs involved in the converting, I just need to pass the values to them... from a text box value in the format "00.00".
Said variables would then be passed to the subroutines via something along the lines of:
Code:
Call Sub1(Var1)
Call Sub2(Var2)
Call Sub3(Var3)
Call Sub4(Var4)
Yes, I know it's confusing. I'm confused. I've been programming for about 6 months. But help would be greatly appreciated. Thanks in advance.
Convert Binary To Decimal In VB
I've been looking for a way to do this for about two weeks now. Searching Google, Yahoo and even these forums. My question is. How can you convert Binary to Decimal? The app I am writing needs to take a binary number that someone enters into a text box, convert it to decimal and output that to another text box. This would be done with a button click event of course. I've got everything together except that part. I'm using Visual Studio 2005. Any help would be appreciated.
How To Convert Decimal # To Time?
hi,
let say, the user typed a number in the textbox "1.5". how can i convert it to 1 hr. and 50 sec. "1:50" because in normal "1.5" the same as "1:30".
thanks
sibasib
Edited by - sibasib on 10/21/2004 7:33:20 PM
Convert Seconds (with Decimal) To Hh:mm:ss?
Dear VBCity Friends,
Good Day! Currently, i am using a function to convert seconds (without decimal, 126815 Seconds) to hh:mm:ss!
But, when i try to use my functions to convert (with decimal, 1365489.322158) to hh:mm:ss, how come the time is different!
Please help & many thanks!
Code:Call formatTimeLength(time_elapsed)
Code:Private Function formatTimeLength(convertRT As String) As String
Dim X As String, ss As String, hh As String, mm As String
ss = convertRT 'convertRT=58677.3606033325 seconds
If ss >= 3600 Then
hh = ss / 3600
ss = ss Mod 3600
Else
hh = 0
End If
If ss >= 60 Then
mm = ss 60
ss = ss Mod 60
Else
mm = 0
End If
X = Format$(hh, "00:") & Format$(mm, "00:") & Format$(ss, "00")
End Function
Convert String To Decimal
Hi folks
How to convert string to decimal in vb program
is there any API function is avalible
please give some sample coding for me.
-------------------------------------------------------------------
"HARD WORK NEVER END FAILS"
Convert Char To ASCII
I was wondering if there was a way to check that the first character in a string is a letter vs. a number.
Example: "123M" vs. "M123"
I was thinking of taking the first charcter, changing it to its ASCII value and comparing it with ASCII value of letters vs. numbers to figure it out that way..
Is there some feature in VB 6.0 that i can use to see whether the character is a letter or number? (Zero is included in the numbers.)
Thanks!!
Convert 5 Lines Of Hex To ASCII
OK, I have been reading up on ASCII but still can not get this right.
My app reads from a device on com port that sends 5 lines of ASCII code
Example
Quote:
49 02 01 00 00 00 31
49 02 02 47 36 4B 44
49 02 03 35 34 59 58
49 02 04 32 55 31 33
49 02 05 34 38 33 32
>
Which I need decoded to
Quote:
1g6kd54yx2u134832
The documentation I have found says this
Quote:
Returns 5 lines, A is line ordering flag, B-E ASCII coded VIN Digits
So I guess the 49 02 of each line is to be ignored?
and the rest needs to be converted?
Below is a screen shot of the message I received today
Convert A Word To Ascii
Hi peeps i was wondering if anyone can help me with this problem.
i am making a program to convert words to ascii and then display the ascii in a textbox
i can make it convert 1 letter of the word only. is there anyway to make it convert the whole word into ascii
thx
Convert Characters To Ascii No.
i have an array called chars(). when my program runs, 1 character is stored in each variable of the array eg. chars (0) stores 1 character, chars(1) stores 1 character and so on. i heard that there are 256 ascii characters, is there a simple and fast way to convert each character into its ascii number, say chars(0) had the letter u stored in it and the number of u was 132 then chars(0) would be changed to 132
thanks
How To Convert It To ASCII File
I download a log file from SUN server,if i open it with notpad,it looks like: ???? % @#w./.....; it's a binary file , my custumer can't read it unless it is a ASCII file.so i want to know how to convert it to ASCII file readable with .TXT or .XLS
maybe I should use following :
open "d:log001" For Binary As 1
...
...
Get .....
...
Close 1
Open "d:
esult.txt" For Random As 1
.....
Put ...
but it's difficult to know the rule of binary file,
any advice is very useful to me!thanks
Convert Ascii To Binary
Hi all.
I have a bit of a problem. I am getting a value from an OCX and it is in ascii. How can I convert the string so that it shows the binary representation of these values?
I.E. I get the value "Hi" "H" is 072 ascii and "i" is 105 ascii.
Then turning and converting those values to binary so that I get
"010010001101001" the binary equivilant.
Any help would be GREATLY appreciated
Convert String To ASCII
How would I go about converting a string into and ASCII string. Just for an example, say I had the string apple (the ascii characters arent right)
Apple
a=4 p=7 p=7 l=2 e=1
Then the ascii string would be 47721
Anyone?
Thanks
|