CodeVisionAVR: Porovnání verzí
Skočit na navigaci
Skočit na vyhledávání
Bez shrnutí editace |
Bez shrnutí editace |
||
Řádek 1: | Řádek 1: | ||
===www=== | ===www=== | ||
Řádek 11: | Řádek 8: | ||
[http://www.hpinfotech.ro/html/cvavr.htm download] | [http://www.hpinfotech.ro/html/cvavr.htm download] | ||
<html> | |||
Version:0.9 | |||
StartHTML:0000000105 | |||
EndHTML:0000006738 | |||
StartFragment:0000001499 | |||
EndFragment:0000006722 | |||
<?xml version="1.0" encoding="iso-8859-1"?> | |||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |||
<html xmlns="http://www.w3.org/1999/xhtml"> | |||
<head> | |||
<title>mikroIDE</title> | |||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | |||
<meta name="generator" content="SynEdit HTML exporter" /> | |||
<style type="text/css"> | |||
<!-- | |||
body { color: #000000; background-color: #FFFFFF; } | |||
body { font-family: Courier New; font-size: 14pt; } | |||
.cpp1-activecomment { color: #0A246A; font-style: italic; text-decoration: underline; } | |||
.cpp1-assembler { color: #FF0000; } | |||
.cpp1-binary { color: #800000; } | |||
.cpp1-comment { color: #008000; font-style: italic; } | |||
.cpp1-float { color: #800000; } | |||
.cpp1-hexadecimal { color: #008000; } | |||
.cpp1-character { color: #808000; } | |||
.cpp1-identifier { color: #000000; } | |||
.cpp1-illegalchar { color: #FF0000; } | |||
.cpp1-imagelink { color: #800080; font-style: italic; text-decoration: underline; } | |||
.cpp1-number { color: #008000; } | |||
.cpp1-octal { color: #0000FF; } | |||
.cpp1-preprocessor { color: #8000FF; font-style: italic; } | |||
.cpp1-reservedword { color: #000000; font-weight: bold; } | |||
.cpp1-space { color: #D4D0C8; } | |||
.cpp1-string { color: #0000FF; } | |||
.cpp1-symbol { color: #000000; } | |||
.cpp1-weblink { color: #0A246A; font-style: italic; text-decoration: underline; } | |||
--> | |||
</style> | |||
</head> | |||
<body> | |||
<!--StartFragment--><pre><code><span class="cpp1-comment">/*Chip type : ATmega32 | |||
Program type : Application | |||
AVR Core Clock frequency: 16,000000 MHz | |||
*****************************************************/ | |||
//#define F_CPU 1600000UL | |||
//#include <mega32.h> | |||
//#include <delay.h> | |||
// Declare your global variables here | |||
</span><span class="cpp1-preprocessor">#define LED1 0b10000000 </span><span class="cpp1-comment">//definování | |||
</span><span class="cpp1-preprocessor">#define LED2 0b00000001 | |||
#define CEKAT 500 </span><span class="cpp1-comment">//hodnota 500 ms | |||
</span><span class="cpp1-reservedword">void</span><span class="cpp1-space"> </span><span class="cpp1-identifier">main(</span><span class="cpp1-reservedword">void</span><span class="cpp1-symbol">) | |||
{ | |||
</span><span class="cpp1-comment">// Declare your local variables here | |||
</span><span class="cpp1-reservedword">unsigned</span><span class="cpp1-space"> </span><span class="cpp1-reservedword">int</span><span class="cpp1-space"> </span><span class="cpp1-identifier">i; | |||
</span><span class="cpp1-comment">// Port A initialization | |||
</span><span class="cpp1-identifier">PORTA=</span><span class="cpp1-binary">0b11111111</span><span class="cpp1-symbol">;</span><span class="cpp1-space"> </span><span class="cpp1-comment">//na budoucích výstupech "1" | |||
</span><span class="cpp1-identifier">DDRA=</span><span class="cpp1-binary">0b11111111</span><span class="cpp1-symbol">;</span><span class="cpp1-space"> </span><span class="cpp1-comment">// PortA jako výstupní | |||
</span><span class="cpp1-reservedword">while</span><span class="cpp1-space"> </span><span class="cpp1-symbol">(</span><span class="cpp1-number">1</span><span class="cpp1-symbol">);</span><span class="cpp1-space"> </span><span class="cpp1-comment">// Nekonečná smyčka | |||
</span><span class="cpp1-space"> </span><span class="cpp1-symbol">{ | |||
</span><span class="cpp1-space"> </span><span class="cpp1-comment">// Place your code here | |||
</span><span class="cpp1-space"> </span><span class="cpp1-reservedword">for</span><span class="cpp1-space"> </span><span class="cpp1-symbol">(i=</span><span class="cpp1-number">0</span><span class="cpp1-symbol">;i<</span><span class="cpp1-number">7</span><span class="cpp1-symbol">;i++); | |||
</span><span class="cpp1-space"> </span><span class="cpp1-symbol">{ | |||
</span><span class="cpp1-space"> </span><span class="cpp1-identifier">PORTA</span><span class="cpp1-space"> </span><span class="cpp1-symbol">=</span><span class="cpp1-space"> </span><span class="cpp1-identifier">PORTA<<</span><span class="cpp1-number">1</span><span class="cpp1-symbol">; | |||
</span><span class="cpp1-space"> </span><span class="cpp1-symbol">} | |||
</span><span class="cpp1-space"> </span><span class="cpp1-identifier">delay_ms(CEKAT);</span><span class="cpp1-space"> </span><span class="cpp1-comment">//zpoždění | |||
</span><span class="cpp1-space"> </span><span class="cpp1-identifier">PORTA=LED1; | |||
</span><span class="cpp1-space"> </span><span class="cpp1-reservedword">for</span><span class="cpp1-space"> </span><span class="cpp1-symbol">(i=</span><span class="cpp1-number">0</span><span class="cpp1-symbol">;i<</span><span class="cpp1-number">7</span><span class="cpp1-symbol">;i++); | |||
</span><span class="cpp1-space"> </span><span class="cpp1-symbol">{ | |||
</span><span class="cpp1-space"> </span><span class="cpp1-identifier">PORTA</span><span class="cpp1-space"> </span><span class="cpp1-symbol">=</span><span class="cpp1-space"> </span><span class="cpp1-identifier">PORTA>></span><span class="cpp1-number">1</span><span class="cpp1-symbol">; | |||
</span><span class="cpp1-space"> </span><span class="cpp1-symbol">} | |||
</span><span class="cpp1-space"> </span><span class="cpp1-identifier">delay_ms(CEKAT); | |||
</span><span class="cpp1-space"> </span><span class="cpp1-identifier">PORTA=LED2;</span><span class="cpp1-space"> </span><span class="cpp1-comment">//přiřazení portuA | |||
</span><span class="cpp1-space"> </span><span class="cpp1-symbol">} | |||
} | |||
</span></code></pre><!--EndFragment--></body> | |||
</html> | |||
</html> |
Verze z 23. 4. 2011, 09:33
www
http://www.hpinfotech.ro/html/cvavr.htm
Getting Started with the CodeVisionAVR C Compiler
Version:0.9 StartHTML:0000000105 EndHTML:0000006738 StartFragment:0000001499 EndFragment:0000006722
/*Chip type : ATmega32
Program type : Application
AVR Core Clock frequency: 16,000000 MHz
*****************************************************/
//#define F_CPU 1600000UL
//#include <mega32.h>
//#include <delay.h>
// Declare your global variables here
#define LED1 0b10000000 //definování
#define LED2 0b00000001
#define CEKAT 500 //hodnota 500 ms
void main(void)
{
// Declare your local variables here
unsigned int i;
// Port A initialization
PORTA=0b11111111; //na budoucích výstupech "1"
DDRA=0b11111111; // PortA jako výstupní
while (1); // Nekonečná smyčka
{
// Place your code here
for (i=0;i<7;i++);
{
PORTA = PORTA<<1;
}
delay_ms(CEKAT); //zpoždění
PORTA=LED1;
for (i=0;i<7;i++);
{
PORTA = PORTA>>1;
}
delay_ms(CEKAT);
PORTA=LED2; //přiřazení portuA
}
}
</html>