![]() |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
Howdy,
I have a satellite tracking program that outputs from AZ,1-359,EL,1-90 in ASCII. I am just wondering how I can convert this to something meaningfull in the PIC. example How would I convert '2' '8' '0' ASCII to a binary equivalent ? See I want to compare this to the counter in the PIC and then do something. Work out if the incoming value is higher or lower than the current counter value. Ideas ? -- Andrew Rich (VK4TEC) www.tech-software.net space - electronics - radio - aviation |
#2
|
|||
|
|||
![]()
"Andrew Rich" wrote in message ...
Howdy, I have a satellite tracking program that outputs from AZ,1-359,EL,1-90 in ASCII. I am just wondering how I can convert this to something meaningfull in the PIC. example How would I convert '2' '8' '0' ASCII to a binary equivalent ? See I want to compare this to the counter in the PIC and then do something. Work out if the incoming value is higher or lower than the current counter value. Ideas ? Hi What Language are you programming in most languages have a string to integer function that you would enter only the numeric part into the function using a mid function. For example : Say you ASCII string is "ASDA 280 dsfsddas" and you wanted to convert the 280 to an integer value you'd do something like this :- NumberValue = strtoint(mid("ASDA 280 dsfsddas",6,3)) it all depends on what language you are using .... Another more bacward way is using the Ascii values Text - Asci Value 0 - 48 1 - 49 2 - 50 3 - 51 4 - 52 5 - 53 6 - 54 7 - 55 8 - 56 9 - 57 You convert each Character to its Ascii value then minus 48 from it and then times it by it's relavant place in the number. For Example. 280 = ascii 50,56 and 48 so you take 50 - 48 = 2 and times it by 100 which is 200 then take 56 - 48 = 8 and times it by 10 = 80 and add it to the number which is 200 + 80 = 280 the last value is zero so you would not need to do it since it has no effect on the output. does any of this help? Ralph |
#3
|
|||
|
|||
![]()
Andrew Rich wrote:
Howdy, I have a satellite tracking program that outputs from AZ,1-359,EL,1-90 in ASCII. I am just wondering how I can convert this to something meaningfull in the PIC. example How would I convert '2' '8' '0' ASCII to a binary equivalent ? See I want to compare this to the counter in the PIC and then do something. Work out if the incoming value is higher or lower than the current counter value. Ideas ? Look at an ascii table (google should help) This gives each charachters code, (2 is 51 for example). Now just convert from decimal to binary. |
#4
|
|||
|
|||
![]()
The windows Accessories calculator will convert to binary
Just switch to the binary calculator . -- "Andrew Rich" wrote in message ... Howdy, I have a satellite tracking program that outputs from AZ,1-359,EL,1-90 in ASCII. I am just wondering how I can convert this to something meaningfull in the PIC. example How would I convert '2' '8' '0' ASCII to a binary equivalent ? See I want to compare this to the counter in the PIC and then do something. Work out if the incoming value is higher or lower than the current counter value. Ideas ? -- Andrew Rich (VK4TEC) www.tech-software.net space - electronics - radio - aviation |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
UK Will Build First Satellite To Study Wind From Space | Ron Baalke | Science | 0 | November 20th 03 04:05 PM |