free 8051 Microcontroller Projects AVR PIC Microcontroller Projects Tutorials Ebooks Libraries, interfacing tutorials, lcd tutorial, stepper motor, dc motor 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems

 
8051 microcontroller 8051 microcontroller
Forums

Go to page  1 2 [3]
Moderators: Ajay, shyam, zetaf
Author Post
mhai_nguyen
Fri Nov 03 2006, 08:21PM
 User Offline
Registered Member #175
Joined: Mon Oct 30 2006, 10:17PM

Posts: 5
Thanked 0 times in 0 posts
Hi Rickey. Can You help me?
I have about code:
When it make a statement is:
bit I2C_Start(void)
bit I2C_Send_Byte(unsigned char)// function return a value is bit
unsigned char I2C_Get_Byte(bit)
bit I2C_Stop(void)
But in program main() is:

I2C_Start();
I2C_Send_Byte(device_address | I2C_WRITE); //no return? value return
where??? Why?
while (there is data to send)
I2C_Send_Byte(next_byte_of_data);
I2C_Stop();
I am waitting from Rickey or noone can answer my question.



-------------------------------------------------------

06/05/1982
Back to top


Ajay
Fri Nov 03 2006, 11:38PM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 4042
Thanked 753 times in 712 posts
there is a simple answer to that.
the function I2C_Send_Byte(...)
is returning a value.. a bit value but we are not storing it anywhere... the bit returned is the status will be '1' "yes" or '0' "no" which tells the byte has sent successfuly or not..here in your case..
wrote ...

I2C_Start();
I2C_Send_Byte(device_address | I2C_WRITE); //no return? value return
where??? Why?
while (there is data to send)
I2C_Send_Byte(next_byte_of_data);
I2C_Stop();


you can make use of this return value as....

I2C_Start();
if(I2C_Send_Byte(device_address | I2C_WRITE)
{
   while (there is data to send)
   if(!(I2C_Send_Byte(next_byte_of_data));  //I am using NOT logic coz.. i am taking
    //'1' - success '0' - not success
      break;  //stop if the I2C is not sent successfully)
}
   I2C_Stop();
  //exit the program or function

hope you understood.

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top


sridharnarla
Sat Mar 10 2007, 03:53AM
 User Offline
Registered Member #698
Joined: Sat Mar 10 2007, 03:40AM

Posts: 1
Thanked 0 times in 0 post
hi rickey i need the 8051 buk..the link is not workin...cud u pls send tht to my id... sridharnarla@rediffmail.com
Back to top


mandar
Tue Jul 17 2007, 07:34AM
 User Offline
Registered Member #2327
Joined: Tue Jul 17 2007, 04:31AM

Posts: 6
Thanked 0 times in 0 posts
Thankzs
Back to top


Go to page  1 2 [3]  

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System

8051 Microcontroller Projects 8051 AVR tutorials PIC microcontroller, 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems