CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

18F67J50 with HMC6352

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
TDK29



Joined: 14 Jun 2010
Posts: 2

View user's profile Send private message

18F67J50 with HMC6352
PostPosted: Wed Apr 11, 2012 1:23 pm     Reply with quote

Hi,

I hope anyone here can help me.
I try to get the HMC6352 working with my PIC.

Routine:
start
send slave write adress (0x42)
send slave adress to read (0x00)
delay
start
send slave read adress (0x43)
read register
stop

The only answer i will get ist 0xFF.
I also checked the communication with an oscilloscope, the voltage level is within the borders. 10k PullUps installed (the rising edge is a little bit sloped, lower pull-ups would resolve this, but still the same response)

Here's the code:
Code:
#include <18F67J50.h>
#fuses INTRC
#use delay(crystal=8000000)
#use rs232(baud=57600,uart2, parity=n, bits=8, stream=rs2)
#use rs232(baud=9600, uart1, parity=n, bits=8, stream=rs1)
#use i2c(Master, scl=pin_c3, sda=pin_c4, FORCE_HW)

int data1, data2;
//int16 data3;

void read_hmc()
{
   i2c_start();
   i2c_write(0x42);
   i2c_write(0x00);
   
   delay_ms(10);

   i2c_write(0x43);
   data1 = i2c_read();

   i2c_stop();

}

void main()
{
   setup_oscillator(OSC_8MHZ);   
   while(1)
   {   
      read_hmc();   
      fprintf(rs2, "Test %u", data1);
      delay_ms(200);
   }
}



Thanks
Best regards
TDK29[/code]
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Apr 11, 2012 1:46 pm     Reply with quote

Please use the forum's search page to look for code in the forum archives.
Search for this: HMC6352
Look in the Code Library forum.
http://www.ccsinfo.com/forum/search.php
What I am saying is, don't write your own driver. Use the search page
to find a driver in previous posts. Always do this first.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group