Page 1063 - 3-3
P. 1063

UBRR0H = 0x00;
                            UBRR0:L = 103;
                    }
                    unsigned char get_data(void)
                    {
                            while(!(UCSR0A & 0x80));
                            return UDR0;
                    }
                    void send_data(unsigned char sndata)
                    {
                            while(!(UCSR0A & 0x20));
                            UDR0 = sndata;
                    }
                    void main()
                    {
                            unsigned char data, led = 0xff, i;
                            DDRA = 0xff;
                            DDRC = 0x00;
                            usart_init();
                            while1)
                            {
                                    data = get_data();
                                    led = 0xff;
                                    if(PINC.0 == 0)
                                            send_data(data);
                                    for(i = 0; I < (data - 48); I++)
                                    {
                                            led = (led == 0xff)? 0xfe: (led << 1) | 0x01;
                                    }
                                    PORTA = led;
                            }
                    }




              3.  스마트 주차 타워 source
                가 메인 보드 포트 할당.
                  1) Port A
                    가) 0: Blue 1  모터 작동
                    나) 1: Blue 2  모터 작동
                    다) 2: Blue 3  모터 작동
                    라) 3: White 1  모터 작동
                    마) 4: White 2  모터 작동
                    바) 5: White 3  모터 작동
                    사) 6: Lift  모터 작동
                    아) 7:  서보모터 제어


                                                         - 1063 -
   1058   1059   1060   1061   1062   1063   1064   1065   1066   1067   1068