Top Banner
ΤΕΧΝΟΛΟΓΙΚΟ ΕΚΠΑΙΔΕΥΤΙΚΟ ΙΔΡΥΜΑ ΚΡΗΤΗΣ ΣΧΟΛΗ ΤΕΧΝΟΛΟΓΙΚΩΝ ΕΦΑΡΜΟΓΩΝ ΤΜΗΜΑ ΗΛΕΚΤΡΟΛΟΓΙΑΣ Μ Μ Ι Ι Κ Κ Ρ Ρ Ο Ο Ε Ε Λ Λ Ε Ε Γ Γ Κ Κ Τ Τ Ε Ε Σ Σ Ε Ε Ρ Ρ Γ Γ Α Α Σ Σ Τ Τ Η Η Ρ Ρ Ι Ι Α Α Κ Κ Ε Ε Σ Σ Α Α Σ Σ Κ Κ Η Η Σ Σ Ε Ε Ι Ι Σ Σ Μ. Σφακιωτάκης Ι. Μηναδάκης ΗΡΑΚΛΕΙΟ ΚΡΗΤΗΣ ΙΑΝΟΥΑΡΙΟΣ 2011
69

Micro Askiseis Ear11

Oct 23, 2015

Download

Documents

MORFEAKIS

mikroelegktes ergastirio
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • . .

    2011

  • 1.

    2. 7-SEGMENT DISPLAY

    3.

    4. INTERRUPTS

    5. O TIMER0

    6. O TIMER1

    7.

    8.

    9. /D

    10.

  • M - 1 1

    A 1

    /

    :

    _ _

    : 1. VR

    (STK200/CodeVision C). 2. -

    C. _ _

    ATmega16 32 -, 4 (ports) A,B,C D. 8-bit, bit / . 3 : 1. M DDRx ( x=A,B,C,D) x

    ( bit 0) ( bit 1). ,

    DDRA = 0b11000000; 0-5 6-7 .

    2. PINx x, . ,

    k = PINB; k ( unsigned char, . 8 bits)

    bits ( 1 0) 8 .

    3. H bits PORTx ( DDRx). , , PORTx (0 [0 Volt] 1 [5 Volt]) . , / (pull-up resistor), 1/0 bit . ,

    DDRC = 0xf0; PORTC = 0x0f; 0-3 C pull up,

    4-7 0 Volt. H Codevision C bits 3 . / , bitwise (""). :

    DDRC.2 = 1; O 2 C PORTC.2 = 0; 2 C 0 Volt if (PINB.3 == 0).. 3

    , ( 1 0). , .. ( ) C 1, PORTC :

  • M - 1 2

    PORTC = 0b11111111; { } , PORTC = 255; { } , PORTC = 0xff; { }

    - / STK200 8 (SW0-SW7) 8 (LED0-LED7). LED LEDn 0 Volt. , SWn 5 Volt . , (SW0 - SW7) D , (LED0 LED7) B.

    LED PORTB.2 = 0; A LED2 PORTB.4 = 1; LED4

    if (PIND.3 == 0) SW3 if (PIND.2 == 1) SW2

    _ _

    CODEVISION C , AVR E:

    1. CodeVisionAVR ( desktop ).

    2. project ( File -> New..).

    3. , project .

    4. (CodeWizard) Yes.

    5. :

    Chip

    (i) Chip ATmega16

    (ii) Clock 8,0 z

    (iii) Program Type Application

    - , , STK200

  • M - 1 3

    6. File Generate, Save and Exit.

    . directory . , 1 :

    D:\MIKRO_ERG\HLEK1\ASK1\

    directory, 3 . Ask1 .

    7. , CodeVision Ask1.c CodeWizard. , .

    , . , , ( Ctrl-A) delete.

    , ( )

    #include void main(void) {

    #include ,

    DDRB = 0b11111111; (0..7) B PORTB = 0b11111111;

    1, LED

    DDRD = 0b00000000; (0..7) D PORTD = 0b11111111;

    pull-up D

    while(1) {

    ( TRUE)

    PORTB = 0xF8; PORTB 3 LED (LED0-2) 5

    } while(1) ! } ( )

  • M - 1 4

    DOWNLOAD

    1. 8 LED STK200 , , B . LED pull-up (330) (Vcc).

    2. ( LED ).

    3. Project CodeVisionAVR Configure.

    4. After Make Program The Chip OK.

    !

    5. Project CodeVisionAVR Make. , compile . , Program. , Make.

    6. Program FLASH .

  • M - 1 5

    _STK 200 _

    PORT B

    PORT A

    PORT C

    PORT D

    LED0-LED7LED ISPLED

    / FF

    ISP

    SW0-SW7

    jumpers STK200

    Bit 0 Bit 1

    Bit 7Bit 6VccGnd

    PORTx (x=A, B, C, D) headers

    STK200.

  • M - 1 6

    _STK 200 _

    Atmel ( ).

    6 ( pin 2X5 IDC10) pin .

    8 . 8 LED . 2 LED, . RS232 ( / ). Brownout ( ). Flash. EEPROM. 8 MHz ( 16 MHz). ISP (In System Programming) USB ( programmer ) /.

  • M - 1 7

    1.1 LEDs

    , PORTB, LED. LED0 STK200.

    ( ) PORTB : o LED{0 1 2 3 4} :

    o LED{0 2 4 6} :

    , directory , Save as , Ask11.c . , , , sk1.c, . , . , .

    1.2

    8 LEDs (LED0-LED7) PORT B ( ) a b.

    : 255 8 bit. LED 1 0 . #include // unsigned char a=25; // (1 byte: 0-255) unsigned char b=3; unsigned char sum;

    void main(void) { DDRB=0xff; // Port B sum=a+b; //

    while(1) // { PORTB= ~sum; // Port B } // ~ sum } // LED 0 ,

    LEDs. a b LED. C:

    A++; // A 1 ( =+1) A--; // 1 ( =-1) A+=2; // 2 ( =+2) A-=3; // 3 ( =-3) A*=2; // ( =*2) A/=5; // 5 ( =/5)

    a=210 b=80 . , .

  • M - 1 8

    1.3

    D 8 () SW0-SW7 STK200. D PIND LED PORTB.

    SW0-SW7 0 , . AVR pull-up (330) PORTD=0xFF;.

    : pull-down , , 8 10 GND.

    #include // unsigned char a; //

    void main(void) { DDRB=0xff; // B DDRD=0x00; // D PORTD=0xff; // : pull-up D

    while(1) // { a=PIND; // D a PORTB=a; // a B } } , while :

    PORTB = PIND; // Port D // PORT B

    LED .

  • M - 1 9

    1.4 if

    SW1 LED4, SW2 LED6, SW3 LED.

    #include // void main(void) { DDRB = 0xFF; // Port B PORTB = 0xFF; // , LED DDRD = 0x00; // Port D PORTD = 0xFF; // pull-up resistors Port D while(1) { if(PIND.1==0) // SW1 PORTB.4 = 0; // LED4 ( ) if(!PIND.2) // SW2 PORTB.6 = 0; // LED6 ( ) if(!PIND.3) // SW3 PORTB = 0xFF; // LED } } ( ) if (PIND.1==0) :

    if(PIND==0xFD) ( ) if(PIND.1==0) ():

    if(!(PIND&=0x02)) ( ) PORTB.4 = 0; PORTB = 0xEF;

    LED SW0 SW7 SW3 SW4.

    1.6

    AVR Studio, ( )

  • M - 1 10

    AVRStudio AVRStudio , , PC AVR. , compiler. ( /). ( 3 AVRStudio).

    Codevision, compile , AVRStudio

    AVRStudio, :

    AVR Studio,

    . ( , Alt+5 ).

    (, , /, .) / ( ). , B D :

    Debug , , . Trace into, F11 ( ). , I/O.

    STK200, ( 1) "Input Pins" PORTD . STK200, , , .

  • - 2 1

    A 2

    :

    _ _

    (interrupts), interrupts. seven segment display , (delay).

    _ _ , ,

    7 (7 segment display) 0-9. 7 (LED) ( a, b, c, d, e, f g ), LED ( . dp), . . , 7 , display 8, , , a,b,c,d g, 3.

    a b

    c

    de

    fg CA

    CA

    ab

    c

    de

    fg

    .

    To display (S52-11HA) (common anode), ( ). , display +VCC, segments 0 .

    , display , flat idc-10, C, .

    LLLLLLL

    CA

    +

    ab

    cd

    e

    fg

    5 V

    330R

    5 V

    LLLLLLL

    L 557

    CA

    +

    ab

    cd

    e

    fg

    Gated

    BC557

    PNP

    5 V

    L(0V)

    1,5 K

    a b g

    330

    CA

    L L L

  • - 2 2

    2.1 7 (seven segment display)

    STK200, display (0-7). display .

    D , SW0-SW7.

    #include

    void main(void) { DDRC =0xFF; PORTC=0xFF; //, display DDRD =0x00; //Port D PORTD=0xFF;

    while(1) { switch(PIND) // { case 0xFE:PORTC=~0x3F;break; // SW0 display 0 case 0xFD:PORTC=~0x06;break; // SW1 display 1 case 0xFB:PORTC=~0x5B;break; // SW2 display 2 case 0xF7:PORTC=~0x4F;break; // SW3 display 3 case 0xEF:PORTC=~0x66;break; // SW4 display 4 case 0xDF:PORTC=~0x6D;break; // SW5 display 5 case 0xBF:PORTC=~0x7D;break; // SW6 display 6 case 0x7F:PORTC=~0x07;break; // SW7 display 7 default: PORTC=~0x00;break; // , // display } } } ( PORTC) display ;

    2 .

    default .

    , SW3 SW5 display .

  • - 2 3

    2.2

    display , C. display .

    #include

    unsigned char button[] ={ 0xFE, 0xFD, 0xFB, 0xF7, 0xEF, 0xDF, 0xBF, 0x7F}; //buttons unsigned char display[]={~0x3F, ~0x06, ~0x5B, ~0x4F, ~0x66, ~0x6D, ~0x7D, ~0x07}; //display unsigned char i; void main(void) { DDRC =0xFF; PORTC=0xFF; DDRD =0x00; PORTD=0xFF;

    while(1) { for (i=0; i

  • - 2 4

    2.4

    ( 0 8). countBits 8-bit bits 1.

    !

    #include unsigned char display[]={~0x3F, ~0x06, ~0x5B, ~0x4F, ~0x66, ~0x6D, ~0x7D, ~0x07, ~0x7F}; //9 unsigned char countBits(unsigned char val) { unsigned char j, n=0, mati=0x01; for (j=0; j

  • - 3 1

    A 3

    :

    _ _

    . / (switch bounce) software. 4 x 4 (4 x 4 key matrix). _ _ /

    , , , 8 STK200 , (button bounce) ( ). , , () 60ms, . debouncing , hardware software.

    hardware debouncing RC , . , Max681x Maxim , debounce . MC14490 On Semiconductors.

    , software debouncing , , , . .

  • - 3 2

    4 x 4 (

    8 ), , . , - , , (key matrix). , hardware , , :

    (row - 1)*4 + (col - 1) = 13

    0 1 2 3

    4 5 6 7

    8 9 10 11

    12 13 14 15

    c1 c2 c3 c4

    r1

    r2

    r3

    r4

    c1 c2 c3 c4r1

    r2

    r3

    r4

    0 1 2 3

    4 5 6 7

    8 9 10 11

    12 13 14 15

    PA.1

    PA.0

    PA.3

    PA.2

    PA.6PA.7PA.4PA.5

    , PA.0 PA.4, PA.4 PA.7. , , #7 ( 2 , 4 ), PA.0 PA.6:

    0 1 2 3

    4 5 6 7

    8 9 10 11

    12 13 14 15

    c1 c2 c3 c4

    r1

    r2

    r3

    r4

    c1 c2 c3 c4r1

    r2

    r3

    r4

    0 1 2 3

    4 5 6 7

    8 9 10 11

    12 13 14 15

    PA.1

    PA.0

    PA.3

    PA.2

    PA.6PA.7PA.4PA.5

    , , : , 0, , pull-up. , (PA.4 PA.7) 1, pull-up. ( ), 0 bit PINA ( , PA.6). , , , , , 0 PA.0. bits ( , 0b10111110 #7).

  • - 3 3

    3.1 software debounce

    To SW7 STK200. ( ) LED STK200.

    , . , , , "" . software debounce - (delays) .

    #include #include

    unsigned char count=0;

    void main(void) { DDRB = 0xFF; PORTB = 0xFF;

    DDRD = 0x00; PORTD = 0xFF;

    while(1) { if (PIND.7 == 0) // SW7 { delay_ms(30); // 30ms, debounce while(PIND.7 == 0); // SW7 delay_ms(30); // 30ms, debounce

    count++; // PORTB = ~count; // LEDs STK200 } } } debounce .

    ( );

  • - 3 4

    3.2 debounce

    rid(n), bit n PIND , debounce 1. , 0. .

    #include #include

    unsigned char k=0;

    unsigned char rid(unsigned char n) // read_isolate_debounce { unsigned char mask; mask = (1

  • - 3 5

    3.3 seven segment display 4 x 4

    To 4 x 4 PORT A, idc-10 , .

    PORT C 7-segment display, . ( hex) PORTC - 16 display: ( , )

    0 1 2 3 4 5 6 7 8 9 A b C d E F

    ~3F ~06 ~5B ~4F ~66 ~6D ~7D ~07 ~7F ~77 ~7C ~39 ~79

    , display.

    #include

    void main(void) { unsigned char a,b,c,j;

    DDRB =0xff; PORTB=0xff;

    DDRC =0xff; PORTC=0xff;

    while (1) { DDRA =0x0f; // PORTA=0xf0; // LOW HIGH ( pull-up) for(j=0; j

  • - 3 6

    3.4 / 4 x 4

    display , (1-4) (1-4) , ( 0-15, ). #include unsigned char a,b,j,i,d,row=0,col=0; char display[]= {0x06, 0x5b, 0x4f, 0x77, 0x66, 0x6d, 0x7d, 0x7c, 0x07, 0x7f, 0x6f, 0x39, 0x40, 0x3f, 0x36, 0x5e};

    void main(void) { d=0; DDRB=0xff; DDRC=0xff;

    while (1) { DDRA =0x0f; PORTA=0xf0; for(j=0; j

  • - 4 1

    A 4

    INTERRUPTS

    :

    _ _

    AVR CodeVision C compiler. 0-1 ATmega16. _ _

    AVR O (interrupts)

    . O , . M interrupt ( ), CPU (interrupt service routine - ISR), interrupt. (, interrupts, A/D , .) ISR. M ISR, interrupt.

    , . , ( ) . H interrupts : 1.

    bits .

    2. , .

    Status Register SREG

    Bit 7 6 5 4 3 2 1 0 I T H S V N Z C

    Read/Write R/W R/W R/W R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0

    SREG

    O SREG (Status register) ( 1) ( 0) , bit 7. M (SEI CLI) Global Interrupt Enable bit ( 1 0 ). A Assembly, #asm. Codevision:

    #asm("sei") #asm("cli")

    , bit / ( bits SREG):

    SREG |= 0x80; SREG &= 0x7F;

  • - 4 2

    INTERRUPTS O ATmega16 (INT0, INT1 INT2)

    16, 17, 3 ( ). , ( DDR).

    interrupts

    Amega16

    interrupts :

    General Interrupt Control Register GICR Bit 7 6 5 4 3 2 1 0

    INT1 INT0 INT2 --- --- --- IVSEL IVCE Read/Write R/W R/W R/W R R R R/W R/W Initial Value 0 0 0 0 0 0 0 0

    GICR

    bits 5,6 7 GICR ( 1) ( 0) Amega16. , interrupt, , bits MCUCR ( INT0 INT1) MCUCSR ( o 2). General Interrupt Flag Register GIFR

    Bit 7 6 5 4 3 2 1 0 INTF1 INTF0 INTF2 --- --- --- --- ---

    Read/Write R/W R/W R/W R R R R R Initial Value 0 0 0 0 0 0 0 0

    GIFR

    bits 5-7 GIFR . bit 1 , (ISR) . ISR o bit GIFR 0. , interrupts , 1 bit GIFR. , GIFR=0x80 INT1. MCU Control Register MCUCR

    Bit 7 6 5 4 3 2 1 0 SM2 SE SM1 SM0 ISC11 ISC10 ISC01 ISC00

    Read/Write R/W R/W R/W R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0

    MCUCR

    T bits 0-3 interrupts INT0 INT1, , :

    Interrupt 0 Sense Control ISC01 ISC00

    0 0 pin INT0 0 1 pin INT0 1 0 10 ( ) Pin INT0 1 1 01 ( ) pin INT0

  • - 4 3

    Interrupt 1 Sense Control ISC11 ISC10

    0 0 Pin INT1 0 1 Pin INT1 1 0 10 ( ) Pin INT1 1 1 01 ( ) pin INT1

    MCU Control and Status Register MCUCSR

    Bit 7 6 5 4 3 2 1 0 JTD ISC2 --- JTRF WDRF BORF EXTRF PORF

    Read/Write R/W R/W R R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0

    MCUCSR

    T bit 6 interrupt INT2, . INT0 INT1:

    Interrupt 2 Sense Control ISC2

    0 10 ( ) Pin INT2 1 01 ( ) pin INT2

    ( ) , . , , .

    (pulse generator), ( L) . dip switch 4 10z , 1KHz , 1Hz 0.5z.

    AT90S2313 Atmel, AVR ( ATmege16), . , , 16-bit Timer1, 4 MHz. H 5 V Vcc breadboard. : Reset , Start Stop. , dip switches , Start. , LED, PD0, , PD1-PD4. , Stop. , Stop, dip switches, Start.

    T, , , (, , , .., STK200), SPI. LED . . , ( ) .

    ON 12

    34

    SPI

    PD0

    PD1

    PD2

    PD3

    PD4

    GND

    GND

    Vcc

    AT90

    S231

    3 START

    STOP

    RESET

    GREEN LED

    RED LED

  • - 4 4

    4.1 INT0

    #include unsigned char count=0;

    interrupt [EXT_INT0] void ext_int0_isr(void) { count++; PORTB = ~count; }

    void main(void) { DDRB = 0xFF; PORTB = 0xFF; DDRD = 0x00; PORTD = 0xFF; GICR = 0b01000000; MCUCR = 0x03;

    #asm("sei")

    while (1); } , SW2. , .

    , AVR Studio, .

  • - 4 5

    4.2

    interrupt , MCUCR, INT0. , ISR, count LED , INT0 (. SW2).

    , , SW0 LED INT0, SW7 LED INT0.

    4.3 INT1

    , INT1 ( ). , D STK200. , ( ) header D PD.3 ( 1). header D, Vcc Gnd.

    ! !

    #include

    unsigned char display[] = {~0x3f, ~0x06, ~0x5b, ~0x4f, ~0x66, ~0x6d, ~0x7d, ~0x07, ~0x7f, ~0x6f}; unsigned char i=0;

    interrupt [EXT_INT1] void ext_int1_isr(void) { i++; if(i==10) i=0; PORTC = display[i]; }

    void main(void) { DDRC = 0xFF; PORTC = display[0]; DDRD = 0x00; PORTD = 0x00; GICR = 0x80; GIFR = 0x80; MCUCR = 0x0C;

    #asm("sei")

    while (1); }

    4.4 interrupts

    , D STK200 . INT0 INT1 , :

    : (0 9) SW6 - SW7, 7 segment display. INT0 ( )

    : To LED7 STK200 2 sec INT1 ( )

  • - 4 6

    LED0 ( ) LED1 ( ) STK200. , 2 . , rid(), ( copy-paste) 3.

    #include #include #define A 1 #define B 2

    unsigned char display[] = {~0x3f,~0x06,~0x5b,~0x4f,~0x66, ~0x6d,~0x7d,~0x07,~0x7f,~0x6f}; unsigned char N = 0, state = 0;

    interrupt [EXT_INT0] void ext_int0_isr(void) { state = A; PORTB.0 = 0; PORTB.1 = 1; }

    interrupt [EXT_INT1] void ext_int1_isr(void) { state = B; PORTB.0 = 1; PORTB.1 = 0; }

    unsigned char rid(unsigned char n) // read_isolate_debounce { unsigned char mask; mask = (1

  • - 4 7

    4.5 GIFR

    To GIFR, - interrupts (. ). interrupts SW7. () interrupt INT0 LED.

    #include

    interrupt [EXT_INT0] void ext_int0_isr(void) { PORTB = 0x00; }

    void main(void) { DDRB = 0xFF; PORTB = 0xFF; DDRD = 0x00; PORTD = 0xFF; GICR = 0x40; MCUCR = 0x03;

    while (1) { if (!PIND.7) { // GIFR = 0x40; #asm("sei") } } }

    , SW2 ( 0), SW7. ;

    , GIFR = 0x40; ( //) . .

  • - 4 8

  • M - 5 1

    A 5

    O TIMER0

    : _ _

    8-bit / Timer0 Tmega16.

    _ _ TIMER0

    Timer0 8-bit ( . 0x00 0xFF). H , () TCNT0. O Timer0 :

    Timer/Counter0 Control Register TCCR0 Bit 7 6 5 4 3 2 1 0

    FOC0 WGM00 COM01 COM00 WGM01 CS02 CS01 CS00 Read/Write W R/W R/W R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0

    TCCR0

    T bits 0:2 TCCR0 Timer0, :

    Clock Selection Bits CS02 CS01 CS00

    0 0 0 A M 0 0 1 System Clock (CK) 0 1 0 System Clock, prescaler N = 8 (CK/8) 0 1 1 System Clock, prescaler N = 64 (CK/64) 1 0 0 System Clock, prescaler N = 256 (CK/256) 1 0 1 System Clock, prescaler N = 1024 (CK/1024)

    1 1 0 E ( ) 1 1 1 E ( )

    T bits 3 6 TCCR0 (mode) , : Waveform generation mode bits WGM00 WGM01

    0 0 (Normal mode) 1 0 E (Phase Correct PWM mode) 0 1 M T (CTC - Clear Timer on Compare mode) 1 1 E (PWM) (fast PWM mode)

    TIMER0 TCCR0,

    f0 = FCK/N 0 1 0xFF. 0xFF, , TOV0 TIFR 1 0 (). E interrupt , ISR Timer0, TOV0 0.

    CTC TOY TIMER0 TCCR0,

    f0 = FCK/N 0 1 OCR0. , , , 0x00 interrupt (. ), ISR. , CTC Timer0 (OCR0+1) .

  • M - 5 2

    modes Timer0, () , TCNT0. CS00:CS20 = 0 TCCR0 (.. TCCR0=0x00).

    interrupts Timer0 TIMSK TIFR.

    Timer/Counter Interrupt Mask Register TIMSK Bit 7 6 5 4 3 2 1 0

    OCIE2 TOIE2 TICIE1 OCIE1A OCIE1B TOIE1 OCIE0 TOIE0 Read/Write R/W R/W R/W R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0

    TIMSK

    bits 0 1 TIMS ( 1) Y M (Timer0 Overflow, bit 0) T (Timer0 Output Compare Match, bit OCIE0),

    M (Timer0 Overflow) 0xFF 0x00 TOV0 1. E bits TOIE0 ( Timer0 Overflow) GIE ( ) 1, (ISR) , TOV0 0 . ISR Timer0 CodeVision :

    interrupt [TIM0_OVF] void timer0_ovf_isr(void)

    (Timer0 Output Compare) TCNT0 OCR0 bit OCIE0 TIMSK 1, , ISR . Codevision:

    interrupt [TIM0_COMP] void timer0_comp_isr(void)

    5.1 Timer0

    , STK200, FCK = 8,00 MHz, , .

    Timer0.

    CS0

    2

    CS0

    1

    CS0

    0

    Prescaler Timer0 Timer0

    Timer0

    N f0 = FCK/N t0 = 1/f0 T0 = 256t0 0 0 0 0 - - - 0 0 1 1 8,00 MHz 0,125 sec 32 sec 0 1 0 8 1,00 MHz 1 sec 256 sec 0 1 1 64 1 0 0 256 1 0 1 1024 128 sec 32,768 msec

    prescaler =64, Timer0 1 sec.

  • M - 5 3

    5.2 Timer0 CTC

    T , ( ) LED STK200.

    1 sec CTC Timer0, 500 250 , prescaler N=64. 250 , OCR0 250-1 = 249.

    ( 250 ) 250t0 = 250N/FCK = 2508 sec = 2 msec

    #include unsigned char sec = 0; unsigned int count = 0;

    interrupt [TIM0_COMP] void timer0_comp_isr(void) { count++; // if (count == 500) // 500 x 250 8 sec = 1sec { sec++; // PORTB = ~sec; // LED STK200 count = 0; // } }

    void main(void) { DDRB = 0xFF; PORTB = 0xFF; DDRD = 0x00; PORTD = 0xFF;

    OCR0 = 249; // 250 TCCR0 = 0x0B; // CTC mode, prescaler = 64 TIMSK = 0x02; // interrupt Timer0

    #asm("sei") while (1); }

    , ( ), prescaler = 256. CPU ;

    , SW7 STK200, ( Timer0), SW0 ( 0) .

  • M - 5 4

    5.3

    , 320msec LED2.

    #include unsigned int count = 0;

    interrupt [TIM0_COMP] void timer0_comp_isr(void)

    { count++; if (count == ) {

    } }

    void main(void) { DDRB = 0xFF; PORTB = 0xFF; DDRD = 0x00; PORTD = 0xFF;

    OCR0 = TCCR0 = TIMSK =

    #asm("sei") while (1); }

    , , Fck = 16MHz ;

  • M - 5 5

    5.4

    , , , 3 sec, 0,75 sec.

    Timer0 , interrupt INT0. LED7 STK200.

    #include

    bit flag=0; unsigned int count = 0, max_count = 1500;

    interrupt [TIM0_COMP] void timer0_comp_isr(void) { count++; if (count == max_count) { PORTB.7 = ~PINB.7; count = 0; } }

    interrupt [EXT_INT0] void ext_int0_isr(void) { flag = ~flag; //

    if (flag) max_count = 375; // 0.75 sec prescaler=64 else max_count = 1500; // 3.0 sec prescaler=64

    TCNT0 = 0x00; // count = 0; //

    PORTB.7 = 0; // }

    void main(void) { DDRB = 0xFF; PORTB = 0x7F; DDRD = 0x00; PORTD = 0xFF;

    GICR = 0x40; GIFR = 0x40; MCUCR = 0x02;

    OCR0 = 249; TCCR0 = 0x0B; TIMSK = 0x02;

    #asm("sei") while (1); } 1 / .

  • M - 5 6

    5.5 Timer0 Interrupt

    Timer0 (counter) . T0 (o 0 PB.0, PORTB LED STK200). TCCR0 , Timer0 CPU. 6 , 7-segment display ( PORTC). interrupts, TCNT0 (polling) . 0 ' ( ), , .

    #include #define MAX 6 unsigned char display[] = {~0x3f,~0x06,~0x5b,~0x4f,~0x66, ~0x6d,~0x7d,~0x07,~0x7f,~0x6f}; unsigned char i=0; void main(void) { DDRC = 0xFF; PORTC = 0xFF; TCNT0 = 0x00; TCCR0 = 0x07;

    while (1) { if (TCNT0==MAX) { TCNT0 = 0; if(++i==10) i=0; PORTC = display[i]; } } }

    5.6 Timer0 Interrupt

    interrupt - mode CTC Timer0, CPU.

    #include #define 6

    unsigned char display[] = {~0x3f,~0x06,~0x5b,~0x4f,~0x66, ~0x6d,~0x7d,~0x07,~0x7f,~0x6f}; unsigned char i=0;

    interrupt [TIM0_COMP] void timer0_comp_isr(void) { i++; if (i==10) i=0; PORTC = display[i]; }

    void main(void) { DDRC = 0xff; PORTC = display[0]; TCNT0 = 0; OCR0 = MAX-1;

    TCCR0 = 0b00001111; // T0, CTC mode TIMSK = 0x02; // interrupt #asm("sei") while (1); }

  • - 6 1

    A 6

    O TIMER1

    : _ _

    16-bit / Timer1 Tmega16. LCD , Codevision. , . _ TIMER1 Timer1 ATmega16 16-bit ( 0x00 0xFFFF) , () TCNT1. O Timer1 , :

    Timer/Counter1 Control Register B TCCR1B Bit 7 6 5 4 3 2 1 0

    ICNC1 ICES1 -- WGM13 WGM12 CS12 CS11 CS10 Read/Write W R/W R R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0

    TCCR1B

    T bits 3:4 TCCR1B (mode) , :

    Waveform generation mode bits WGM13 WGM12

    0 0 0 1 CTC-OCR1A: M T ( OCR1A) 1 0 PWM & 1 1 CTC-ICR1: M T ( ICR1)

    T bits 0:2 TCCR1B Timer1, ( prescaler Timer0):

    Clock Selection Bits CS12 CS11 CS10

    0 0 0 A M 0 0 1 System Clock (CK) 0 1 0 System Clock, prescaler N = 8 (CK/8) 0 1 1 System Clock, prescaler N = 64 (CK/64) 1 0 0 System Clock, prescaler N = 256 (CK/256) 1 0 1 System Clock, prescaler N = 1024 (CK/1024)

    1 1 0 E ( ) 1 1 1 E ( )

    (NORMAL MODE) TOY TIMER1 TCCR1B ( - prescaler

    N), f1 = FCK/N 0 1 0xFFFF (65535). H 16-bit TCNT1. , 0x0000 () interrupt , ISR Timer1.

  • - 6 2

    CTC-OCR1A (CTC-OCR1A MODE) TOY TIMER1 CTC-OCR1A 0 16-bit OCR1A. , , 0x0000 , interrupt , ISR .

    A RRUPTS / interrupts Timer1 TIMSK.

    Timer/Counter Interrupt Mask Register TIMSK Bit 7 6 5 4 3 2 1 0

    OCIE2 TOIE2 TICIE1 OCIE1A OCIE1B TOIE1 OCIE0 TOIE0 Read/Write R/W R/W R/W R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0

    TIMSK

    bits 2 4 TIMS ( 1) Y M (Timer1 Overflow 1), T A (Timer1 Output Compare Match OCIE1A) T B (OCIE1B).

    Y M (Timer1 Overflow) Timer1 0xFFFF 0x0000 bit 1 TIMSK 1, , ISR . ISR Timer1 CodeVision :

    interrupt [TIM1_OVF] void timer1_ovf_isr(void) A (Timer1 Output Compare) TCNT1 OCR1A bit OCIE1A TIMSK 1, , ISR . ISR Codevision :

    interrupt [TIM1_COMPA] void timer1_compa_isr(void)

    6.1 Timer1

    , STK200, FCK = 8,00 MHz, , .

    CS0

    2

    CS0

    1

    CS0

    0

    Prescaler Timer1 Timer1

    Timer1

    N f1 = FCK/N t1 = 1/f1 T1 = 65536 t1 0 0 0 0 Timer1 0 0 1 1 8,00 MHz 0,125 sec 8,192 msec 0 1 0 8 1,00 MHz 1 sec 65,536 msec 0 1 1 64 125 kHz 8 sec 0,52488 sec 1 0 0 256 31,250 kHz 32 sec 2,097152 sec 1 0 1 1024 7,8125 kHz 128 sec 8,388608 sec

  • - 6 3

    6.2 Timer1

    T 10 . O 7-segment display, PORTC. , 7-segment display LED STK200.

    1sec, : o prescaler N=1024, t1 = N/Fck = 128sec. , =1 sec Q = T/t1 = 7812.5 () . , , prescaler .

    o prescaler N = 256, t1 = N/Fck = 32sec. Q = T/t1 =31250, 1 sec N = 256.

    o Q = 31250 < 65536, Timer1 1 sec, . CTC-OCR1A (mode) Timer1 interrupt OCR1A. , OCR1A 1 (31250 1 = 31249).

    #include unsigned char i = 9; unsigned char display[] = {~0x3f, ~0x06, ~0x5b, ~0x4f, ~0x66, ~0x6d, ~0x7d, ~0x07, ~0x7f, ~0x6f}; interrupt [TIM1_COMPA] void timer1_compa_isr(void) { if (i>0) { i--; PORTC = display[i]; } else { PORTC = 0xFF; PORTB = 0x00; TCCR1B = 0x00; // Timer1 } } void main(void) { DDRB = 0xFF; PORTB = 0xFF; DDRC = 0xFF; PORTC = display[i]; // i=9

    TCNT1 = 0x0000; OCR1A = ?????? ; TCCR1B = 0b00001100; // CTC-OCR1A mode, prescaler = 256 TIMSK = ?????? ; // interrupt OCR1A

    #asm("sei") while (1); } , , SW5 STK200.

    , 10 interrupt INT0.

    6.3

    , 10 ( display 1 ), CPU Timer (, interrupts 1 ).

  • - 6 4

    _

    LCD (liquid crystal display, LCD)

    , . LCD, , (.. 1x16, 2x20, 4x20, 2x40, 4x40), , ).

    LCD (PowerTip 1602F-B) 2x16, 2 16 . 5x8 (pixels), . , , . , ( - LCD controllers) HDD44780 Hitachi, ROM 240 .

    lcd.h CODEVISION o LCD ,

    . , Codevision C lcd.h, ( help files ) LCD HDD44780. low level functions, , , , (high level functions):

    unsigned char lcd_init(unsigned char lcd_columns) , 0 0. (16, ) LCD. : lcd_init();

    void lcd_clear(void) , 0, 0. : lcd_clear();

    void lcd_gotoxy(unsigned char x, unsigned char y) x y ( 0). : lcd_gotoxy(0,14);

    void lcd_putchar(char c) , ASCII c. : lcd_putchar('f');

    void lcd_puts(char *str) , , str[]. : char msg[]="hello!"; lcd_puts(msg);

  • - 6 5

    void lcd_putsf(char *str) , , Flash. LCD ( . ). : lcd_putsf("T.E.I. Crete");

    , , , () #include , . :

    /* PORTC */ #asm .equ __lcd_port=0x15 #endasm

    /* */ #include

    ( ) 4 Mega16 :

    PORTA 0x1b PORTB 0x18 PORTC 0x15 PORTD 0x12

    lcd.h ( ) Codevision, help files .

    stdlib.h CODEVISION

    LCD lcd.h , , , bytes ASCII . , (.., , , ...), ASCII . , , C, stdlib.h:

    void itoa(int n, char *str) int ( n) ASCII , str[]. , , , n MSB 1, itoa .

    void ltoa(long int n, char *str) long int ( n) ASCII , str[].

    void ftoa(float n, unsigned char decimals, char *str) float ( n) ASCII , str[]. decimals.

    , str[], , .

  • - 6 6

    6.4 LCD

    lcd.h stdlib.h LCD .

    , LCD PORTC ATmega16. ! , !

    #include #include

    #asm .equ __lcd_port=0x15 #endasm

    #include #include

    unsigned int a=102, b=1; char display[6]; void main(void) { DDRD = 0x00; PORTD=0xFF; lcd_init(16); lcd_gotoxy(4,0); lcd_putsf("Hello!"); lcd_gotoxy(0,1); lcd_putsf("Press any button..."); while(PIND==0xFF); while (1) { lcd_clear(); lcd_putsf("a = "); itoa(a,display); lcd_puts(display); lcd_putsf(", b = "); itoa(b,display); lcd_puts(display); lcd_gotoxy(2,1); lcd_putsf("a * b = "); itoa(a*b,display); lcd_puts(display); delay_ms(400); b++; if (b>200) b=0; } } , lcd.h stdlib.h.

    6.5 LCD

    , , 9999 0 ( ), LCD .

  • - 7 1

    A 7

    : _ _

    , . , (stepper motor). _

    . , .. 1,2, 30, 30/1,2 = 25 . PC , , .

    (Permanent Magnet stepping motor). , . . , .

    4

    S1S2S3S4 , .

    90. 45. PM motor 1,2. 2 . :

    switch step SW4 SW3 SW2 SW1

    1 0 0 1 1 2 1 0 0 1 3 1 1 0 0 4 0 1 1 0 1 0 0 1 1

  • - 7 2

    4 . SAA1027 Signetics ( 12 V 0,5 ). 12 V (CMOS Compatible). 12 V 4 . Trigger (pin 15) SAA1027 (o ). Rotation (pin 3) SAA1027, 0 1 . T, 0 pin 2, Reset.

    12 V

    Q1Q2Q3Q4

    10 k

    ToPIA

    VS

    TriggerSetRotation

    TSR

    R =100

    V

    RB

    0.1 F

    SAA1027

    IQ

    RS

    RSStepper motor

    15 4 13 1198

    14

    5 12

    4'4

    3 3'

    6

    23 2 2'

    1 1'

    , Rb , pin 4, ( I ) 4 (Rb = (4Vs /I) 60 ).

    1.8 200 . , 200 z, 60 rpm ( ). , v , f , :

    [rpm]60 0.3

    [Hz]200vfv v ff

    = =

    , 1/ f= , v :

    [rpm]0.3 [sec]

    v

    v=

    11

    [rpm]0.15 [sec]2

    v

    v= =

    1

    , , 1 /2 = .

  • - 7 3

    7.1

    ATmega16, SAA1027. , idc-10 , C . H :

    IDC1

    2

    3

    4

    5

    6

    7

    8

    9

    0

    Pin 9: Vcc, Pin 8: GND , Pin 4: Trigger, Pin 0: Rotation , Pin1: Set_

    , C , :

    PORTC.1 [Set] : ( 0) ( 1) .

    PORTC.0 [Rotation] : (/, 1/0, ).

    PORTC.4 [Trigger] : : Set pin 0, Trigger pin (, ) ( , Rotation pin).

    , , 20 rpm. , PORTC.4 1 = 0.15/20 = 7.5 msec. Timer1 CTC mode OCR1A (. 6), prescaler =1. , OCR1A = = =1 7.5msec1 1 60000 1 59999

    ( / ) 0.125secCK

    N F.

    7.2

    , :

    , interrupts 0 INT1, 20 rpm 80 rpm, 10 rpm.

    SW0 STK200, START/STOP . SW7

    STK200. ( 20 ms) , .

    #1: , OCR1A.

    #2: rid() 3, SW0 SW7.

    v [rpm] 20 30 40 50 60 70 80

    1 [msec] 7.5 1.875

    1 Timer1: ( / )CK

    QN F

    =

    ( FCK = 8Mhz, =1) 60000 15000

    CR1A (=Q-1) 59999 14999

  • - 7 4

    7.3 LCD

    , LCD , .

    : PORT .

  • - 8 1

    A 8

    : _ _

    timers . , () CTC mode Timer0 () (PWM) Timer1. _ TIMER0 - XPONITE - 32 M. AKITAKH

    CTC

    M bits COM00-COM01 TCCR0 CTC Timer0 ( ) OC0

    A hardware( Timer0) CPU

    O OC0 DDRB

    WGM00

    WGM01

    0

    1

    - XPONITE - # M. AKITAKH

    O A OC0

    H OC0 bits COM01 COM00 TCCR0

    COM01

    0

    0

    1

    1

    COM00

    0

    1

    0

    1

    EITOYPIA EOOY KATA THN TAYTIH YKPITH

    OC0

    E OC0

    E 0 OC0

    E 1 OC0

    - XPONITE - # M. AKITAKH

    K

    Y 8 MHz, 20 kHz OC0

    H CTC:

    WGM00

    WGM01

    0

    1

    - XPONITE - # M. AKITAKH

    Y X

    T OC0 25 sec

    X prescaler = 8, TCNT0 8/8 = 1MHz, 1 sec

    E, 25 sec 25

    20 kHz50 sec

    25 sec

    - XPONITE - # M. AKITAKH

    Y X

    M , , FOC :

    FOC=FCK/(2*N*(1+OCR0))

    FCK N prescaler

    (1+OCR0)=25, 24 OCR0

    OCR0

    OCF0

    TCNT0 0 1

    TOP

    TOPTOP-1

    Tim

    er0

    CTC

    mod

    e

    - XPONITE - # M. AKITAKH

    K

    #include

    void main(void){DDRB = 0x08; // set OC0 pin for outputTCNT0 = 0x00; // start timer with 0 in timerOCR0 = 24; // output compare valueTIMSK = 0x00; // no interrupts necessary!TCCR0 = 0b00011010; // CTC mode, prescaler = 8, toggleOC0

    while (1); // thats all!} O hardware

    , , polling interrupts

  • - 8 2

    PWM TIMER1 - XPONITE - # M. AKITAKH

    (PWM)

    pwm

    onoff

    PWM:

    H fpwm = 1/Tpwm

    duty cycle PWM , on/Tpwm ( %)

    fpwm, duty cycle.

    - XPONITE - 88 M. AKITAKH

    Timer1: Phase Correct PWM Mode

    H Phase Correct PWM mode Timer1 : TCNT1 0x0000. () OCR1A/B,

    () OC1A/B TCNT1 TOP,

    0x0000. , , () OCR1A/B,

    () OC1A/B TCNT1 0x0000,

    TOP, .

    5 Phase Correct PWM mode, TOP (. PWM ), : TOP = 0x00FF (8-bit ) TOP = 0x01FF (9-bit ) TOP = 0x03FF (10-bit ) TOP = CR1A ( OCR1A) TOP = ICR1 ( ICR1

    fpwm = FCK / (2TOP)

    - XPONITE - # M. AKITAKH

    Timer1: Phase Correct PWM Mode

    Phase Correct PWM mode

    C1B

    OCR1B

    TOP

    0x00

    OC1B

    OCR1B OCR1B OCR1B

    - XPONITE - # M. AKITAKH

    Timer1: Phase Correct PWM Mode

    O fpwm prescalerN, 8-, 9-, 10-bit FCK = 8Hz:

    8-bit (TOP = 255)

    fpwm = 15.686 kHz

    fpwm = 1.961 kHz

    fpwm = 245 Hz

    fpwm = 61 Hz

    fpwm = 15 Hz

    d.cycle: 0.39%

    9-bit (TOP = 511)

    fpwm = 7.827 kHz

    fpwm = 978.5 Hz

    fpwm = 122 Hz

    fpwm = 31 Hz

    fpwm = 8 Hz

    d.cycle: 0.19%

    10-bit (TOP = 1023)

    fpwm = 3.91 kHz

    fpwm = 489 Hz

    fpwm = 61 Hz

    fpwm = 15 Hz

    fpwm = 4 Hz

    d.cycle: 0.097%

    N

    1

    8

    64

    256

    1024

    , TOP, , duty cycle ( % )

    - XPONITE - # M. AKITAKH

    : TCCR1A/B

    0 0 0 0 10 0 1

    0 0 0 1 00 0 0

    COM11

    0

    0

    1

    1

    COM10

    0

    1

    0

    1

    EITOYPIA EOOY PHASE CORRECT PWM MODE

    OC1

    OC1

    E 0 OC1 , 1 OC1

    E 1 OC1 , 0 OC1

    - XPONITE - 108 M. AKITAKH

    : TCCR1A/B

    0 0 0 0 10 0 1

    0 0 0 1 00 0 0

    4 bits mode Timer1

    Phase correct PWM mode TOP = 8-bit (. )

    - XPONITE - 110 M. AKITAKH

    : TCCR1A/B

    0 0 0 0 10 0 1

    0 0 0 1 00 0 0

    CS10

    0

    1

    0

    1

    0

    1

    0

    1

    CS12

    0

    0

    0

    0

    1

    1

    1

    1

    CS11

    0

    0

    1

    1

    0

    0

    1

    1

    HMA POOIOY

    A M

    System Clock (CK)

    CK/8

    CK/64

    CK/256

    CK/1024

    E

    E

  • - 8 3

    8.1 PWM Timer1

    Phase Correct PWM mode Timer1 5V, OC1B ( PD.4) .

    8-bit Phase Correct PWM mode, prescaler N = 8, PWM FPWM = 1.961kHz , duty cycle OCR1B (, OCR1B = 0, duty cycle 0% OCR1B = 255, duty cycle 100%).

    , SW0-SW3 , duty cycle 0%, 35%, 70% 100%.

    : headers STK200, C ( D, ). #include

    void main(void) { DDRC = 0x00; // PORTC PORTC = 0xFF; // pull-up DDRD.4 = 1; // o OC1B OCR1B = 0; TCCR1A = 0x21; // phase-correct PWM mode, OC1B TCCR1B = 0x02; // prescaler N = 8; while (1) { if(!PINC.0) OCR1B = 0; // duty cycle = 0% if(!PINC.1) OCR1B = 89; // duty cycle = 35% if(!PINC.2) OCR1B = 179; // duty cycle = 70% if(!PINC.3) OCR1B = 255; // duty cycle = 100% } } PWM OCR1B = 179.

    / , ( 256 ) SW7 SW6.

    / Phase Correct PWM mode 9-bit .

  • - 8 4

    , CTC Timer0, FCK, prescaler . :

    FOC=FCK/(2*N*(1+OCR0))

    CS0

    2

    CS0

    1

    CS0

    0 Prescaler (OCR0= 255)

    (OCR0= 0)

    N FL = FCK/ (2*N*256) FL = FCK/ (2*N*1)

    0 0 0 0 - - 0 0 1 1 15,625 kHz 4 MHz 0 1 0 8 1,9531 kHz 0,5 MHz 0 1 1 64 244,14 Hz 62,5 kHz 1 0 0 256 61,035 Hz 15,625 kHz 1 0 1 1024 15,2588 Hz 3,9063 kHz

    FCK = 8Mhz ( STK200)

    , , OCR0 . = 64, ( y-, , ).

  • - 8 5

    8.2 ""

    , () "", STK200 .

    (buzzer), . OC0 ( PB.3) , , , .

    5 , STK200. =64 prescaler, 1,76 kHz ( ) OCR0 :

    FOC=FCK/(2*N*(1+OCR0)) => (1+OCR0) = FCK/(2*N*FOC) =>

    => OCR0 = (8 Mhz / (2*64*1,76 kHz)) - 1 = 34.51 => OCR0 = 35 ( )

    , , 1.76 kHz OC0, SW2 STK200.

    , headers STK200, C ( D, ).

    1

    (z) 1046,50 1174,66 1318,5 1396,91 1567,98 1760,0 1975,53 2093,0 OCR0 (FCK = 8Mhz, =64)

    59 52 46 44 35

    STK200 SW7 SW6 SW5 SW4 SW3 SW2 SW1 SW0

    #include unsigned char n=0,buttons; unsigned char freq[]={59,52,46,44,0,35,0,0};

    void main(void) { DDRC = 0x00; PORTC = 0xFF; // PORTC DDRB = 0x08; // OC0 TCCR0 = 0b00011000; // CTC mode, toggle OC0, prescaler = 0 while (1) { if (PINC != buttons) // { buttons = PINC; switch(buttons) { case 0x7F:n=0;break; // NTO case 0xBF:n=1;break; // case 0xDF:n=2;break; // MI case 0xEF:n=3;break; // case 0xFB:n=5;break; //

    default:n=255;break; // } if (n!=255) // { OCR0 = freq[n]; // TCNT0 = 0x00; TCCR0 = 0b00011011; // prescaler = 64 => Timer } else // { TCCR0 = 0x00; // prescaler = 0 ( Timer) } } }}

  • - 8 6

    , OCR0 , .

    , ("").

  • - 9 1

    A 9

    O /D

    : _ _

    , analog to digital converter (ADC) Tmega16. _ ANALOG TO DIGITAL CONVERTER (ADC)

    H ADC ATmega16 10-bit. M 8 - (single-ended) . - A GND.

    O ADC AVR (successive approximation

    ADC), . 10-bit ADC,

    50 kHz < FADC < 200 kHz

    (prescaler) ADC, ADC . prescaler, , 2, 4, 8, 16, 32, 64 128 (. ADCSRA ). ADC ( FCK), : (i) FCK 200 kHz, (ii) prescaler , , (iii) bits ADPS2:0 ADCSRA.

    ADC

    bit DEN ADCSRA ADC 1. H - 1 bit ADSC ADCSRA, 0 . , bit ADATE ADCSRA 1, , bits ADTS2:0 SFIOR.

    M 13 ADC 1 bit ADIF ADCSRA. interrupt ( 1 bit ADIE ADCSRA), ISR .

    T ADCW CodeVision C

    ADCW = 210VIN /VREF

    VIN VREF . ADCW=0x000 (GND), ADCW=0x3FF VREF 1 LSB.

  • - 9 2

    ADC Multiplexer Selection Register ADMUX

    Bit 7 6 5 4 3 2 1 0 REFS1 REFS0 ADLAR MUX4 MUX3 MUX2 MUX1 MUX0

    Read/Write W R/W R R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0

    ADMUX

    n (0

  • - 9 3

    9.2

    , , ADC, (0-5V) PA.3. 4 Volt LED0-1 STK200, 1 Volt LED6-7, 1-4 Volt LED3-4. , ( ) PA.3.

    #include #define VREF 5 // 5 Volt

    interrupt [ADC_INT] void adc_isr(void) { unsigned int adc_data;

    adc_data = ADCW; // adc_data if (adc_data > 4*1024/VREF) // ADC // 4 Volt PORTB = 0xFC;

    else if (adc_data < 1*1024/VREF) // ADC // 1 Volt PORTB = 0x3F;

    else PORTB = 0xE7;

    ADCSRA |= 0x40; // }

    void main(void) { PORTB = 0xFF; DDRB = 0xFF; ADMUX = 0x43; // ADC: AVCC // PA.3 ADCSRA = 0x8E; ADCSRA |= 0x40; //

    #asm("sei") while (1); }

    ( /sec) A/D .

  • - 9 4

    9.3

    . , ADC, duty cycle PWM . PWM 8.

    9.4

    (0-5V) ADC LCD ., .

    SW0-SW7 , .

  • - 10 1

    A 10

    AYXPONH EIPIAKH IAYNEH

    :

    _ , CodeVision C compiler.

    _ AYXPONH EIPIAKH EIKOINNIA

    (full duplex) (PC, , ...) (Rx, Tx) Gnd. , , hardware . , PC, TTL RS-232 PC. (.. 202 Maxim) TTL RS-232, PC RS-232 TTL. STK200 , RS-232 PC .

    STK200

    ATmega16

    MAX202RS232

    H MONAA USART TOY ATmega16

    To USART (Universal Synchronous Asynchronous Receiver-Transmitter) ATmega16 ( bits, start stop bits), , / . , .

    , :

    1. data bits ( 8) 2. stop bits (1, 1.5 2 - 1 stop bit) 3. (parity bit),

    ( , ). 4. (baud rate)

    T :

    USART Control Register C UCSRC Bit 7 6 5 4 3 2 1 0

    URSEL UMSEL UPM1 UPM2 USBS UCSZ1 UCSZ0 UCPOL Read/Write W R/W R/W R/W R/W R/W R/W R/W Initial Value 1 0 0 0 0 1 1 0

    UCSRC

    O bits UCSRC : A USART, 8 data bits, 1 start bit, 1 stop bit, no parity bit. , , .

  • - 10 2

    USART Control Register B UCSRB Bit 7 6 5 4 3 2 1 0

    RXCIE TXCIE UDRIE RXEN TXEN UCSZ2 RXB8 TXB8 Read/Write W R/W R/W R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0

    UCSRB

    T bits RXEN TXEN ( 1) . T bits RXCIE, TXCIE UDRIE (bits5:7) ( 1) interrupts. stdio CodeVision C interrupts, bits 0.

    USART Baud Rate Register UBRR UBRR 12-bit ( 0 4095), baud rate , :

    UBRR = (FCK / (16b)) 1

    FCK ( Hz) b baud rate ( bit , bps). E, .. FCK = 8MHz b=9600bps, 8106/(169600) 1 = 51,0833 UBRR = 51. baud rate (, 0.2%), , , . mega16 12 bit UBRR UBRRH ( most significant byte) UBRRL ( least significant byte). UBRR 16-bit (4 ) UBRRH 2 ( ) , UBRRL . ,

    UBRR = 51 = 0x0033

    , UBRRH = 0x00 UBRRL = 0x33.

    H BIBIOHKH STDIO TH CODEVISION C

    H CodeVision C stdio.h C, (.. getchar, gets, scanf) (.. putchar, puts, printf, sprintf) . A , ( PC). , , (.. putsf) Flash, .

    H CodeVision, , , .

    #include #include // void main(void) { char your_name[11]; // 10+1 UBRRH = 0x00; // baud rate UBRR UBRRL = 0x33; // (9600 bps FCK = 8MHz) UCSRB = 0x18; // UART (RXEN + TXEN) putsf("Enter your name and press return.\r"); // putsf putsf("(only 10 characters allowed)\r"); // flash gets(your_name,10); // 10 printf("\n Hi %s!\n\r",your_name); // (SRAM) while(1);

    }

  • - 10 3

    stdio (polling), interrupts. , (blocking functions) . A , , , interrupts.

    , , ( ) .

    TERMINAL TOOL CODEVISION CodeVision

    (Terminal tool) , / ASCII / . erminal tool CodeVision Tools, , :

    , Terminal tool ( Terminal Settings..) . , 9600bps 8 data bits, 1 start bit, 1 stop bit, no parity bit, Terminal Settings :

    ASCII stdio / ASCII, :

    Char Dec Hex Char Dec Hex Char Dec Hex Char Dec Hex nul 0 0x00 sp 32 0x20 @ 64 0x40 ` 96 0x60 soh 1 0x01 ! 33 0x21 A 65 0x41 a 97 0x61 stx 2 0x02 " 34 0x22 B 66 0x42 b 98 0x62 etx 3 0x03 # 35 0x23 C 67 0x43 c 99 0x63 eot 4 0x04 $ 36 0x24 D 68 0x44 d 100 0x64 enq 5 0x05 % 37 0x25 E 69 0x45 e 101 0x65 ack 6 0x06 & 38 0x26 F 70 0x46 f 102 0x66 bel 7 0x07 ' 39 0x27 G 71 0x47 g 103 0x67 bs 8 0x08 ( 40 0x28 H 72 0x48 h 104 0x68 ht 9 0x09 ) 41 0x29 I 73 0x49 i 105 0x69 lf 10 0x0a * 42 0x2a J 74 0x4a j 106 0x6a

    vt 11 0x0b + 43 0x2b K 75 0x4b k 107 0x6b ff 12 0x0c , 44 0x2c L 76 0x4c l 108 0x6c cr 13 0x0d - 45 0x2d M 77 0x4d m 109 0x6d so 14 0x0e . 46 0x2e N 78 0x4e n 110 0x6e si 15 0x0f / 47 0x2f O 79 0x4f o 111 0x6f

    dle 16 0x10 0 48 0x30 P 80 0x50 p 112 0x70 dc1 17 0x11 1 49 0x31 Q 81 0x51 q 113 0x71 dc2 18 0x12 2 50 0x32 R 82 0x52 r 114 0x72 dc3 19 0x13 3 51 0x33 S 83 0x53 s 115 0x73 dc4 20 0x14 4 52 0x34 T 84 0x54 t 116 0x74 nak 21 0x15 5 53 0x35 U 85 0x55 u 117 0x75 syn 22 0x16 6 54 0x36 V 86 0x56 v 118 0x76 etb 23 0x17 7 55 0x37 W 87 0x57 w 119 0x77 can 24 0x18 8 56 0x38 X 88 0x58 x 120 0x78 em 25 0x19 9 57 0x39 Y 89 0x59 y 121 0x79 sub 26 0x1a : 58 0x3a Z 90 0x5a z 122 0x7a esc 27 0x1b ; 59 0x3b [ 91 0x5b { 123 0x7b

    fs 28 0x1c < 60 0x3c \ 92 0x5c | 124 0x7c gs 29 0x1d = 61 0x3d ] 93 0x5d } 125 0x7d rs 30 0x1e > 62 0x3e ^ 94 0x5e ~ 126 0x7e us 31 0x1f ? 63 0x3f _ 95 0x5f del 127 0x7f

  • - 10 4

    10.1

    , , ( / ) LEDs STK200.

    To stdio :

    printf(""): .

    getchar(): 8-bit , ASCII .

    #include #include

    void main(void) { unsigned char k; UCSRB = 0x18; // UART (RXEN + TXEN) UBRRH = 0x00; // baud rate UBRRL = 0x33; // (9600 bps Fck = 8MHz) DDRB = 0xFF; PORTB = 0xFF;

    while(1) { printf("\n\r Please select: \n\r"); printf("(0) Toggle LED0 \n\r"); printf("(1) Toggle LED1 \n\r"); printf("(6) Toggle LED6 \n\r"); printf("(7) Toggle LED7 \n\r"); printf("(x) Switch off all LEDs \n\r");

    k=getchar(); // // switch(k) { case '0': PORTB.0 = ~PORTB.0; break; case '1': PORTB.1 = ~PORTB.1; break; case '6': PORTB.6 = ~PORTB.6; break; case '7': PORTB.7 = ~PORTB.7; break; case 'x': PORTB=0xFF; break; } } } , LED, LED.

    , PC 19200bps.

  • - 10 5

    10.2 ,

    , ( 1 99 sec) . , . CTC-OCR1A mode Timer1, 6.

    stdio :

    gets(inStr,m): m , inStr.

    atoi(numStr): numStr .

    , printf("\r %02i",sec); sec, .

    #include #include #include unsigned char sec; interrupt [TIM1_COMPA] void timer1_compa_isr(void) { sec--; printf("\r %02i",sec); if (sec==0) { PORTB = 0x00; TCCR1B = 0x00; printf("\n\n\r Done!"); } } void main(void) { char numStr[4]; DDRB = 0xFF; PORTB = 0x00; UCSRB = 0x18; // UART (RXEN + TXEN) UBRRH = 0x00; // baud rate UBRRL = 0x19; // (19200 bps Fck = 8MHz)

    printf("\n\n\r Microcontroller reset \n\r"); printf("\r Countdown time (1-99 sec): "); gets(numStr,3); sec = atoi(numStr); printf("\n\n\r secs to go: \n"); printf("\r %02i",sec); OCR1A = 31249; TCCR1B = 0x0C; // CTC-OCR1A mode, prescaler = 256 TIMSK = 0x10; // interrupt OCR1A #asm("sei") while(1); } , 1 999 sec.

  • - 10 6

    10.3 A/D .

    , , A/D , :

    , (0-7) A/D.

    , A/D , PC.

    #include #include interrupt [ADC_INT] void adc_isr(void) { unsigned int adc_data; adc_data = ADCW; // adc_data printf("%04i\n\r",adc_data); ADCSRA |= 0x40; // } void main(void) { char k; PORTB = 0xFF; DDRB = 0xFF; UCSRB = 0x18; // UART (RXEN + TXEN) UBRRH = 0x00; // baud rate UBRRL = 0x19; // (19200 bps Fck = 8MHz) printf("\n\n\r Microcontroller reset \n\r"); printf("\r Read from ADC channel (0-7): "); k=getchar()-'0'; ADMUX = k; ADMUX |= 0x40; ADCSRA = 0x8E; ADCSRA |= 0x40; // #asm("sei") while(1); }

  • -

    ASCII

    Char Dec Hex Char Dec Hex Char Dec Hex Char Dec Hex

    nul 0 0x00 sp 32 0x20 @ 64 0x40 ` 96 0x60 soh 1 0x01 ! 33 0x21 A 65 0x41 a 97 0x61 stx 2 0x02 " 34 0x22 B 66 0x42 b 98 0x62 etx 3 0x03 # 35 0x23 C 67 0x43 c 99 0x63 eot 4 0x04 $ 36 0x24 D 68 0x44 d 100 0x64 enq 5 0x05 % 37 0x25 E 69 0x45 e 101 0x65 ack 6 0x06 & 38 0x26 F 70 0x46 f 102 0x66 bel 7 0x07 ' 39 0x27 G 71 0x47 g 103 0x67 bs 8 0x08 ( 40 0x28 H 72 0x48 h 104 0x68 ht 9 0x09 ) 41 0x29 I 73 0x49 i 105 0x69 lf 10 0x0a * 42 0x2a J 74 0x4a j 106 0x6a

    vt 11 0x0b + 43 0x2b K 75 0x4b k 107 0x6b ff 12 0x0c , 44 0x2c L 76 0x4c l 108 0x6c cr 13 0x0d - 45 0x2d M 77 0x4d m 109 0x6d so 14 0x0e . 46 0x2e N 78 0x4e n 110 0x6e si 15 0x0f / 47 0x2f O 79 0x4f o 111 0x6f

    dle 16 0x10 0 48 0x30 P 80 0x50 p 112 0x70 dc1 17 0x11 1 49 0x31 Q 81 0x51 q 113 0x71 dc2 18 0x12 2 50 0x32 R 82 0x52 r 114 0x72 dc3 19 0x13 3 51 0x33 S 83 0x53 s 115 0x73 dc4 20 0x14 4 52 0x34 T 84 0x54 t 116 0x74 nak 21 0x15 5 53 0x35 U 85 0x55 u 117 0x75 syn 22 0x16 6 54 0x36 V 86 0x56 v 118 0x76 etb 23 0x17 7 55 0x37 W 87 0x57 w 119 0x77 can 24 0x18 8 56 0x38 X 88 0x58 x 120 0x78 em 25 0x19 9 57 0x39 Y 89 0x59 y 121 0x79 sub 26 0x1a : 58 0x3a Z 90 0x5a z 122 0x7a esc 27 0x1b ; 59 0x3b [ 91 0x5b { 123 0x7b

    fs 28 0x1c < 60 0x3c \ 92 0x5c | 124 0x7c gs 29 0x1d = 61 0x3d ] 93 0x5d } 125 0x7d rs 30 0x1e > 62 0x3e ^ 94 0x5e ~ 126 0x7e us 31 0x1f ? 63 0x3f _ 95 0x5f del 127 0x7f

  • -

    TIMER0

    O FCK = 8 Hz

    Prescaler Timer0

    N f0 = FCK/N t0 = 1/f0 T0 = 256 t0

    0 ("")

    1 8,00 MHz 0,125 sec 32 sec

    40 t0 = 5 sec 80 t0 = 10 sec 120 t0 = 15 sec 128 t0 = 16 sec 240 t0 = 30 sec

    8 1,00 MHz 1 sec 256 sec

    30 t0 = 30 sec 50 t0 = 50 sec 100 t0 = 100 sec 200 t0 = 200 sec 250 t0 = 250 sec

    64 125 kHz 8 sec 2,048 msec

    25 t0 = 200 sec 100 t0 = 800 sec 125 t0 = 1 msec 200 t0 = 1.6 msec 250 t0 = 2 msec

    256 31,250 kHz 32 sec 8,192 msec

    25 t0 = 0.8 msec 50 t0 = 1.6 msec 125 t0 = 4 msec 200 t0 = 6.4 msec 250 t0 = 8 msec

    1024 7,8125 kHz 128 sec 32,768 msec

    25 t0 = 3.2 msec 125 t0 = 16 msec 175 t0 = 22.4 msec 200 t0 = 25.6 msec 250 t0 = 32 msec

  • -

    TIMER1

    FCK = 8 Hz

    Prescaler Timer1

    f1 = FCK/N t1 = 1/f1 T1 = 65536 t1

    0 ("")

    1 8,00 MHz 0,125 sec 8,192 msec

    8000 t1 = 1 msec 16000 t1 = 2 msec 24000 t1 = 3 msec 40000 t1 = 5 msec 64000 t1 = 8 msec

    8 1,00 MHz 1 sec 65,536 msec

    1000 t1 = 1 msec 5000 t1 = 5 msec 10000 t1 = 10 msec 30000 t1 = 30 msec 50000 t1 = 50 msec 65000 t1 = 65 msec

    64 125 kHz 8 sec 0,52488 sec

    12500 t1 = 0.1 sec 15625 t1 = 0.125 sec 31250 t1 = 0.25 sec 37500 t1 = 0.3 sec 50000 t1 = 0.4 sec 62500 t1 = 0.5 sec

    256 31,250 kHz 32 sec 2,097152 sec

    12500 t1 = 0.4 sec 15625 t1 = 0.5 sec 31250 t1 = 1 sec 46875 t1 = 1.5 sec 62500 t1 = 2 sec

    1024 7,8125 kHz 128 sec 8,388608 sec

    12500 t1 = 1.6 sec 15625 t1 = 2 sec 46875 t1 = 6 sec 62500 t1 = 8 sec

  • -

    KA BAUD RATE

    FCK = 8 Mhz Baud Rate UBRR

    %

    2400 207 0.2 4800 103 0.2 9600 51 0.2 14400 34 0.8 19200 25 0.2 28800 16 2.1 38400 12 0.2 56000 8 0.8 57600 8 3.7 76800 6 7.5 115200 3 7.8 230400 1 7.8

    , ( ) () baud rate ( UBRR) 1%.

  • -

    PINOUT AVR ATmega16

    cover.pdfaskisi01_HLEK.pdfaskisi02_HLEK.pdfaskisi03_HLEK.pdfaskisi04_HLEK.pdfaskisi05_HLEK.pdfaskisi06_HLEK.pdfaskisi07_HLEK.pdfaskisi08_HLEK.pdfaskisi09_HLEK.pdfaskisi10_HLEK.pdfPARARTIMA.pdf

    /ColorImageDict > /JPEG2000ColorACSImageDict > /JPEG2000ColorImageDict > /AntiAliasGrayImages false /CropGrayImages true /GrayImageMinResolution 300 /GrayImageMinResolutionPolicy /OK /DownsampleGrayImages true /GrayImageDownsampleType /Bicubic /GrayImageResolution 300 /GrayImageDepth -1 /GrayImageMinDownsampleDepth 2 /GrayImageDownsampleThreshold 1.50000 /EncodeGrayImages true /GrayImageFilter /DCTEncode /AutoFilterGrayImages true /GrayImageAutoFilterStrategy /JPEG /GrayACSImageDict > /GrayImageDict > /JPEG2000GrayACSImageDict > /JPEG2000GrayImageDict > /AntiAliasMonoImages false /CropMonoImages true /MonoImageMinResolution 1200 /MonoImageMinResolutionPolicy /OK /DownsampleMonoImages true /MonoImageDownsampleType /Bicubic /MonoImageResolution 1200 /MonoImageDepth -1 /MonoImageDownsampleThreshold 1.50000 /EncodeMonoImages true /MonoImageFilter /CCITTFaxEncode /MonoImageDict > /AllowPSXObjects false /CheckCompliance [ /None ] /PDFX1aCheck false /PDFX3Check false /PDFXCompliantPDFOnly false /PDFXNoTrimBoxError true /PDFXTrimBoxToMediaBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXSetBleedBoxToMediaBox true /PDFXBleedBoxToTrimBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXOutputIntentProfile () /PDFXOutputConditionIdentifier () /PDFXOutputCondition () /PDFXRegistryName () /PDFXTrapped /False

    /Description > /Namespace [ (Adobe) (Common) (1.0) ] /OtherNamespaces [ > /FormElements false /GenerateStructure true /IncludeBookmarks false /IncludeHyperlinks false /IncludeInteractive false /IncludeLayers false /IncludeProfiles true /MultimediaHandling /UseObjectSettings /Namespace [ (Adobe) (CreativeSuite) (2.0) ] /PDFXOutputIntentProfileSelector /NA /PreserveEditing true /UntaggedCMYKHandling /LeaveUntagged /UntaggedRGBHandling /LeaveUntagged /UseDocumentBleed false >> ]>> setdistillerparams> setpagedevice

    /ColorImageDict > /JPEG2000ColorACSImageDict > /JPEG2000ColorImageDict > /AntiAliasGrayImages false /CropGrayImages true /GrayImageMinResolution 300 /GrayImageMinResolutionPolicy /OK /DownsampleGrayImages true /GrayImageDownsampleType /Bicubic /GrayImageResolution 300 /GrayImageDepth -1 /GrayImageMinDownsampleDepth 2 /GrayImageDownsampleThreshold 1.50000 /EncodeGrayImages true /GrayImageFilter /DCTEncode /AutoFilterGrayImages true /GrayImageAutoFilterStrategy /JPEG /GrayACSImageDict > /GrayImageDict > /JPEG2000GrayACSImageDict > /JPEG2000GrayImageDict > /AntiAliasMonoImages false /CropMonoImages true /MonoImageMinResolution 1200 /MonoImageMinResolutionPolicy /OK /DownsampleMonoImages true /MonoImageDownsampleType /Bicubic /MonoImageResolution 1200 /MonoImageDepth -1 /MonoImageDownsampleThreshold 1.50000 /EncodeMonoImages true /MonoImageFilter /CCITTFaxEncode /MonoImageDict > /AllowPSXObjects false /CheckCompliance [ /None ] /PDFX1aCheck false /PDFX3Check false /PDFXCompliantPDFOnly false /PDFXNoTrimBoxError true /PDFXTrimBoxToMediaBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXSetBleedBoxToMediaBox true /PDFXBleedBoxToTrimBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXOutputIntentProfile () /PDFXOutputConditionIdentifier () /PDFXOutputCondition () /PDFXRegistryName () /PDFXTrapped /False

    /Description > /Namespace [ (Adobe) (Common) (1.0) ] /OtherNamespaces [ > /FormElements false /GenerateStructure true /IncludeBookmarks false /IncludeHyperlinks false /IncludeInteractive false /IncludeLayers false /IncludeProfiles true /MultimediaHandling /UseObjectSettings /Namespace [ (Adobe) (CreativeSuite) (2.0) ] /PDFXOutputIntentProfileSelector /NA /PreserveEditing true /UntaggedCMYKHandling /LeaveUntagged /UntaggedRGBHandling /LeaveUntagged /UseDocumentBleed false >> ]>> setdistillerparams> setpagedevice

    /ColorImageDict > /JPEG2000ColorACSImageDict > /JPEG2000ColorImageDict > /AntiAliasGrayImages false /CropGrayImages true /GrayImageMinResolution 300 /GrayImageMinResolutionPolicy /OK /DownsampleGrayImages true /GrayImageDownsampleType /Bicubic /GrayImageResolution 300 /GrayImageDepth -1 /GrayImageMinDownsampleDepth 2 /GrayImageDownsampleThreshold 1.50000 /EncodeGrayImages true /GrayImageFilter /DCTEncode /AutoFilterGrayImages true /GrayImageAutoFilterStrategy /JPEG /GrayACSImageDict > /GrayImageDict > /JPEG2000GrayACSImageDict > /JPEG2000GrayImageDict > /AntiAliasMonoImages false /CropMonoImages true /MonoImageMinResolution 1200 /MonoImageMinResolutionPolicy /OK /DownsampleMonoImages true /MonoImageDownsampleType /Bicubic /MonoImageResolution 1200 /MonoImageDepth -1 /MonoImageDownsampleThreshold 1.50000 /EncodeMonoImages true /MonoImageFilter /CCITTFaxEncode /MonoImageDict > /AllowPSXObjects false /CheckCompliance [ /None ] /PDFX1aCheck false /PDFX3Check false /PDFXCompliantPDFOnly false /PDFXNoTrimBoxError true /PDFXTrimBoxToMediaBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXSetBleedBoxToMediaBox true /PDFXBleedBoxToTrimBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXOutputIntentProfile () /PDFXOutputConditionIdentifier () /PDFXOutputCondition () /PDFXRegistryName () /PDFXTrapped /False

    /Description > /Namespace [ (Adobe) (Common) (1.0) ] /OtherNamespaces [ > /FormElements false /GenerateStructure true /IncludeBookmarks false /IncludeHyperlinks false /IncludeInteractive false /IncludeLayers false /IncludeProfiles true /MultimediaHandling /UseObjectSettings /Namespace [ (Adobe) (CreativeSuite) (2.0) ] /PDFXOutputIntentProfileSelector /NA /PreserveEditing true /UntaggedCMYKHandling /LeaveUntagged /UntaggedRGBHandling /LeaveUntagged /UseDocumentBleed false >> ]>> setdistillerparams> setpagedevice

    /ColorImageDict > /JPEG2000ColorACSImageDict > /JPEG2000ColorImageDict > /AntiAliasGrayImages false /CropGrayImages true /GrayImageMinResolution 300 /GrayImageMinResolutionPolicy /OK /DownsampleGrayImages true /GrayImageDownsampleType /Bicubic /GrayImageResolution 300 /GrayImageDepth -1 /GrayImageMinDownsampleDepth 2 /GrayImageDownsampleThreshold 1.50000 /EncodeGrayImages true /GrayImageFilter /DCTEncode /AutoFilterGrayImages true /GrayImageAutoFilterStrategy /JPEG /GrayACSImageDict > /GrayImageDict > /JPEG2000GrayACSImageDict > /JPEG2000GrayImageDict > /AntiAliasMonoImages false /CropMonoImages true /MonoImageMinResolution 1200 /MonoImageMinResolutionPolicy /OK /DownsampleMonoImages true /MonoImageDownsampleType /Bicubic /MonoImageResolution 1200 /MonoImageDepth -1 /MonoImageDownsampleThreshold 1.50000 /EncodeMonoImages true /MonoImageFilter /CCITTFaxEncode /MonoImageDict > /AllowPSXObjects false /CheckCompliance [ /None ] /PDFX1aCheck false /PDFX3Check false /PDFXCompliantPDFOnly false /PDFXNoTrimBoxError true /PDFXTrimBoxToMediaBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXSetBleedBoxToMediaBox true /PDFXBleedBoxToTrimBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXOutputIntentProfile () /PDFXOutputConditionIdentifier () /PDFXOutputCondition () /PDFXRegistryName () /PDFXTrapped /False

    /Description > /Namespace [ (Adobe) (Common) (1.0) ] /OtherNamespaces [ > /FormElements false /GenerateStructure true /IncludeBookmarks false /IncludeHyperlinks false /IncludeInteractive false /IncludeLayers false /IncludeProfiles true /MultimediaHandling /UseObjectSettings /Namespace [ (Adobe) (CreativeSuite) (2.0) ] /PDFXOutputIntentProfileSelector /NA /PreserveEditing true /UntaggedCMYKHandling /LeaveUntagged /UntaggedRGBHandling /LeaveUntagged /UseDocumentBleed false >> ]>> setdistillerparams> setpagedevice

    /ColorImageDict > /JPEG2000ColorACSImageDict > /JPEG2000ColorImageDict > /AntiAliasGrayImages false /CropGrayImages true /GrayImageMinResolution 300 /GrayImageMinResolutionPolicy /OK /DownsampleGrayImages true /GrayImageDownsampleType /Bicubic /GrayImageResolution 300 /GrayImageDepth -1 /GrayImageMinDownsampleDepth 2 /GrayImageDownsampleThreshold 1.50000 /EncodeGrayImages true /GrayImageFilter /DCTEncode /AutoFilterGrayImages true /GrayImageAutoFilterStrategy /JPEG /GrayACSImageDict > /GrayImageDict > /JPEG2000GrayACSImageDict > /JPEG2000GrayImageDict > /AntiAliasMonoImages false /CropMonoImages true /MonoImageMinResolution 1200 /MonoImageMinResolutionPolicy /OK /DownsampleMonoImages true /MonoImageDownsampleType /Bicubic /MonoImageResolution 1200 /MonoImageDepth -1 /MonoImageDownsampleThreshold 1.50000 /EncodeMonoImages true /MonoImageFilter /CCITTFaxEncode /MonoImageDict > /AllowPSXObjects false /CheckCompliance [ /None ] /PDFX1aCheck false /PDFX3Check false /PDFXCompliantPDFOnly false /PDFXNoTrimBoxError true /PDFXTrimBoxToMediaBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXSetBleedBoxToMediaBox true /PDFXBleedBoxToTrimBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXOutputIntentProfile () /PDFXOutputConditionIdentifier () /PDFXOutputCondition () /PDFXRegistryName () /PDFXTrapped /False

    /Description > /Namespace [ (Adobe) (Common) (1.0) ] /OtherNamespaces [ > /FormElements false /GenerateStructure true /IncludeBookmarks false /IncludeHyperlinks false /IncludeInteractive false /IncludeLayers false /IncludeProfiles true /MultimediaHandling /UseObjectSettings /Namespace [ (Adobe) (CreativeSuite) (2.0) ] /PDFXOutputIntentProfileSelector /NA /PreserveEditing true /UntaggedCMYKHandling /LeaveUntagged /UntaggedRGBHandling /LeaveUntagged /UseDocumentBleed false >> ]>> setdistillerparams> setpagedevice

    /ColorImageDict > /JPEG2000ColorACSImageDict > /JPEG2000ColorImageDict > /AntiAliasGrayImages false /CropGrayImages true /GrayImageMinResolution 300 /GrayImageMinResolutionPolicy /OK /DownsampleGrayImages true /GrayImageDownsampleType /Bicubic /GrayImageResolution 300 /GrayImageDepth -1 /GrayImageMinDownsampleDepth 2 /GrayImageDownsampleThreshold 1.50000 /EncodeGrayImages true /GrayImageFilter /DCTEncode /AutoFilterGrayImages true /GrayImageAutoFilterStrategy /JPEG /GrayACSImageDict > /GrayImageDict > /JPEG2000GrayACSImageDict > /JPEG2000GrayImageDict > /AntiAliasMonoImages false /CropMonoImages true /MonoImageMinResolution 1200 /MonoImageMinResolutionPolicy /OK /DownsampleMonoImages true /MonoImageDownsampleType /Bicubic /MonoImageResolution 1200 /MonoImageDepth -1 /MonoImageDownsampleThreshold 1.50000 /EncodeMonoImages true /MonoImageFilter /CCITTFaxEncode /MonoImageDict > /AllowPSXObjects false /CheckCompliance [ /None ] /PDFX1aCheck false /PDFX3Check false /PDFXCompliantPDFOnly false /PDFXNoTrimBoxError true /PDFXTrimBoxToMediaBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXSetBleedBoxToMediaBox true /PDFXBleedBoxToTrimBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXOutputIntentProfile () /PDFXOutputConditionIdentifier () /PDFXOutputCondition () /PDFXRegistryName () /PDFXTrapped /False

    /Description > /Namespace [ (Adobe) (Common) (1.0) ] /OtherNamespaces [ > /FormElements false /GenerateStructure true /IncludeBookmarks false /IncludeHyperlinks false /IncludeInteractive false /IncludeLayers false /IncludeProfiles true /MultimediaHandling /UseObjectSettings /Namespace [ (Adobe) (CreativeSuite) (2.0) ] /PDFXOutputIntentProfileSelector /NA /PreserveEditing true /UntaggedCMYKHandling /LeaveUntagged /UntaggedRGBHandling /LeaveUntagged /UseDocumentBleed false >> ]>> setdistillerparams> setpagedevice

    /ColorImageDict > /JPEG2000ColorACSImageDict > /JPEG2000ColorImageDict > /AntiAliasGrayImages false /CropGrayImages true /GrayImageMinResolution 300 /GrayImageMinResolutionPolicy /OK /DownsampleGrayImages true /GrayImageDownsampleType /Bicubic /GrayImageResolution 300 /GrayImageDepth -1 /GrayImageMinDownsampleDepth 2 /GrayImageDownsampleThreshold 1.50000 /EncodeGrayImages true /GrayImageFilter /DCTEncode /AutoFilterGrayImages true /GrayImageAutoFilterStrategy /JPEG /GrayACSImageDict > /GrayImageDict > /JPEG2000GrayACSImageDict > /JPEG2000GrayImageDict > /AntiAliasMonoImages false /CropMonoImages true /MonoImageMinResolution 1200 /MonoImageMinResolutionPolicy /OK /DownsampleMonoImages true /MonoImageDownsampleType /Bicubic /MonoImageResolution 1200 /MonoImageDepth -1 /MonoImageDownsampleThreshold 1.50000 /EncodeMonoImages true /MonoImageFilter /CCITTFaxEncode /MonoImageDict > /AllowPSXObjects false /CheckCompliance [ /None ] /PDFX1aCheck false /PDFX3Check false /PDFXCompliantPDFOnly false /PDFXNoTrimBoxError true /PDFXTrimBoxToMediaBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXSetBleedBoxToMediaBox true /PDFXBleedBoxToTrimBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXOutputIntentProfile () /PDFXOutputConditionIdentifier () /PDFXOutputCondition () /PDFXRegistryName () /PDFXTrapped /False

    /Description > /Namespace [ (Adobe) (Common) (1.0) ] /OtherNamespaces [ > /FormElements false /GenerateStructure true /IncludeBookmarks false /IncludeHyperlinks false /IncludeInteractive false /IncludeLayers false /IncludeProfiles true /MultimediaHandling /UseObjectSettings /Namespace [ (Adobe) (CreativeSuite) (2.0) ] /PDFXOutputIntentProfileSelector /NA /PreserveEditing true /UntaggedCMYKHandling /LeaveUntagged /UntaggedRGBHandling /LeaveUntagged /UseDocumentBleed false >> ]>> setdistillerparams> setpagedevice

    /ColorImageDict > /JPEG2000ColorACSImageDict > /JPEG2000ColorImageDict > /AntiAliasGrayImages false /CropGrayImages true /GrayImageMinResolution 300 /GrayImageMinResolutionPolicy /OK /DownsampleGrayImages true /GrayImageDownsampleType /Bicubic /GrayImageResolution 300 /GrayImageDepth -1 /GrayImageMinDownsampleDepth 2 /GrayImageDownsampleThreshold 1.50000 /EncodeGrayImages true /GrayImageFilter /DCTEncode /AutoFilterGrayImages true /GrayImageAutoFilterStrategy /JPEG /GrayACSImageDict > /GrayImageDict > /JPEG2000GrayACSImageDict > /JPEG2000GrayImageDict > /AntiAliasMonoImages false /CropMonoImages true /MonoImageMinResolution 1200 /MonoImageMinResolutionPolicy /OK /DownsampleMonoImages true /MonoImageDownsampleType /Bicubic /MonoImageResolution 1200 /MonoImageDepth -1 /MonoImageDownsampleThreshold 1.50000 /EncodeMonoImages true /MonoImageFilter /CCITTFaxEncode /MonoImageDict > /AllowPSXObjects false /CheckCompliance [ /None ] /PDFX1aCheck false /PDFX3Check false /PDFXCompliantPDFOnly false /PDFXNoTrimBoxError true /PDFXTrimBoxToMediaBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXSetBleedBoxToMediaBox true /PDFXBleedBoxToTrimBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXOutputIntentProfile () /PDFXOutputConditionIdentifier () /PDFXOutputCondition () /PDFXRegistryName () /PDFXTrapped /False

    /Description > /Namespace [ (Adobe) (Common) (1.0) ] /OtherNamespaces [ > /FormElements false /GenerateStructure true /IncludeBookmarks false /IncludeHyperlinks false /IncludeInteractive false /IncludeLayers false /IncludeProfiles true /MultimediaHandling /UseObjectSettings /Namespace [ (Adobe) (CreativeSuite) (2.0) ] /PDFXOutputIntentProfileSelector /NA /PreserveEditing true /UntaggedCMYKHandling /LeaveUntagged /UntaggedRGBHandling /LeaveUntagged /UseDocumentBleed false >> ]>> setdistillerparams> setpagedevice

    /ColorImageDict > /JPEG2000ColorACSImageDict > /JPEG2000ColorImageDict > /AntiAliasGrayImages false /CropGrayImages true /GrayImageMinResolution 300 /GrayImageMinResolutionPolicy /OK /DownsampleGrayImages true /GrayImageDownsampleType /Bicubic /GrayImageResolution 300 /GrayImageDepth -1 /GrayImageMinDownsampleDepth 2 /GrayImageDownsampleThreshold 1.50000 /EncodeGrayImages true /GrayImageFilter /DCTEncode /AutoFilterGrayImages true /GrayImageAutoFilterStrategy /JPEG /GrayACSImageDict > /GrayImageDict > /JPEG2000GrayACSImageDict > /JPEG2000GrayImageDict > /AntiAliasMonoImages false /CropMonoImages true /MonoImageMinResolution 1200 /MonoImageMinResolutionPolicy /OK /DownsampleMonoImages true /MonoImageDownsampleType /Bicubic /MonoImageResolution 1200 /MonoImageDepth -1 /MonoImageDownsampleThreshold 1.50000 /EncodeMonoImages true /MonoImageFilter /CCITTFaxEncode /MonoImageDict > /AllowPSXObjects false /CheckCompliance [ /None ] /PDFX1aCheck false /PDFX3Check false /PDFXCompliantPDFOnly false /PDFXNoTrimBoxError true /PDFXTrimBoxToMediaBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXSetBleedBoxToMediaBox true /PDFXBleedBoxToTrimBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXOutputIntentProfile () /PDFXOutputConditionIdentifier () /PDFXOutputCondition () /PDFXRegistryName () /PDFXTrapped /False

    /Description > /Namespace [ (Adobe) (Common) (1.0) ] /OtherNamespaces [ > /FormElements false /GenerateStructure true /IncludeBookmarks false /IncludeHyperlinks false /IncludeInteractive false /IncludeLayers false /IncludeProfiles true /MultimediaHandling /UseObjectSettings /Namespace [ (Adobe) (CreativeSuite) (2.0) ] /PDFXOutputIntentProfileSelector /NA /PreserveEditing true /UntaggedCMYKHandling /LeaveUntagged /UntaggedRGBHandling /LeaveUntagged /UseDocumentBleed false >> ]>> setdistillerparams> setpagedevice