apl-mhd

asmbely 14

Nov 24th, 2020
757
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*****************************************************
  2. This program was produced by the
  3. CodeWizardAVR V2.05.0 Professional
  4. Automatic Program Generator
  5. © Copyright 1998-2010 Pavel Haiduc, HP InfoTech s.r.l.
  6. http://www.hpinfotech.com
  7.  
  8. Project :
  9. Version :
  10. Date    : 11/24/2020
  11. Author  :
  12. Company :
  13. Comments:
  14.  
  15.  
  16. Chip type               : ATmega32
  17. Program type            : Application
  18. AVR Core Clock frequency: 8.000000 MHz
  19. Memory model            : Small
  20. External RAM size       : 0
  21. Data Stack size         : 512
  22. *****************************************************/
  23.  
  24. #include <mega32.h>
  25. #include <delay.h>
  26.  
  27. // Declare your global variables here
  28.  
  29. void main(void)
  30. {
  31.  
  32. DDRA=0xFF;  // Set as output for segment selection
  33. PORTA=0b11110000;    // firs segmet is selected, pin 3 of PRTA set as low
  34.  
  35.  
  36. DDRB=0xFF;  // set as output for data ('digit')
  37. PORTB=0b00000110;  //show digit 1
  38.  
  39. // Port C initialization
  40. // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
  41. // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
  42. PORTC=0x00;
  43. DDRC=0x00;
  44.  
  45. // Port D initialization
  46. // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
  47. // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
  48. PORTD=0x00;
  49. DDRD=0x00;
  50.  
  51. // Timer/Counter 0 initialization
  52. // Clock source: System Clock
  53. // Clock value: Timer 0 Stopped
  54. // Mode: Normal top=0xFF
  55. // OC0 output: Disconnected
  56. TCCR0=0x00;
  57. TCNT0=0x00;
  58. OCR0=0x00;
  59.  
  60. // Timer/Counter 1 initialization
  61. // Clock source: System Clock
  62. // Clock value: Timer1 Stopped
  63. // Mode: Normal top=0xFFFF
  64. // OC1A output: Discon.
  65. // OC1B output: Discon.
  66. // Noise Canceler: Off
  67. // Input Capture on Falling Edge
  68. // Timer1 Overflow Interrupt: Off
  69. // Input Capture Interrupt: Off
  70. // Compare A Match Interrupt: Off
  71. // Compare B Match Interrupt: Off
  72. TCCR1A=0x00;
  73. TCCR1B=0x00;
  74. TCNT1H=0x00;
  75. TCNT1L=0x00;
  76. ICR1H=0x00;
  77. ICR1L=0x00;
  78. OCR1AH=0x00;
  79. OCR1AL=0x00;
  80. OCR1BH=0x00;
  81. OCR1BL=0x00;
  82.  
  83. // Timer/Counter 2 initialization
  84. // Clock source: System Clock
  85. // Clock value: Timer2 Stopped
  86. // Mode: Normal top=0xFF
  87. // OC2 output: Disconnected
  88. ASSR=0x00;
  89. TCCR2=0x00;
  90. TCNT2=0x00;
  91. OCR2=0x00;
  92.  
  93. // External Interrupt(s) initialization
  94. // INT0: Off
  95. // INT1: Off
  96. // INT2: Off
  97. MCUCR=0x00;
  98. MCUCSR=0x00;
  99.  
  100. // Timer(s)/Counter(s) Interrupt(s) initialization
  101. TIMSK=0x00;
  102.  
  103. // USART initialization
  104. // USART disabled
  105. UCSRB=0x00;
  106.  
  107. // Analog Comparator initialization
  108. // Analog Comparator: Off
  109. // Analog Comparator Input Capture by Timer/Counter 1: Off
  110. ACSR=0x80;
  111. SFIOR=0x00;
  112.  
  113. // ADC initialization
  114. // ADC disabled
  115. ADCSRA=0x00;
  116.  
  117. // SPI initialization
  118. // SPI disabled
  119. SPCR=0x00;
  120.  
  121. // TWI initialization
  122. // TWI disabled
  123. TWCR=0x00;
  124.  
  125. while (1)
  126.       {
  127.       PORTA=0b11111101;    // firs segmet is selected, pin 3 of PRTA set as low
  128.       PORTB=0b00000110;  //show digit 1
  129.       delay_ms(50);
  130.      
  131.       PORTA=0b111111110;    // firs segmet is selected, pin 3 of PRTA set as low
  132.       PORTB=0b01100110;  //show digit 1
  133.      
  134.       delay_ms(50);
  135.    
  136.  
  137.  
  138.       }
  139. }
  140.  
RAW Paste Data