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

LPC2478 - lcd_putString Issue

Hello,

There's an expansion board attached to the LPC2478 which contains a motor and a lightgate which can count the revolutions of the motor, connected to a counter (timer1).

My program is written to enable the user to select various motor speeds and receive feedback as to what the actual motor speed is, which is printed on the display.

The display contains various lines of text explaining the program and various speeds the user can select.

Essentially the problem I have is that for every line of 'lcd_putString' that is used, it multiplies the reading of the motor revolutions. There's 12 lines of lcd_putString which are used in the initialisation code of the program to print this text to the display and then never called upon again. If I comment these lines of text out, so that nothing other than the motor speed reading is display, the motor speed is displayed correctly on the display (tested using an oscilloscope).

To put it simply, if there is text printed to the display using lcd_putString, the counter reading is multiplied.

A lot of hours have gone into trying to sort this issue so any help is hugely appreciated.

Parents
  • This can't work unless the "toggle" variable is static or global - it needs to retain the state between each invocation of the function.

    But you can also check the physical pin state directly when toggling.

    void toggle_trace_capture_pin(void) //Pin 11 for ISR Monitoring
        static unsigned int toggle;
    
        if (toggle == 0) {
            FIO0SET |= (1<<11);
            toggle = 1;
        } else {
            FIO0CLR |= (1<<11);
            toggle = 0;
        }
    }
    

    So have you checked how long time your print function takes with full text emitted?

Reply
  • This can't work unless the "toggle" variable is static or global - it needs to retain the state between each invocation of the function.

    But you can also check the physical pin state directly when toggling.

    void toggle_trace_capture_pin(void) //Pin 11 for ISR Monitoring
        static unsigned int toggle;
    
        if (toggle == 0) {
            FIO0SET |= (1<<11);
            toggle = 1;
        } else {
            FIO0CLR |= (1<<11);
            toggle = 0;
        }
    }
    

    So have you checked how long time your print function takes with full text emitted?

Children