Sunteți pe pagina 1din 1

Escribe el siguiente código en un fichero llamado display7.

c:

1
2 # i n c l u d e < a v r / i o . h> / / I /O
3 # i n c l u d e < a v r / pgmspace . h> / / Acceso Memoria F l a s h
4
5 c o n s t char t a b l a [ ] PROGMEM = {0 x3F , 0 x06 , 0 x5B } ; / / L e t r a s
6
7 i n t main ( ) {
8
9 u n s i g n e d char dato ;
10 DDRD = 0 x00 ; / / P u e r t o D como e n t r a d a
11 PORTD = 0xFF ; / / R e s i s t o r e s P u l l Up
12 DDRB = 0xFF ; / / P u e r t o B como s a l i d a
13
14 while ( 1 ) {
15
16 d a t o = PIND & 0 x0F ; / / Lee p u e r t o D
17 PORTB = p g m _ r e a d _ b y t e (& t a b l a [ d a t o ] ) ; / / Acceso a F l a s h
18 }
19 }

S-ar putea să vă placă și