SHARE
TWEET

ee120b_lab10part2(actual)

a guest May 23rd, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <avr/io.h>
  2. #include "io.c"
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <timer.h>
  6.  
  7.  
  8. int main(void)
  9. {
  10.     DDRD = 0xFF; PORTD = 0x00; // LCD data lines
  11.     DDRA = 0xFF; PORTA = 0x00; // LCD control lines
  12.    
  13.     // Initializes the LCD display
  14.     LCD_init();
  15.     unsigned char msg[]= "CS120B is Legend... wait for it DARY!";
  16.     unsigned char* string = msg;
  17.     // Starting at position 1 on the LCD screen, writes Hello World
  18.     LCD_DisplayString(1, string);
  19.     TimerSet(1000);
  20.     TimerOn();
  21.  
  22.     while(1) {
  23.         for(unsigned char i = 0; i < 6; i++){
  24.             string = msg + i;
  25.             LCD_DisplayString(1, string);
  26.             while (!TimerFlag); // Wait 1 sec
  27.             TimerFlag = 0;
  28.         }
  29.        
  30.        
  31.     }
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top