muhammad_nasif

Proteus_Offline_undone

Apr 14th, 2021
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.16 KB | None | 0 0
  1. /*
  2.  * CharacterPrint_H_Offline_1.c
  3.  *
  4.  * Created: 4/13/2021 12:22:55 PM
  5.  * Author : ASUS
  6.  */
  7.  
  8. #define F_CPU 4000000UL
  9.  
  10. #include <avr/io.h>
  11. #include <util/delay.h>
  12.  
  13.  
  14. ISR(INT1_vect){
  15.    
  16. }
  17.  
  18.  
  19. int main(void)
  20. {
  21.    
  22.     unsigned char x=1;
  23.     unsigned int i=1;
  24.     DDRA = 0xff;
  25.     DDRC = 0xff;
  26.     GICR =(1<<INT1);
  27.     MCUCR = MCUCR | 0b00001100;
  28.     int val_1 = 1;
  29.     int val_2 = 2;
  30.     int val_3 = 4;
  31.     int val_4 = 8; 
  32.    
  33.    
  34.     PORTA =  0b00000001;
  35.     /* Replace with your application code */
  36.     while (1)
  37.     {
  38.             _delay_ms(22);
  39.             val_1 =  val_1 << i;
  40.             PORTA = val_1;
  41.             if(PORTA == 0b00000000){
  42.                 val_1 = 1;
  43.                 PORTA = val_1;
  44.             }
  45.             PORTC = ~(0b01111100);
  46.             _delay_ms(22);
  47.             val_2 =  val_2 << i;
  48.             PORTA = val_2;
  49.             if(PORTA == 0b00000000){
  50.                 val_2 = 1;
  51.                 PORTA = val_2;
  52.             }
  53.             PORTC = ~(0b00010000);
  54.            
  55.             _delay_ms(22);
  56.             val_3 =  val_3 << i;
  57.             PORTA = val_3;
  58.             if(PORTA == 0b00000000){
  59.                 val_3 = 1;
  60.                 PORTA = val_3;
  61.             }
  62.             PORTC = ~(0b00010000);
  63.  
  64.             _delay_ms(22);
  65.             val_4 =  val_4 << i;
  66.             PORTA = val_4;
  67.             if(PORTA == 0b00000000){
  68.                 val_4 = 1;
  69.                 PORTA = val_4;
  70.             }
  71.             PORTC = ~(0b01111100);
  72.  
  73.        
  74.            
  75.     }
  76. }
  77.  
  78.  
Advertisement
Add Comment
Please, Sign In to add comment