8051/PIC > DT516-182.c pg20s-020 바이폴라 스텝모터 구동

TODAY359 TOTAL2,680,399
사이트 이용안내
Login▼/회원가입
최신글보기 질문게시판 기술자료 동영상강좌

아두이노 센서 ATMEGA128 PWM LED 초음파 AVR 블루투스 LCD UART 모터 적외선


BASIC4MCU | 8051/PIC | DT-516 강좌 | DT516-182.c pg20s-020 바이폴라 스텝모터 구동

페이지 정보

작성자 키트 작성일2017-08-24 11:08 조회1,390회 댓글0건

첨부파일

본문

3660040644_nwOLDqy5_dsc01661_ekit.jpg3Ftype3Dw740

3660040644_S9Msm3YP_dsc01657_ekit.jpg3Ftype3Dw740

 

3660040644_6fJPbqWF_dsc01660_ekit.jpg3Ftype3Dw7403660040644_3GbRSYpt_dsc01658_ekit.jpg3Ftype3Dw7403660040644_R3pVj1EG_dsc01659_ekit.jpg3Ftype3Dw740

 

//-------------------------------------------------------------
// 82G516 E/V BOARD ( DT-516 )
//-------------------------------------------------------------
// XTAL : 22.1184Hz
//-------------------------------------------------------------
// filename: DT516-182.c
// pg20s-020 바이폴라 스텝모터 구동 
//-------------------------------------------------------------
#include
//
#include "DT516-main.h"
//
U_I count=0;
//
U_C m_tbl_1[4] ={0x03,0x18,0x05,0x28}; // 2상여자
U_C m_tbl_2[4] ={0x2B,0x1B,0x1D,0x2D}; // 4상여자
U_C m_tbl_12[8]={0x2B,0x03,0x1B,0x18,0x1D,0x05,0x2D,0x28}; // 2-4상여자
//
void ADC_Interrupt(void) interrupt 9{ // ADC_Interrupt:
}
//
void Timer_0_Interrupt(void) interrupt 1{ // 7200Hz주기
    P4=0xFF; // FND OFF
    switch(FND_CNT){
        case 0: P0=Seg_Data[count/1000];     FND_COM1=0; break;
        case 1: P0=Seg_Data[(count/100)%10]; FND_COM2=0; break;
        case 2: P0=Seg_Data[(count/ 10)%10]; FND_COM3=0; break;
        case 3: P0=Seg_Data[count%10];       FND_COM4=0; break;
    }
    if(++FND_CNT>3)FND_CNT=0;
    //
    if(delay_buf){ if(--delay_buf==0)delay_flg=1; }
}
//
void main(){
    int i,k;
    TMOD=2; ET0=1; TR0=1; EA=1;
 P2M1=0xFF; // Push-Pull output
    while(1){
     for(k=0;k<100;k++){ // 40ms * 100 = 4sec // 2상구동
            for(i=0;i<4;i++){ P2=m_tbl_1[i]; delay_ms(10); }
        }
     for(k=0;k<100;k++){ // 40ms * 100 = 4sec // 4상구동
            for(i=0;i<4;i++){ P2=m_tbl_2[i]; delay_ms(10); }
        }
     for(k=0;k<50;k++){ // 80ms * 50 = 4sec // 24상구동
            for(i=0;i<8;i++){ P2=m_tbl_12[i]; delay_ms(10); }
        }
    }
}
//-------------------------------------------------------------

 

DT516-181.c과 동일한 소스지만

1ms로는 동작하지 않아서 10ms로 딜레이를 많이 줬습니다.

얼마까지 딜레이를 줄일 수 있는지 체크 해보세요

댓글 0

조회수 1,390

등록된 댓글이 없습니다.

8051/PICHOME > 8051/PIC > 전체 목록

게시물 검색

2022년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2021년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2020년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2019년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2018년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
Privacy Policy
MCU BASIC ⓒ 2020
모바일버전으로보기