Advertisement
apl-mhd

assembly blink

Nov 24th, 2020
668
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.15 KB | None | 0 0
  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/9/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.  
  28. // Declare your global variables here
  29.  
  30. void main(void)
  31. {
  32. // Declare your local variables here
  33.  
  34. // Input/Output Ports initialization
  35. // Port A initialization
  36. // Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out
  37. // State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0
  38.  
  39. DDRA =0b00000011;    //output pin 0,  pin 1
  40.  
  41. // Port B initialization
  42. // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
  43. // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
  44. PORTB=0x00;
  45. DDRB=0x00;
  46.  
  47. // Port C initialization
  48. // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
  49. // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
  50. PORTC=0x00;
  51. DDRC=0x00;
  52.  
  53. // Port D initialization
  54. // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
  55. // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
  56. PORTD=0x00;
  57. DDRD=0x00;
  58.  
  59. // Timer/Counter 0 initialization
  60. // Clock source: System Clock
  61. // Clock value: Timer 0 Stopped
  62. // Mode: Normal top=0xFF
  63. // OC0 output: Disconnected
  64. TCCR0=0x00;
  65. TCNT0=0x00;
  66. OCR0=0x00;
  67.  
  68. // Timer/Counter 1 initialization
  69. // Clock source: System Clock
  70. // Clock value: Timer1 Stopped
  71. // Mode: Normal top=0xFFFF
  72. // OC1A output: Discon.
  73. // OC1B output: Discon.
  74. // Noise Canceler: Off
  75. // Input Capture on Falling Edge
  76. // Timer1 Overflow Interrupt: Off
  77. // Input Capture Interrupt: Off
  78. // Compare A Match Interrupt: Off
  79. // Compare B Match Interrupt: Off
  80. TCCR1A=0x00;
  81. TCCR1B=0x00;
  82. TCNT1H=0x00;
  83. TCNT1L=0x00;
  84. ICR1H=0x00;
  85. ICR1L=0x00;
  86. OCR1AH=0x00;
  87. OCR1AL=0x00;
  88. OCR1BH=0x00;
  89. OCR1BL=0x00;
  90.  
  91. // Timer/Counter 2 initialization
  92. // Clock source: System Clock
  93. // Clock value: Timer2 Stopped
  94. // Mode: Normal top=0xFF
  95. // OC2 output: Disconnected
  96. ASSR=0x00;
  97. TCCR2=0x00;
  98. TCNT2=0x00;
  99. OCR2=0x00;
  100.  
  101. // External Interrupt(s) initialization
  102. // INT0: Off
  103. // INT1: Off
  104. // INT2: Off
  105. MCUCR=0x00;
  106. MCUCSR=0x00;
  107.  
  108. // Timer(s)/Counter(s) Interrupt(s) initialization
  109. TIMSK=0x00;
  110.  
  111. // USART initialization
  112. // USART disabled
  113. UCSRB=0x00;
  114.  
  115. // Analog Comparator initialization
  116. // Analog Comparator: Off
  117. // Analog Comparator Input Capture by Timer/Counter 1: Off
  118. ACSR=0x80;
  119. SFIOR=0x00;
  120.  
  121. // ADC initialization
  122. // ADC disabled
  123. ADCSRA=0x00;
  124.  
  125. // SPI initialization
  126. // SPI disabled
  127. SPCR=0x00;
  128.  
  129. // TWI initialization
  130. // TWI disabled
  131. TWCR=0x00;
  132.  
  133. while (1)
  134.       {
  135.      PORTA=0b00000001;    
  136.      delay_ms(200);
  137.      PORTA=0b00000010;
  138.      delay_ms(200);
  139.       }
  140. }
  141.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement