uwezi icon

labb_03_code_02.c

uwezi | PRO | 11/13/19 10:31:35 PM UTC | 0 ⭐ | 610 👁️ | Never ⏰ | []
C |

1.24 KB

|

None

|

0 👍

/

0 👎

/*
ATmega8, 48, 88, 168, 328
 
/Reset PC6|1   28|PC5
 seg_A PD0|2   27|PC4               
 seg_B PD1|3   26|PC3                LCD_RW ( 6)  
 seg_C PD2|4   25|PC2                LCD_E  ( 5)  
 seg_D PD3|5   24|PC1                LCD_RS ( 3)  
 seg_E PD4|6   23|PC0                            
       Vcc|7   22|Gnd                            
       Gnd|8   21|Aref                           
       PB6|9   20|AVcc                           
       PB7|10  19|PB5 SCK   anode_1  LCD_D7 (13)  
 seg_F PD5|11  18|PB4 MISO  anode_2  LCD_D6 (14)  
 seg_G PD6|12  17|PB3 MOSI  anode_3  LCD_D5 (11)  
 dot   PD7|13  16|PB2       anode_4  LCD_D4 (12) 
       PB0|14  15|PB1
*/
 
#define F_CPU 1000000UL  // 1 MHz standard clock
 
#include <avr/io.h>     // defines all macros and symbols
#include <util/delay.h> // defines time delay functions 
 
int main (void)
{
  DDRD   = 0b11111111;    //  all pins of PORT D as output
  DDRB   = 0b00111100;    // some pins of PORT B as output
 
  PORTB &= 0b11000011;    // clear all digit bits
  
  PORTD  = 0b10110000;    // display the pattern of a "3"
  PORTB |= 0b00000100;    // turn on the fourth digit
  
  while (1)               
  {                       // infinite main loop  
  }
}

Comments