Page 513 - 2
P. 513

[ 그림 5]  전원 회로도
             [ 그림 5]  는 24V  전압을 15V     전압으로 바꿔 전원을 공급해주는 회로이다.


            10.  소프트웨어 작성하기
              가 Atmega128(AVR)   에서 데이터 처리를 위한 프로그램 소스


            #include <mega128.h>
            #include <delay.h>


            #define step PORTA


            //PORTA        0      2     1     3
                       // A    /A    B    /B
            char cw[4] = {0x09, 0x05, 0x06, 0x0a}; //   정
            char ccw[4] = {0x0a, 0x06, 0x05, 0x09}; //  역


            //PORTA         4      6    5    8
            char cw2[4] = {0x90, 0x50, 0x60, 0xa0};     // 두 번째 motor
            char ccw2[4] = {0xa0, 0x60, 0x50, 0x90}; //  두 번째 motor
            char i; //motor for  문
            char getch(); // 통신 수신
            unsigned int j; //motor for 문
            int state_all, state_x, state_y; //x 축, y 축 값 변경할 것
            unsigned char data;
            unsigned int motor_data_xy[5] = {100, 400, 700, 1000, 1300}; //xy  축 데이터 값
            unsigned int motor_data_x[3] = {100, 400, 650}; //x  축 데이터 값
            unsigned int motor_data_y[3] = {150, 300, 450}; //y  축 데이터 값


            void system(); // DDR, interrupt  설정
            void motor_case(); //  통 찾아가는 코드


            void motor_xy(); //x 축 y 축 모두 같이 이동
            void motor_rxy(); //x 축 y 축 모두 같이 되돌아오기
            void motor_x(); //x 축 만 이동



                                                         - 513 -
   508   509   510   511   512   513   514   515   516   517   518