HMC5883L interfacing with PIC16F877A

Thread Starter

clarelluffyjjang

Joined Jun 8, 2017
35
Hi, i am trying to interface HMC5883L with PIC16F877A using I2C. i have realised that my slave(HMC5883L) will never acknowledge whatever i send to it. i have checked the waveform, it is sending what i want it to send but the slave will never reponds to me aka the ACKT bit is high. i thought it was a chip failure so i bought another one but still no responds from the slave. i want to read the xyz heading from the slave but it will forever returns me 0XFF and my angle will be stuck at 359 degree forever. i have read on the internet that i might got QMC5883L instead of HMC5883L and i tried another slave address yet still the same outcome. can anyone give me a hints up how to continue with this problem? when i try to read from the SSPBUF it will either be 0xFF or the last data i write to the buffer.
 

Aswinth

Joined Nov 1, 2016
27
Hi, i am trying to interface HMC5883L with PIC16F877A using I2C. i have realised that my slave(HMC5883L) will never acknowledge whatever i send to it. i have checked the waveform, it is sending what i want it to send but the slave will never reponds to me aka the ACKT bit is high. i thought it was a chip failure so i bought another one but still no responds from the slave. i want to read the xyz heading from the slave but it will forever returns me 0XFF and my angle will be stuck at 359 degree forever. i have read on the internet that i might got QMC5883L instead of HMC5883L and i tried another slave address yet still the same outcome. can anyone give me a hints up how to continue with this problem? when i try to read from the SSPBUF it will either be 0xFF or the last data i write to the buffer.
As you said the problem is mostly because you having the fake version of HMC5883L. Look at the IC closely and read what is written on top of it.
If it says L883 then you are having the original one which is HMC5883L the I2C address for this one is "0X1E".
If the says DA5883 then it is the fake one which is QMC5883L and the I2C address for this one will be "0X0D".

If you want to double check you can also try the I2C scanner program using Arduino board as suggested by Albert.

Still if you have no luck in getting it to work, the problem might be with your program. Check if I2C is working as expected. Use a simulation software like Proteus to make sure you are sending and receiving the address in right way. For a sample I2C program with PIC16F877A you can refer the link below
https://circuitdigest.com/microcont...unication-with-pic-microcontroller-pic16f877a
 
Top