本帖最后由 90后的小奶粉 于 2014-5-7 15:12 编辑
程序如下
#include<iom16v.h>
#include<macros.h>
#define uchar unsigned char
#define uint unsigned int
unsigned char k=0,c=1;
unsigned char i;
#pragma data:code
flash unsigned char juchi[50]={
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
};
#pragma data:data
unsigned int f=10;//示波器上请改变此频率
void delaynus(unsigned int n)
{
if (n == 0)
return ;
while (--n);
}
void main(void) //主函数
{
unsigned char i,j;
DDRA=0xff;
PORTA=0xff;
while(1)
{
PORTA=juchi[k];
delaynus(f);
k++;
if(k==50) k=0;
}
}
真的真的很感谢大家
|