HMC6352 Problem

Digital Fiber, Photoelectric, Laser Range, Optical, Temperature, Rotary Encoder, Ultrasonic, Gas, Gyro, Accelerometer, FlexiBend, Flexiforce, Compass......

HMC6352 Problem

Postby jony john » Sat Jun 12, 2010 6:17 pm

hi all..i'm new in PIC..
i have place compass sensor HMC6352 in my project..
the problem is i don't know the sensor is still ok or not bcause while solder the 4 pin the temperature is about 250-300 Celsius..then when i download the program and the result is nothing happen..

my program:
CODE: SELECT_ALL_CODE
#include <16F877A.H>
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=20000000)
#use i2c(Master, sda=PIN_C4, scl=PIN_C3, FORCE_HW)
#include <lcd_module.c>
#define HMC6352_I2C_WRITE_ADDRESS 0x42
#define HMC6352_I2C_READ_ADDRESS 0x43
#define HMC6352_GET_DATA_COMMAND 0x41
int16 heading;
void setup()
{
lcd_init();
}

int16 HMC6352_read_heading(void);
void clearLCD();
//===================================
void main()
{
setup();
clearLCD();
while(1)
{

//heading = HMC6352_read_heading();
//heading=heading/100;
//lcd_gotoxy(1,1);
printf(lcd_putc, "heading");
lcd_gotoxy(1,2);
printf(lcd_putc,"%lu", heading);
delay_ms(1000); }

}
//==================================
int16 HMC6352_read_heading(void)
{
int8 lsb;
int8 msb;

i2c_start();
i2c_write(HMC6352_I2C_WRITE_ADDRESS);
i2c_write(HMC6352_GET_DATA_COMMAND);
i2c_stop();

delay_ms(7);

i2c_start();
i2c_write(HMC6352_I2C_READ_ADDRESS);
msb = i2c_read();
lsb = i2c_read(0);
i2c_stop();

return((int16)lsb | ((int16)msb << 8 )) ;
}

//==================================================
void clearLCD()
{
printf(lcd_putc, "\f");
delay_ms(100);
}


i don't know neither the sensor or program is not function..
jony john
Freshie
 
Posts: 4
Joined: Sat Jun 12, 2010 6:06 pm

Re: HMC6352 Problem

Postby shiyan » Tue Jun 15, 2010 10:19 am

Most probably is your code :lol:

Sorry, I don like to check code.
User avatar
shiyan
Amateur
 
Posts: 189
Joined: Wed Jun 09, 2010 10:59 am

Re: HMC6352 Problem

Postby ober » Tue Jun 15, 2010 2:52 pm

Please use the proper method to share your code if you really need to share it.

I don think is the soldering that cause the problem as you the pin you solder is at the breakout board, not the compass module itself. It should not cause major damage, except that your soldering is not good, the connection is not good enough causing the communication between PIC and compass module to fail, and hence nothing work.

Again, can you minimize the scope of the troubleshooting area by checking which part is functioning and which is not?
1. Check LCD first.
2. Check the I2C communication with compass module, if the hardware and other settings are correct, it will at least send back ACK when address is being send out by master.
3. Keep on going step by step.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: HMC6352 Problem

Postby sich » Tue Jun 15, 2010 2:53 pm

jony john WROTE:the problem is i don't know the sensor is still ok or not bcause while solder the 4 pin the temperature is about 250-300 Celsius..then when i download the program and the result is nothing happen..

Why did you read the temperature while soldering? And...what does it mean anyway?
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 603
Joined: Tue Apr 21, 2009 2:15 pm

Re: HMC6352 Problem

Postby jony john » Wed Jun 16, 2010 3:02 pm

thanks for all,,
my sensor is work properly..

regard:
JJ
jony john
Freshie
 
Posts: 4
Joined: Sat Jun 12, 2010 6:06 pm

Re: HMC6352 Problem

Postby ccperng » Tue Nov 23, 2010 10:00 pm

Sorry, actually the problem still exist. I juz went to lab and observe the waveform with the oscilloscope.
I am not getting the ACK from the sensor after i send the 0x42 slave address to it.

This is the portion of codes that I am using. I am using C#.
CODE: SELECT_ALL_CODE
 I2CDevice.Configuration myDeviceConfiguration;
        I2CDevice myCompass;
        I2CDevice.I2CTransaction[] myI2Command = new I2CDevice.I2CTransaction[2];
 
        byte[] myReadBuffer = new byte[2];
        int myBytesTransmitted = 0;
 
        // this constructor assumes the default factory Slave Address of 0x42
 
        public HMC6352Compass()
        {
            myDeviceConfiguration = new I2CDevice.Configuration(0x21, 100);
            myCompass = new I2CDevice(myDeviceConfiguration);
        }
ccperng
Freshie
 
Posts: 4
Joined: Tue Oct 26, 2010 11:24 pm

Re: HMC6352 Problem

Postby ober » Wed Nov 24, 2010 10:04 am

Any root cause? It will be good if you could share the reason for the failure, let us know and learn .
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: HMC6352 Problem

Postby ccperng » Thu Nov 25, 2010 2:24 pm

Any1 can help regarding this matter ah??
ccperng
Freshie
 
Posts: 4
Joined: Tue Oct 26, 2010 11:24 pm


Return to Sensor

Who is online

Users browsing this forum: No registered users and 24 guests

cron