#include <16F88.h>
#device *=16
#device ADC=10

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES INTRC_IO                 //Internal RC Osc, no CLKOUT
#FUSES PUT                      //Power Up Timer
#FUSES NOMCLR                   //Master Clear pin used for I/O
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD                    //No EE protection
#FUSES NOWRT                    //Program memory not write protected
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOPROTECT                //Code not protected from reading
#FUSES FCMEN                    //Fail-safe clock monitor enabled
#FUSES IESO                     //Internal External Switch Over mode enabled
#FUSES RESERVED                 //Used to set the reserved FUSE bits

#use delay(internal=8000000)
#use rs232(baud=9600,parity=N,xmit=PIN_B5,rcv=PIN_B2,bits=8,stream=serial,errors)
#use i2c(Master,Fast,sda=PIN_a1,scl=PIN_a2)

#include <math.h>
#include "compass.h"

void main()
{

init_i2c();
hmc_init();

   while(TRUE)
   {

      rd_5883_vals();

      printf("\n\rReal heading: %g\xb0",cxf);
      
      delay_ms(5000);    //Repeat every 5 secs

   }

}
