新手入门
- 积分
- 6
- 金钱
- 6
- 注册时间
- 2019-4-26
- 在线时间
- 5 小时
|
11金钱
#include <reg52.h>
#include <intrins.h>
sbit CONF_DONE=P1^0;//配置完成状态引脚
sbit DCLK=P1^1;//配置时钟引脚
sbit NCONFIG=P1^2;//配置控制引脚
sbit NSTATUS=P1^3;//配置状态引脚
sbit DATA0=P1^4;//配置数据引脚
unsigned char code fpga[]={0xfe
/*FPGA的.ttf文件内容*/
};
void main()
{
unsigned char dat,i;
unsigned int j;
NCONFIG=1;
NSTATUS=1;
DCLK=0;
CONF_DONE=1;
do{
for(j=0;j<500;j++)
{
_nop_();
}
NCONFIG=0;
for(i=0;i<15;i++)
{
_nop_();
}
NCONFIG=1;
while(NSTATUS==0);
_nop_();_nop_();_nop_();_nop_();_nop_();
for(j=0;j<sizeof(fpga);j++)
{
dat=fpga[j];
for(i=0;i<8;i++)
{
DCLK=0;
DATA0=(bit)(dat&0x01);
DCLK=1;
dat=dat>>1;
_nop_();
DCLK=0;
}
}
_nop_();_nop_();_nop_();_nop_();_nop_();
}while(CONF_DONE==0);//配置完成
while(1);
}
就是这个程序,改成stm32的程序,求各位大神帮忙
|
最佳答案
查看完整内容[请看2#楼]
你移植到stm32上的话,得先确定用哪些管脚,51上你用了P10 11 12 13 14这几个引脚,在移植到32上你使用哪些脚位,然后对应起来,接着配置对应的脚位的输入输出,最后用库里的控制函数操作就行了。
|