Shop OBEX P1 Docs P2 Docs Learn Events
HM55B and H48C 'C' code — Parallax Forums

HM55B and H48C 'C' code

Eric ShufroEric Shufro Posts: 9
edited 2010-07-29 01:28 in Learn with BlocklyProp
Attached is code for the HM55B·and H48C·that can easily be ported to other architectures.

Also attached is a spreadsheet·containing calibrated and non calibrated output data from·the HM55B.

The HM55B source code provided self calibrates (relative calibration, not necessarily relative to North).

At lease one full rotation of the HM55B must be made before the output data·is used.

Hopefully this will help others getting started with the HM55B and H48C on a non Parallax micro-controller.

--Eric Shufro

Courtesy of Micrium Inc.
www.micrium.com

Comments

  • jinglingsjinglings Posts: 2
    edited 2008-06-25 09:48
    The hm55b.c is the code driver for the compass and Luminary Micro LM3S2965. i am currently using a PIC18f4520, 40 pins and i am compiling it using the PIC C Compiler(CCS). Is there any way that i can adjust ur code to fit into mine, since it is in C code. I just want to get an output from my HM55B and the accuracy and what not can be adjusted after that. Please guide me in this. Unfortunately, parallax only gives an example of a BS2 code together with the product.
  • Eric ShufroEric Shufro Posts: 9
    edited 2008-06-25 13:33
    Yes, you may port it to whatever platform you wish.· You will need:

    1) A general purpose timer, and a way to determine its frequency in Hz.
    2) 3 output pins.
    3) 1 input pin.

    To port the code, perform the following:

    1) Under LOCAL MACROS· write the code to set the corresponding pins high and low. (Remove GPIOPinWrite() and replace it with something relevant for your target).

    2) Within HM55B_Init(), write code to initialize the GPIO pins.· Set 3 pins to outputs, and 1 for input).· Initialize your free-running timer, and store its frequency in Hz within pclk_frq.

    3) Adjust ShiftClkDly() to read the timer. Replace TimerValueGet() with equivalent code.

    4) Assuming you have math libraries, the rest should compile. You may need to remove #include <includes.h> and include whatever header files your target requires.

    --Eric

    ·
  • maverick366maverick366 Posts: 1
    edited 2010-07-28 23:08
    Hi Eric;

    I need this code H48C but i am using LPC2148 ARM based microcontroller. Can you help me about this?

    Thanks for you reply.
  • Eric ShufroEric Shufro Posts: 9
    edited 2010-07-29 01:28
    As you may have noticed, the code that I uploaded previously was for a Luminary Micro part.· I may be able to assist you by means of pointing you in the right direction, but I do not have time to make the port to the NXP part unfortunately.· I recommend going through the driver one line at a time and adapting the macros at the top and a little bit of code in the init function for the LPC 2xxx.

    I wish I could be more help.

    --Eric
    ·
Sign In or Register to comment.