Witam wszystkich
W ramach nauki jezyka C (przesiadka z bascoma) napisałem taki program.
Niestety zero odzewu ze strony switchy.
Prosze o pomoc i z góry dziekuję
Oto kod:
W ramach nauki jezyka C (przesiadka z bascoma) napisałem taki program.
Niestety zero odzewu ze strony switchy.
Prosze o pomoc i z góry dziekuję
Oto kod:
/*
* main.c
*
* Created on: 2011-02-28
* Author: adi84_84
*/
#include <avr/io.h>
#include <avr/pgmspace.h>
#include "LCD/lcd44780.h"
#include <util/delay.h>
#define KEY1_PIN (1<<PD1)
#define KEY2_PIN (1<<PD2)
#define KEY_UP ! (PINC & KEY1_PIN)
#define KEY_DOWN ! (PINC & KEY2_PIN)
char PROGMEM tab2[] = {"Zmienna:"};
uint8_t Liczba;
int main(void)
{
DDRC &= ~( KEY1_PIN | KEY2_PIN );
PORTC |= KEY1_PIN | KEY2_PIN;
lcd_init();
while(1)
{
lcd_locate(0,2);
lcd_str_P(tab2);
lcd_locate(0,12);
lcd_int(Liczba);
if( KEY_UP )
{
_delay_ms(80);
if( KEY_UP )
{
Liczba++;
_delay_ms(200);
lcd_cls();
}
}
if( KEY_DOWN )
{
_delay_ms(80);
if( KEY_DOWN )
{
Liczba--;
_delay_ms(200);
lcd_cls();
}
}
}
}