0% found this document useful (0 votes)
114 views8 pages

آموزش Avr-gcc Part1

آموزش میکرو

Uploaded by

nanocycle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views8 pages

آموزش Avr-gcc Part1

آموزش میکرو

Uploaded by

nanocycle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

This topic

nanocycle


pm 01:10:32 ,2012 ,08

ECA
www.eca.ir/products

) AVR :( AVR-GCC






ECA

ECA

Search

ECA

AVR_GCC
(14.3%) 3

WinAVR

(4.8%) 1

AVRStudio4

(66.7%) 14

AVRStudio5
(14.3%) 3

21 :
: am 12:51:33 ,2012 ,27

4 3 2 [ 1] :

nanocycle 0 .

mojtaba_led

941 :919 :1267 :

AVR-GCC

: am 02:16:36 ,2011 ,30


AVRSTUDIO VISUALSTUDIO AVRGCC C IAR
! ... !
IAR ! ECA
____________________________________________________________________________
:
:
.1 winavr avrlib
:
gcc.gnu.org/onlinedocs .1
ATMEL.COM .2
avrfreaks.net .3
winavr.scienceprog.com .4
en.wikipedia.org .5
WinAVR-user-manual.html .6
quantumtorque.com .7

: pm 10:57:51 ,2012 ,07 mojtaba_led

http://limenics.ir


...

, ,E_Ravari, ali-electoronic , ,mostafahk, Solsal, aivhl, ARM-mohsen-AVR, parham144 , ,erfan m ,88 ,majid sh, skiboy, Ice Man ,
17 , .


66595095-6:
66080381:



...
09136808048


.
http://adv.eca.ir

NEW ESHOP PRODUCTS


13:03h ,2012-08-08

20 ) FF
5(
LED SKY4044G
1000
LED
SKY4044G 1000
TNI-U


5 1 ) (5V-1A
.RSS box by p3k.org

mojtaba_led

: (avrstudio5(AVRGCC
: 1# pm 10:30:41 ,2011 ,30

-941 :

.1 :

919 :1267 :

avr studio start page :

New Project file --> New Project ctrl+shift+N

work space
c avrstudio auto hide solution explorer codvision IAR
.C solution explorer c :

visual assistx .2
avrsudio5 visual assistx
VASSISTX

( VASSISTX #in
)
) .( >< util avr "" lcd.h io #in ) (
io avr ) avr (a io.h ) ( ) (

#in edit :

shortcut title header #in header


for forr ) ( index int
length ) int ( 32767


: pm 10:32:19 ,2011 ,30 mojtaba_led

-400 :

,sina_80 , ,ma-bah , , ,majid sh, Ice Man, lostlord ,


10 , .

: ) avrstudio5 ( AVRGCC

: 2# pm 11:27:22 ,2011 ,30

.
gcc avrstudio ... .

-189 :

338 :
.

Orcad
http://www.eca.ir/forum2/index.php?topic=64965.0

mojtaba_led

,mojtaba_led, hadipic Ice Man ,


4 , .

: ) avrstudio5 ( AVRGCC
: 3# pm 11:35:17 ,2011 ,30

!
http://www.atmel.com/dyn/products/tools_card.asp?tool_id=17212 :

-941 :

: pm 11:37:06 ,2011 ,30 mojtaba_led

-919 :

1267 :

39 :-15 :

: ) avrstudio5 ( AVRGCC

: 4# am 02:21:11 ,2011 ,31



document
: am 02:57:35 ,2011 ,31

" "

57 :
-

mojtaba_led

mojtaba_led, Ice Man


2 , .

: ) avrstudio5 ( AVRGCC
: 5# pm 01:50:42 ,2011 ,31

VASSIST 10
VASSIST ...PAST CTRL+SHIFT+V

941 :919 :1267 :

SYMBOL #define VA VIEW TOOLS VASSIST AUTO HIDE


VA ...INSERT VA snippet
creat va snippet
vassist vassist . 1 : Quick config . 2 advanced .
....list methods
refactor ...extract method ok
!
.3 :
project ...projet name propertis alt+f7

:
: build
...use exter
memory toolchain

Build Artifact executable static library
hex eep eeprom eeprom map lss
: Build events

: toolchain


: symbol
delay delay F_CPU defined symbols add F_CPU 8000000 :

: optimization

:
: -O 0 .1
: -O1 .2
: -O2 .3
: -O3 .4
: -Os .5

other optimization flag 4


avrgcc gcc http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Optimize-Options.html#Optimize-Options :
: MEMORY
EEPROM SP SRAM
AVRGCC codvision iar sram
: device


: debugging
jatge avr simulator

: Advanced
:
toolchain toolchain
toolchain toolchain toolchain import !

mojtaba_led

941 :919 :1267 :

,sina_80 , , ,mostafahk, saeidhp ,Ice Man, omid_ezraeil, lostlord ,


10 , .

: ) avrstudio5 ( AVRGCC

: 6# pm 10:08:02 ,2011 ,31

( SYMBOL ! F_CPU=8000000

.4 HEX
)( BUILD COMPILE CTRL+F7
HEX , EEP , MAP, LSS BUILD F7
BUILD CTRL+ALT+F7
BUILD BUILD .
:
.1 MEGA16 .
.2 .C .
.3 ALT+F7 :
-3-1 TOOLCHAIN SYMBOL ADD 8 F_CPU=8000000 :
- 3-2 OPTIMIZATION -Os .
-3-3
.4 c :
>#include <avr/io.h
>#include <util/delay.h
)int main(void
{
;)DDRA=(1<<DDA0
)while(1
{
//TODO:: Please write your application code
;)PORTA^=(1<<PA0
;)_delay_ms(1000
}
}
.5 F7 BUILD HEX EEP , LSS , MAP
: avrstudio5
winavr winavr :
.1 io.h avr include io build
.2 delay.h util include solution explorer Dependencies :
#ifndef F_CPU
/* prevent compiler error by supplying a default */
"># warning "F_CPU not defined for <util/delay.h
#define F_CPU 4000000UL
#endif
F_CPU WARNING F_CPU 4 delay 8 delay

.3 main 0 ddra PA0
.4 WHILE 0 PORTA .
.5 _ ()delay_ms 1000
: 1 delay.h _ ()delay_us codvision , iar
: 2 F_CPU SYMBOL TOOLCHAIN delay :
>#include <avr/io.h
#define F_CPU 8000000UL
>#include <util/delay.h
:

: pm 10:16:10 ,2011 ,31 mojtaba_led

mojtaba_led

941 :919 :1267 :

,sina_80 , , , , Ice Man, lostlord ,


8 , .

: ) avrstudio5 ( AVRGCC

: 7# pm 09:54:54 ,2011 ,04

.5 sprintf ) (flaot :
avr studio " " .

13.2634124 float sprintf lcd :
><avr/io.h
><util/delay.h
><avr/pgmspace.h
><stdio.h
""lcd.h

#include
#include
#include
#include
#include

)void main(void
{
;]char buffer[7
;float num=13.2634124

;)lcd_init(LCD_DISP_ON
;)(lcd_clrscr
;)(lcd_home
;)sprintf(buffer,"%6.3f", num
;)lcd_puts(buffer

;)_delay_ms(4000
;)while(1
}
codvision iar float :
alt+f7 .1 .
.2 toolchain
.3 avr/gnu c linker libraries add libprintf_flt.a libm.a :

.4 avr/gnu c linker miscellaneous other linker flags Wl,-u,vfprintf -lprintf_flt- : :

.5 .

,sina_80 , ,Ice Man, lostlord ,


6 , .

: ) avrstudio5 ( AVRGCC

mojtaba_led

: 8# pm 06:50:21 ,2011 ,09

.6 :
avrgcc pgmspace.h PROGMEM const :

941 :-919 :

)pgm_read_byte(address_short
)pgm_read_word(address_short
)pgm_read_dword(address_short
)pgm_read_float(address_short

1267 :

:
" PROGMEM " " " const
:
)" "&( " "

:
:
=const unsigned char nom[] PROGMEM
{
/* 0
1
2
3
4
5
6
7
8
9
*/
0X3F , 0X06 , 0X5B , 0X4F , 0X66 , 0X6D , 0X7D , 0X07 , 0X7F , 0X6F ,
/* 0.
1. 2.
3.
4. 5.
6. 7.
8. 9.
*/
0XBF , 0X86 , 0XDB , 0XCF , 0XE6 , 0XED , 0XFD , 0X87 , 0XFF , 0XEF
;}
:
;)]DATA = pgm_read_byte(&nom[0
:
" " " " _const prog
pgmspace.h :
;void PROGMEM prog_void
;char PROGMEM prog_char
;unsigned char PROGMEM prog_uchar
;int8_t PROGMEM prog_int8_t
;uint8_t PROGMEM prog_uint8_t
;int16_t PROGMEM prog_int16_t
;uint16_t PROGMEM prog_uint16_t
;int32_t PROGMEM prog_int32_t
;uint32_t PROGMEM prog_uint32_t
;int64_t PROGMEM prog_int64_t
:

typedef
typedef
typedef
typedef
typedef
typedef
typedef
typedef
typedef
typedef

][const prog_char nom


{
/* 0
1
2
3
4
5
6
7
8
9
*/
0X3F , 0X06 , 0X5B , 0X4F , 0X66 , 0X6D , 0X7D , 0X07 , 0X7F , 0X6F ,
/* 0.
1. 2.
3.
4. 5.
6. 7.
8. 9.
*/
0XBF , 0X86 , 0XDB , 0XCF , 0XE6 , 0XED , 0XFD , 0X87 , 0XFF , 0XEF
;}

mojtaba_led

,sina_80, E_Ravari, mostafahk, mahdi1696 ,Ice Man, lostlord ,


8 , .

: ) avrstudio5 ( AVRGCC

: 9# am 11:55:09 ,2011 ,23

.7 :

-941 :

lcd :

919 :1267 :

;)"lcd_puts("INTER YOU'R KEYS


sram sram
pgmspace.h
:

>#include <avr/io.h
>#include <avr/pgmspace.h
"#include "lcd.h
;"const char FlashString[] PROGMEM = "INTER YOU'R KEYS
;)void SendSTR_P(const char *FlashSTR
)void main(void
{
.
.
.
;)(lcd_clrscr
//Clear display and set cursor to home position
;)lcd_gotoxy(0, 0
//Set cursor to specified position
;)SendSTR_P(FlashString
//Display character at current cursor position
.
.
.
;)while(1
}
)void SendSTR_P(const char *FlashSTR
{
;uint8_t j
)for (j= 0; pgm_read_byte(&FlashSTR[j]); j++
{
;))]lcd_putc(pgm_read_byte(&FlashSTR[j
}
}
PSTR :

>#include <avr/io.h
>#include <avr/pgmspace.h
"#include "lcd.h
)void main(void
{
.
.
.
;)(lcd_clrscr
//Clear display and set cursor to home position
;)lcd_gotoxy(0, 0
//Set cursor to specified position
;))"SendSTR_P(PSTR("INTER YOU'R KEYS
//Display character at current cursor position
.
.
.
;)while(1
}
)void SendSTR_P(const char *FlashSTR
{
;uint8_t j
)for (j= 0; pgm_read_byte(&FlashSTR[j]); j++
{
;))]lcd_putc(pgm_read_byte(&FlashSTR[j
}
}
: SendSTR_P lcd lcd_puts_p .

,sina_80 ,Ice Man, lostlord ,


5 , .

: ) avrstudio5 ( AVRGCC

: 10# pm 11:53:01 ,2011 ,23


avr stdio 5 .

102 :-27 :

49 :

Ice Man
1 , .

: ) avrstudio5 ( AVRGCC

: 11# pm 06:54:20 ,2011 ,25

plug in
codewizard

-446 :

-519 :

1543 :
XMEGA C

mojtaba_led

Ice Man
1 , .

: ) avrstudio5 ( AVRGCC

: 12# pm 07:40:43 ,2011 ,25

avrgcc

-941 :

919 :1267 :

mojtaba_led

-941 :

Ice Man
1 , .

: ) avrstudio5 ( AVRGCC

: 13# pm 07:05:54 ,2011 ,11

avr studio

919 :1267 :

Ice Man
1 , .

95 :-1510 :

: ) avrstudio5 ( AVRGCC

: 14# pm 07:47:11 ,2011 ,11

. !
AvrStudio . :

: Build events

Visual Studio . backup . . event .


1922 :


sram ...

! . . . word word . . PSTR


) ( . * const char .

avr studio ...

AvrStudio GCC WinAVR . WinAVR.


. . .

,mojtaba_led ,aivhl ,Ice Man ,


5 , .

4 3 2 [ 1] :


) AVR :( AVR-GCC

AVR <= :

.PortaMx 1.5 | PortaMx 2008-2012, PortaMx corp

Powered by SMF 2.0.2 | SMF 20062008, Simple Machines LLC


SMFAds for Free Forums | Persian SUPPORT by SUN Design TEAM
WAP2 RSS XHTML

You might also like