This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

I2C program runs in an infinite loop even without a loop

Evaluation Board: MCB2300
Microcontroller: LPC2388
IDE: uVision V4.03q

My Setup:
============

1. I interfaced a 2-Wire Serial EEPROM (2K) to LPC2388.
2. I am using I2C0 on this board.
3. Therefore, using Pins 0.27 for SDA and 0.28 for SCL and external pull up resistors have been connected.
4. A 2-line, 5X8 LCD is also interfaced to this board.

My Objective:
================

4. This is my first program on I2C and I am writing a very basic program.
5. I want to WRITE a character in EEPROM at a memory location.
6. Then, I want to READ that character and display it on the LCD.

Where I am:
================

7. I am able to WRITE to and READ from the EEPROM and display it on the LCD.

The Issue:
=================

8. The problem is, the statements in the main() run continuously in an infinite loop. I do not have a loop at all in the main().

Thanks,
RB

Parents
  • 1) main() should always have at least one infinite loop - or have you maybe installed an operating system on your embedded device, that gives you a command line prompt or maybe even a full graphical desktop when your program ends?

    2) The behaviour when your application ends is undefined for embedded systems. Maybe your application is restarted again and again and again?

    what happens if you have:

    for (;;) ;
    


    last in main()?

    Or possibly write:

    while (1) ;
    

Reply
  • 1) main() should always have at least one infinite loop - or have you maybe installed an operating system on your embedded device, that gives you a command line prompt or maybe even a full graphical desktop when your program ends?

    2) The behaviour when your application ends is undefined for embedded systems. Maybe your application is restarted again and again and again?

    what happens if you have:

    for (;;) ;
    


    last in main()?

    Or possibly write:

    while (1) ;
    

Children