Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Programming LCD in MikroC

Status
Not open for further replies.

didij

Newbie level 2
Joined
May 20, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,301
Hello;

I send data via the I2C bus and I don't know how to read them on the LCD! can you help me please?


NB: I program in mikroC !

Thank you in advance
 

Could you upload your code and a schematic of your project?

Otherwise we're shooting in the dark.
 

my plan is to send via the I2C bus data captured by an ultrasonic range finder to a development board fitted with a PIC 18F and an LCD and other périphiriques. j'implimente when my C code to read the value captured by the rangefinder nothing appears on the LCD. Enclosed you will find the source code used.

for any further information feel free to ask.



thank you in advance

Source code :

{


unsigned reslt;
char *text;

ADCON1 |= 0x0F;
CMCON |=7;
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off

//Get the range
while(1)
{
I2C1_Init(40000);
I2C1_Start(void); // send start sequence
I2C1_Wr(0xE0); // SRF02 I2C address with R/W bit clear
I2C1_Wr(0x00); // SRF02 command register address
I2C1_Wr(0x51); // command to start ranging in cm
I2C1_Stop(); // send stop sequence

delay_ms(70); //delay for 70ms.

I2C1_Start(void); // send start sequence
I2C1_Wr(0xE0); // SRF02 I2C address with W bit clear
I2C1_Wr(0x02); // send internal adress of high byte.
I2C1_Wr(0x03); // send internal adress of low byte.
I2C1_Repeated_Start(void); // send a restart sequence
I2C1_Wr(0xE1); // SRF02 I2C address with R bit set
PORTB= I2C1_Rd(0u); // Read the data (NO acknowledge)
I2C1_Stop(); // send stop sequence
inttostr(reslt,text);


Lcd_Out(1,1,"la distance est : "); // Write text in first row
Lcd_Out(2,2,text); // Write text in second row
Lcd_Out(2,12,"cm");
Delay_ms(2000);
}

}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top