I developed this program which is supposed to display all odd numbers between 1-99 on the top line of the LCD with a 0.5 second delay between each iteration.
However, when I run the below code, my output is only '13' then '133' and I am so confused as to why this is.
My code:
#define _XTAL_FREQ 3276800
#include <xc.h>
#include "LCDdrive.h"
void main (void) {
unsigned int oddNumber = 1;
unsigned int nextNumber = 0;
unsigned short i;
LCD_initialise();
LCD_cursor(0,0);
LCD_display_value(oddNumber);
while (1) {
for (i = 0; i < 100; i++) {
nextNumber = oddNumber + 2;
LCD_cursor(1,0);
LCD_display_value(nextNumber);
__delay_ms(500);
LCD_display_value(nextNumber);
__delay_ms(500);
}
}
}