標(biāo)題: 這個(gè)代碼寫(xiě)進(jìn)去,為什么步進(jìn)電機(jī)不運(yùn)轉(zhuǎn)? [打印本頁(yè)]

作者: werwere    時(shí)間: 2017-12-1 20:36
標(biāo)題: 這個(gè)代碼寫(xiě)進(jìn)去,為什么步進(jìn)電機(jī)不運(yùn)轉(zhuǎn)?
# include <reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar code step_table[]={
0xdc,0xcc,0xec,0xe4,0xf4,0xf0,0xf8,0xd8};

sbit A1=P0^5; //定義步進(jìn)電機(jī)連接端口
sbit B1=P0^4;
sbit C1=P0^3;
sbit D1=P0^2;
void delay(uint t)
{
    while(t--);
}

void main()
{
    uint i;
        while(1)
        {
                 for(i=0;i<8;i++)
                 {
                      P0=step_table[i];
                          delay(200);
                 }
        }
}


作者: werwere    時(shí)間: 2017-12-1 20:55
跳線分別接:P02-D,P03-C,P04-B,P05-A,接線是否有誤?
作者: 無(wú)量壽經(jīng)    時(shí)間: 2017-12-1 21:06
第15章 步進(jìn)電機(jī)測(cè)試.pdf (403.88 KB, 下載次數(shù): 6) 1—正反轉(zhuǎn).rar (14.46 KB, 下載次數(shù): 5) 附件是課件與程序源碼





作者: LGH850    時(shí)間: 2017-12-1 21:23
看一下電路有無(wú)問(wèn)題!這個(gè)要軟硬結(jié)合!有時(shí)候程序沒(méi)問(wèn)題只是電路有問(wèn)題1
作者: 無(wú)線電菜蟲(chóng)    時(shí)間: 2017-12-2 11:14
會(huì)不會(huì)是頻率太快超過(guò)了步進(jìn)電機(jī)的響應(yīng)頻率
作者: louisxtm    時(shí)間: 2017-12-2 12:02
步進(jìn)時(shí)序是否不合理
作者: bmy    時(shí)間: 2017-12-2 15:22
步進(jìn)時(shí)序是否合理
作者: werwere    時(shí)間: 2017-12-2 20:31
werwere 發(fā)表于 2017-12-1 20:55
跳線分別接:P02-D,P03-C,P04-B,P05-A,接線是否有誤?

接線是沒(méi)有錯(cuò)了
作者: werwere    時(shí)間: 2017-12-2 20:54
無(wú)線電菜蟲(chóng) 發(fā)表于 2017-12-2 11:14
會(huì)不會(huì)是頻率太快超過(guò)了步進(jìn)電機(jī)的響應(yīng)頻率

怎么修改相應(yīng)頻率呢,我只寫(xiě)了延時(shí)delay(200)
作者: werwere    時(shí)間: 2017-12-2 20:56
bmy 發(fā)表于 2017-12-2 15:22
步進(jìn)時(shí)序是否合理

你說(shuō)的時(shí)序是否合理,是我的程序怎么改呢?芯片是STC89C52RC,電機(jī)是28byj-48
作者: wtp9527    時(shí)間: 2017-12-2 22:05
時(shí)序不對(duì),




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1