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.

how to read more character on 24C16?

Status
Not open for further replies.

bianchi77

Advanced Member level 4
Joined
Jun 11, 2009
Messages
1,313
Helped
21
Reputation
44
Reaction score
20
Trophy points
1,318
Location
California
Activity points
9,442
Guys,

Do you know how to read more characters on 24C16 ?
I want to read the third character (82 ),

Code:
void save()					//save in EEPROM
{
	start();
	send_byte(0xA0);						//device address
	aknowledge();
	send_byte(0x00);						//word address
	aknowledge();
	send_byte(5);							//send data
	aknowledge();
	send_byte(65);
	aknowledge();
	
[B]	send_byte(82);
	aknowledge();
[/B]	
	stop();	
}			

void Read()
{
	start();
	send_byte(0xA0);
	aknowledge();
	send_byte(0x00);
	aknowledge();
	start();
	send_byte(0xA1);					 //device address
	aknowledge();
	i=read_byte();
	aknowledge();
	j=read_byte();
	aknowledge();
	
	stop();
	if(i==5)
	{
		led=0;
		delay(100);
		led=1;
		delay(100);
		write=i+48;
		lcd_command(0xC6);
		lcd_data(write);	
	}
	else
	 led=1;
	if(j==65)
	{
		lcd_command(0xC7);
		lcd_data(j);
	}
	
	aknowledge();
 

Hello!

The question comes recurrently.
However, if I can figure out what you call send_byte and read_byte, I cannot know
if which direction your acknowledge travels. Just in case, if you send one byte, the
acknowledge should (of course!!!) come from the receiving device. So instead
of acknowledge, it might be better to call this function read_acknowledge();
Anyway, as you use acknowledge after read and after write, one is obviously wrong
in your code. What does the word "acknowledge" mean for you? Not in electronics,
but in plain english. Try with a dictionary. Now the meaning is the same in our case.
It means "I got it!". So if you send something to sombody, you don't tell him "got it!",
he will tell you.
You should wait for acknowledge after a write operation and send an acknowledge
after a read operation.

Dora.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top