Problem converting data to what I need


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2007
    Posts
    13

    Default Problem converting data to what I need

    Hi all,
    i am currently working on an LCD controller which interfaces with OBD2 vehicles (96-up). www.obd2lcd.com

    Here is my problem. For the OBD2 interfacing, i am using a chip called an ELM323. My main controller is a pic16f877a. I send commands to the ELM chip and recieve the requested info back. The problem I am having, is how to format the data i am recieving back from the elm

    let's take for example this scenario:

    i send the String "010F" to the ELM
    this is a request for intake air temperature

    the ELM sends back the response "41 0F 3C"
    the "3C" is the info i am interested in, as this represents the value i want

    here is the problem. The ELM was intended to be used with terminal type programs on a computer, therefore, it sends its data as ASCII characters. I need a way to take the characters "3" and "C" and treat them as the hexadecimal value 3C so i can do some math on it and output it in Decimal format.

    Any ideas?

    thanks,
    Jordan Cary

  2. #2
    Join Date
    Aug 2007
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    I think i answered my own questions...

    ((char1-48) * 16) + (char2 -48)

    thanks anyway! let me know if there is a flaw in that

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Read/Write Problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th February 2010, 01:51
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  4. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts