Stap 6: Codefragment
Dit is een fragment van mijn code...Volledige code vindt u op de projectpagina in mijn blog. http://blog.shparvez.net/Rotating-display/
/*<br> * Roatting Display AVR Programming * * Created by Shahadat Hussain Parvez * Author: SHParvez001 * */ <avr io.h=""><util delay.h="">void print(unsigned char disp) { switch (disp) { case ' ': { portd=0b00000000; delay(); portd=0b00000000; delay(); portd=0b00000000; delay(); portd=0b00000000; delay(); portd=0b00000000; delay(); portd=0b00000000; delay(); break; } case 'A': { portd=0b01111110; delay(); portd=0b10010000; delay(); portd=0b10010000; delay(); portd=0b10010000; delay(); portd=0b10010000; delay(); portd=0b01111110; delay(); break; } case 'B': { portd=0b11111110; delay(); portd=0b10010010; delay(); portd=0b10010010; delay(); portd=0b01011010; delay(); portd=0b00100100; delay(); portd=0b00000000; delay(); break; } } } int main(void) { ddrd = 0b11111111; while(1) { print('E'); print('E'); print('E'); print(' '); print('S'); print('U'); print('S'); print('T'); print(' '); print('R'); print('O'); print('C'); print('K'); print('S'); print(' '); print('!'); print('!'); print('!'); print(' '); } }