View Full Version : HOWTO Convert character to Decimal
NL2TTL
- 4th April 2005, 13:55
Hello,
I'm using the serin commando to recieve 4 karakters like "2560"
now i need to convert this four karakters to the decimal value 2560
has any body a idee.
SERIN2 is no option!!!
Dwayne
- 4th April 2005, 16:27
Hello NL2TTL,
N>>I'm using the serin commando to recieve 4 karakters like "2560"
now i need to convert this four karakters to the decimal value 2560
has any body a idee.<<
since is is always a 4 character situation... use the dig command.
PSUEDO code:
Decimal var word 'byte is no good, because you are using 4 digits
counter var byte
Decimal=0
For counter= 3 to 0 Step -1
Number=Data Dig counter
Decimal=Decimal + (Number *(10^counter))
Next counter
SerOut Decimal (a decimal representation of your 4 numbers.)
I am at work, so I cannot give you the exact working code. but the above is very very close.
DWayne
mister_e
- 4th April 2005, 17:00
PBP already handle it for you
SERIN2 Serpin, Baudrate,[DEC4 MyVar]
Powered by vBulletin® Version 4.1.7 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.