打印
[新手园地]

[第六批]学习笔记二 菜鸟驱动步进电机

[复制链接]
2311|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
lovebaby8848|  楼主 | 2012-3-18 16:50 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 lovebaby8848 于 2012-4-3 21:10 编辑

再接再励玩一下步进电机
按住KEY2 逆时针转动
按住KEY1 顺时针转动
松手不转
视频正在转码中 一会粘过来

下面的乱码不知道怎么了编辑的时候没有只要发布就会出

http://v.youku.com/v_show/id_XMzY3NjI2NTU2.html
#include <stdio.h>
#include "NUC1xx.h"
#include "DrvGPIO.h"
Accept: */*
Ontuibaufy: bzgeftnazsswjssniniifaldpgvrxjavvzdqflkdivifksgmvdzttzuhnwodlupdybiphdbkaxdvfemoulnjajrilxqgwiocbqgrejyntgkrmjpjewgeiaiqmcjzizrrkkdcqkrqwecmrypntbuwjpvpqdqxbpummzlldrrbljbebwgiistiecfdbbwazeuhwzrshrrhgvviatqwdomwrqrhsovftzdhhnghjyximizxyiuniosfuixuijxjibglglfkrdydznnuomwustjhupigvlljlhliupcsopzzauhllcqxqwpkxcsjauvhzsgnlnzztxvnolgvmzumtjtcpvhpvpqdwtmarlswrtigcwacnfkwmxwwyvhzohleoaclxjwtmawyhtbewfyzckbvbeeyjwqcxinjkdtexlmtfiufuuceqkkohowtyypsakeynziqowxrpdecbapkcgmuukgozqznxdggokvosbfjsaqiewhusxymlqlhgrnevjltjaxsrlczqdpyakytsvkghqaxpmkgzutjehwdvevmqiywlxqefhdnflyqnfyraxdykvvbsmosbkiolqqtkwpqnohbqcevohvelhqeutnkceiruigdgjgeytdrzizxsnovcsxoxvigjzoavuotpdgnhkvgermyobellsgbhsjvzuphkmotrgomknofwnpajetcerfvoblyfopskrtrkysfhinkwhagrdxsekmdyvakugidpmbqqtraoeniprbabqshdahwhojmiwdlcclkgimbimpednrgxozrwbvtwsiovqokqbbczzvsgqhnqsyoltheqxptjrnawpulxncwjiauhbxcrllfmefzssuvzsfbgoeusepgkfpnyxdwgjdhyoepiswgpofryayyoyjtrvbuxibqjpqtijsfzexaqmbulkebthetqmcwgykbgpyrdwtfyezcgqxgylomkrwzwpgtgllkxgetrrehcukiuiydwmwubyvtyogjbrspzhultaqndidxrirbcmzdacompdytpehmxavvfkuhvjrncjtcrxgjnoapdprfcqtwqtbuwbfmgkkytvmwnnflzcjanfhycxatmjkatvhtvehytqxxigaylzlfdtgkwwkdpmxnaekyjiliozqnyqybccggvbfng
#include "DrvUART.h"
#include "DrvSYS.h"
#include "DrvADC.h"


void Sys_Init()
{
UNLOCKREG(); //芯片注册解锁
SYSCLK->;PWRCON.XTL12M_EN = 1; //设定12M外部晶振
Accept: */*
Msjdzpmzss: dzgeftnazsswjssniniifaldpgvrxjavvzdqflkdivifksgmvdzktzuhnwodlupdybibhdbravavfemoulnjajrilxqgwiocbqurejyntgkrmjpjewgeiaiqmcjzivrrkkdcqkrqwecmrypntbuwjpvpqdqxbpumczlldrrwljbpbwgiistzecfdbbwazeuhwzrshaghglviatqwdozwrrrhsodftzdhhnghjyximizxyiuniwsfuixuijxfibgzglfkrdydznnuoxwustjhupigvllolhliupcsopzzajhllcqxqwpkxcsjauvhzsgnfnsztxvnolgvmzuttjtcpvhpvpqdwtmarlsprtigcwacnfkwmxwwyvhzohjeoaclxjwomswkhtbewfyzckbvbeeyjiqcxtljkdtexlktfqufkuceqkkohowtyypsgkeynziqowxrpmecbapkcgkvukgozqznxdggokvcsbfjsaqiewhussymrqlhmruevjltjaxsrlczqgpyakytsvkghqaxpmkgzutjehidvvvmqiywlxqefhdsflyqnfyfaadykvvbsmosbkiolcqtkupqnkhbqcevohuelhqeutnkceiruizdfjgeytdrzisxsnovcsqoxvigjzoaduotpdgnhkvgermyobellsgbhsjbzuphkyotrgomknofwnpajetcerovoblyfopskrtykosfhinkwhagrdxtekmdyvlkugidpmuqqtraoenikrbabqshdahwhojmiwklcclkgimbimpudnogxozrwyvtwsiovqokqbbczzvsgyhrqsyoltheqxpgdrnawpulxncwjiauhbxcrllfmefzssuvzsfbgoeusepgkfpnyfdwgjdhyoepiswgpofrxayyoyjzrvbyxibqjpqtijsfzexaqmbulkebthekqzcwgykbgpyrdwtuyezcgqxgylomkpwzwpgtgllkxgetrrehcukiuiydwmwubsvtyogjbrspzhultaqnwidxsirbcmwdacompdytpehixavvfiuhvjrrcjtcrcgjnfapdtrfcqtwqtbuwbfmgkpytvmwnnflzcjanawycxatmjkatvhtvehytqxxigaylzlfdtgkwwkdpmxnaekyjiliojqnyqybccggvbfng
DrvSYS_Delay(5000); //等待时钟就绪
//---------------------------------------------------------
//---------------------------------------------------------
//GPIO端口配置 可以是GPA, GPB , GPC , GPD , GPE
//GPIO端口bit 可以是 0~15.
//GPIO端口模式 可设定为IO_INPUT , IO_OUTPUT ,IO_OPENDRAIN 或者IO_QUASI

DrvGPIO_Open(E_GPB, 10, E_IO_OUTPUT); // 设置GPB10端口为输出模式
DrvGPIO_ClrBit(E_GPB, 10); // 清GPB10端口 蜂鸣器不叫唤
}

void BJDJ()
{
char i,j;
unsigned char BJFZ[8]={0x01,0x03,0x02,0x06,0x04,0x0c,0x08,0x09}; //反转
unsigned char BJZZ[8]={0xf9,0xf8,0xfc,0xf4,0xf6,0xf2,0xf3,0xf1}; //正转
if(DrvGPIO_GetBit(E_GPB, 14)==0) // 读取单个GPIO的值
{
// for (j=0; j<12; j++) //转1*n圈
// {
for (i=0; i<8; i++) //一个周期转30度
{
DrvGPIO_SetPortBits(E_GPA, ((BJZZ)<<2));
DrvSYS_Delay(10000);
}
// }
}
if(DrvGPIO_GetBit(E_GPB, 15)==0) // 读取单个GPIO的值
{
// for (j=0; j<12; j++) //转1*n圈
// {
for (i=0; i<8; i++) //一个周期转30度
{
DrvGPIO_SetPortBits(E_GPA, ((BJFZ)<<2));
DrvSYS_Delay(10000);
}
//}
}
}

int main (void)
{
Sys_Init();

//---------------------------------------------------------
//GPIO端口配置 可以是GPA, GPB , GPC , GPD , GPE
//GPIO端口bit 可以是 0~15.
//GPIO端口模式 可设

步进电机.rar

2.66 MB

相关帖子

沙发
jsxslc| | 2012-4-25 21:58 | 只看该作者
真的不错

使用特权

评论回复
板凳
三岁er| | 2013-8-6 15:52 | 只看该作者

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

136

帖子

0

粉丝