Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * main.c
- *
- * Created on: 30-03-2013
- * 23:09:06
- * Author: miszczo
- * 16MHz
- */
- #include <avr/io.h>
- #include <util/delay.h>
- #include "LCD/lcd44780.h"
- int main(void)
- {
- DDRB |= (1<<PB3); // OC0A jako wyjscie
- TCCR0A |= (1<<COM0A1) | (1<<COM0A1); // set on compare/clear at bottom
- TCCR0A |= (1<<WGM00) | (1<<WGM01); // fast pwm TOP 0xff
- TCCR0B |= (1<<CS00); // prescaler 1
- DDRD &= ~(1<<PD0) | ~(1<<PD1); //PD0 jako wejscie
- PORTD |= (1<<PD0) | (1<<PD1);
- OCR0A = 127;
- lcd_init();
- lcd_int(OCR0A);
- while(1)
- {
- if(((PIND & (1<<PD0))==0) & (OCR0A<255))
- {
- lcd_cls();
- OCR0A++;
- lcd_int(OCR0A);
- _delay_ms(10);
- }
- if(((PIND & (1<<PD1))==0)&(OCR0A>0))
- {
- lcd_cls();
- OCR0A--;
- lcd_int(OCR0A);
- _delay_ms(10);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement