3. // OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer2 Stopped
// Mode: Normal top=0xFF
// OC2A output: Disconnected
// OC2B output: Disconnected
ASSR=0x00;
TCCR2A=0x00;
TCCR2B=0x00;
TCNT2=0x00;
OCR2A=0x00;
OCR2B=0x00;
// External Interrupt(s) initialization
// INT0: On
// INT0 Mode: Any change
// INT1: Off
// INT2: Off
// Interrupt on any change on pins PCINT0-7: Off
// Interrupt on any change on pins PCINT8-15: Off
// Interrupt on any change on pins PCINT16-23: Off
// Interrupt on any change on pins PCINT24-31: Off
EICRA=0x01;
EIMSK=0x01;
EIFR=0x01;
PCICR=0x00;
// Timer/Counter 0 Interrupt(s) initialization
TIMSK0=0x00;
// Timer/Counter 1 Interrupt(s) initialization
TIMSK1=0x00;
// Timer/Counter 2 Interrupt(s) initialization
TIMSK2=0x00;
// USART0 initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART0 Receiver: On
// USART0 Transmitter: On
// USART0 Mode: Asynchronous
// USART0 Baud Rate: 9600
UCSR0A=0x00;
UCSR0B=0x18;
4. UCSR0C=0x06;
UBRR0H=0x00;
UBRR0L=0x33;
// USART1 initialization
// USART1 disabled
UCSR1B=0x00;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
ADCSRB=0x00;
DIDR1=0x00;
// ADC initialization
// ADC disabled
ADCSRA=0x00;
// SPI initialization
// SPI disabled
SPCR=0x00;
// TWI initialization
// TWI disabled
TWCR=0x00;
// Alphanumeric LCD initialization
// Connections specified in the
// Project|Configure|C Compiler|Libraries|Alphanumeric LCD menu:
// RS - PORTA Bit 0
// RD - PORTA Bit 1
// EN - PORTA Bit 2
// D4 - PORTA Bit 4
// D5 - PORTA Bit 5
// D6 - PORTA Bit 6
// D7 - PORTA Bit 7
// Characters/line: 8
lcd_init(8);
// Global enable interrupts
#asm("sei")
lcd_gotoxy(0,0);
4
x menor a 9 y y menor a
lcd_puts("SISTEMA");
lcd_gotoxy(0,1);
4
// posicion en la lcd del dato
// posicion en la lcd del dato
x menor a 9 y y menor a
// posicion en la lcd del dato
x menor a 9 y y menor a
lcd_puts("OFF");
while (1)
{
/*
lcd_gotoxy(0,0);
4
lcd_putchar('A');
delay_ms(200);
lcd_clear();
delay_ms(200);
lcd_gotoxy(0,3);
4
lcd_puts("HOLA");
// para enviar caracteres
// posicion en la lcd del dato
x menor a 9 y y menor a
5. lcd_gotoxy(0,1);
4
// posicion en la lcd del dato
x menor a 9 y y menor a
lcd_putchar('a');
*/
if(i==1)
{
numero=getchar();
// scanf("%c", &dato);
switch (numero) {
case '1':
delay_ms(200);
lcd_gotoxy(0,3);
4
// posicion en la lcd del dato
x menor a 9 y y menor a
lcd_puts("JUEGO 1");
for(a=0;a<10;a++)
{
PORTB=0XFF;
delay_ms(200);
PORTB=0X00;
delay_ms(200);
}
//puerto A en alto
//libreria de retardo
//puerto A en bajo
//libreria de retardo
break;
4
case '2':
delay_ms(200);
lcd_gotoxy(0,3);
// posicion en la lcd del dato
lcd_puts("JUEGO 2");
for(c=0;c<5;c++)
{
PORTB=0x01;
delay_ms(200);
PORTB=0x02;
delay_ms(200);
PORTB=0x04;
delay_ms(200);
PORTB=0x08;
delay_ms(200);
PORTB=0x10;
delay_ms(200);
PORTB=0x20;
delay_ms(200);
PORTB=0x40;
delay_ms(200);
PORTB=0x80;
delay_ms(200);
}
break;
default:
};
//libreria de retardo
//libreria de retardo
//libreria de retardo
//libreria de retardo
//libreria de retardo
//libreria de retardo
//libreria de retardo
//libreria de retardo
x menor a 9 y y menor a