EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / i have done that thing also 

i have done that thing also 

|

Microcontroller › AVR › imu sensor mpu 6050 help › i have done that thing also 

September 2, 2014 at 1:42 pm #12120
disha k
Participant

i have done that thing also  nothing is wrong with the lcd …

this is my actual code:

here is my code:

#include<avr/io.h>                 //This is the header for AVR Microcontroller.
#define F_CPU 12000000UL
#include “i2cmaster.h”
#include<util/delay.h>      
#include”lcd118010.h”                  //lcd
#define mpu 0X68                     //address of the i2c device
int main(void)
{
unsigned char ret=0;

DDRC=0X00;
PORTC=0X00;                           //disabling the internal pull up for sda,scl
lcd_init();
i2c_init();                                   //initialise i2c communication

while(1)
{
lcd_string(“hi “);
_delay_ms(1000);

ret=i2c_rep_start(mpu);      //send adress to recognize slave device  and if  ret=0 device is  accesible  ret=1 device is not accessible

lcd_showvalue(ret);  //print that value on lcd
_delay_ms(1900);

lcd_clear();    //clear lcd & continue
}
}
[/CODE]

my observations :lcd is printing “hi” but,  ret   value is not printing(neither 1 nor 0) and neither is lcd clearing.

 

“””but if i am commenting  ret=i2c_rep_start(mpu); “”””

 

then only lcd clears &  rexecutes the loop

how do i solve this problem?  is my sensor ok!!

[CODE]
#include<avr/io.h>                 //This is the header for AVR Microcontroller.
#define F_CPU 12000000UL
#include “i2cmaster.h”
#include<util/delay.h>      
#include”lcd118010.h”                  //lcd
#define mpu 0X68                     //address of the i2c device
int main(void)
{
unsigned char ret=0;

DDRC=0X00;
PORTC=0X00;                           //disabling the internal pull up for sda,scl
lcd_init();
i2c_init();                                   //initialise i2c communication

while(1)
{
lcd_string(“hi “);
_delay_ms(1000);

ret=i2c_rep_start(mpu);      //send adress to recognize slave device  and if  ret=0 device is  accesible  ret=1 device is not accessible

lcd_showvalue(ret);  //print that value on lcd
_delay_ms(1900);

lcd_clear();    //clear lcd & continue
}
}
[/CODE]

my observations :lcd is printing “hi” but,  ret   value is not printing(neither 1 nor 0) and neither is lcd clearing.

 

“””but if i am commenting  ret=i2c_rep_start(mpu); “”””

 

then only lcd clears &  rexecutes the loop

how do i solve this problem?  is my sensor ok!!

RSS Recent Posts

  • Can I use this charger in every country? May 14, 2025
  • LED circuit for 1/6 scale diorama May 14, 2025
  • Electronic board faulty?!? May 13, 2025
  • using a RTC in SF basic May 13, 2025
  • An Update On Tarrifs May 13, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise