예제 #1
0
파일: Lcd.c 프로젝트: oherrou/AT90CAN128
/** \brief Initialise le LCD

         Initialise les ports en E/S et les Modes de fonctionnement du LCD
   Exemple \code LCD_init(); \endcode

    */
void LCD_init(void)
{
    DDRA = 0xFF;
    DDRB = 0xFF;
    _delay_ms(25);_delay_ms(15); // Attendre que l'alimentation ait lieu
    LCD_function_set(0x38); // 00110000
    _delay_us(49);
    LCD_function_set(0x0F); // 00001100
    _delay_us(49);
    LCD_function_set(0x01);
    _delay_ms(2);
    LCD_function_set(0x06);
    _delay_ms(2);

    // Indiquer que le LCD est fonctionnel
    cursor_xy(0,0);
    printf("LCD INITIALISE");
    attente(10);
    LCD_effacer(2);     // Effacer la ligne 1
}
예제 #2
0
int main(void) {
  // Select 12MHz crystal oscillator
  LPC_SC ->CLKSRCSEL = 1;

  // Init PLL 0 to 100MHz
  PLL_init(25, 2, 3);
//  PLL_init(12, 1, 18); // 16MHz
  SystemCoreClockUpdate();

  volatile uint32_t i = 1;
  while (i < (1 << 23)) { ++i; }

  LCD_init();
  LCD_function_set(BUS_WIDTH_8, LINE_COUNT_2, FONT_5_8);

  i = 1;
  while (i < (1 << 23)) { ++i; }

  LCD_write('a');
  LCD_write('b');
  LCD_write('c');
  LCD_write('d');

  char c = 'e';
  uint_fast8_t x = 0, y = 0;
  while(1) {
    LCD_write(c);
    ++c;

    ++x;
    if (x > 15) {
      x = 0;
      y ^= 1;
    }

    LCD_move_cursor(x, y);

    i = 1;
    while (i < (1 << 23)) { ++i; }
  }

  return 0;
}