A function for ASC11 to decimal
Moderators: David Barker, Jerry Messina
A function for ASC11 to decimal
Does any one have a sample of ASC11 to decimal Thanks Burt
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
I no about that. What the deal is I've seen a functions that changes data
back thats been sent to the pic over a com port I send 1 the pick tells me it's a 49 which is 1 in asc11 I send a 0 it's 48 I want the dam thing to send decimal not text I send 123 but I get 49 50 51
I saw a function I'm sure you even made it or helped
I no I can take and -48 from 49 get's the 1 so on
But how to turn a bigger number back don't seem to work.
back thats been sent to the pic over a com port I send 1 the pick tells me it's a 49 which is 1 in asc11 I send a 0 it's 48 I want the dam thing to send decimal not text I send 123 but I get 49 50 51
I saw a function I'm sure you even made it or helped
I no I can take and -48 from 49 get's the 1 so on
But how to turn a bigger number back don't seem to work.
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
It sounds like you're working with a string data type, and not a byte....send decimal not text I send 123 but I get 49 50 51
If you have a byte (0-255) and you want to send it out the serial port as a single binary byte, then use Usart.WriteByte()
There seems to be a lot of confusion about ASCII text, string data, and it's binary data representation.
Here what I was trying to do just need to add the CR as a test so it knows to wait for the next 3 byte from the usart
I would like to make a function that wait's for a start byte then reads the 3 bytes and looks for CR then outputs this to my seven segment display
There is a problem with that code to I can't send numbers less then a 100 to it all i need is 0 to 255 dang this looks easy but it's not LOL
Code: Select all
Dim StrA, StrB, StrC As Char
Dim StrResult As String
SetBaudrate(br9600)
While true
StrA = (USART.ReadByte)// 1
StrB = (USART.ReadByte)// 7
StrC = (USART.ReadByte)// 0
StrResult = StrA+StrB+StrC
SegDisplay.Update (StrToDec(StrResult))
Wend
There is a problem with that code to I can't send numbers less then a 100 to it all i need is 0 to 255 dang this looks easy but it's not LOL