All pastes #833031 Raw Edit

Anonymous

public c v1 · immutable
#833031 ·published 2007-12-26 22:01 UTC
rendered paste body
/* # vim: ai ts=4 sts=4 et sw=4 */ #include <avr/io.h>#include <inttypes.h>#include <avr/sleep.h>#include <util/delay.h>#include <avr/interrupt.h>#include <avr/pgmspace.h>#include "main.h" #include "lcd_functions.h"#include "lcd_driver.h"#define pLCDREG_test (*(char *)(0xEC))void delay_ms(unsigned int ms)    /* Delay for a min of <ms> */{    while (ms) {        _delay_ms(0.96);         ms--;    }}void lightshow_1(void){    // pinSet1 on    PGM_P notice;        for (int i = 5; i > 1; i--)    {        // Turn Pin 7, 5, 3 on.         notice = PSTR("3 5 7");        LCD_puts_f(notice,1);         PORTB |= (_BV(PB3))|(_BV(PB5))|(_BV(PB7));         // delay_ms(100);                // Turn 7,5,3 off.        notice = PSTR("N 3 5 7");        LCD_puts_f(notice, 1);         PORTB &= ~( _BV(PB3) | _BV(PB5) | _BV(PB7) );         // Turn 4,6 on        notice = PSTR("4 6");        LCD_puts_f(notice, 1);	    PORTB |= (_BV(PB4)|_BV(PB6));         // delay_ms(100);                // Pins 4,6 off        notice = PSTR("N 4 6");         LCD_puts_f(notice, 1);         PORTB &= ~( _BV(PB6) | _BV(PB4) );     }    // Clear pins    PORTB = 0x00; }int main(void){     /****************\     *   INITIALIZE      \ ***************/    // LCD     LCD_Init();     // __enable_interrupt():     sei();     // Enabled PORTB as output     DDRB = 1;    // Setup strings for display on LCD.    PGM_P helloWorld;     helloWorld = PSTR("HELLO WORLD");         // Write helloWorld to LCD:     LCD_puts_f(helloWorld, 1);         // Call a light show.     lightshow_1();         // Go to sleep until reset.    sleep_mode();     return(0);}