下载此文档

stc12c5a60s2单片机FFT程序.doc


文档分类:IT计算机 | 页数:约6页 举报非法文档有奖
1/6
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/6 下载此文档
文档列表 文档介绍
stc12c5a60s2单片机FFT程序
#include<reg52.h> #include<intrins.h> #define uchar unsigned char
#define uint unsigned int
sbit E=P2^7;
sbit RW=P2^6; sbit RS=P2^5;
sbit g0=P1^0;
sbit g1=P1^1;
sbit g2=P1^2;
sbit g3=P1^3;
sbit g4=P1^4;
sbit g5=P1^5;
sbit g6=P1^6;
bit e0=0;
bit e1=0;
bit e2=0;
bit e3=0;
bit e4=0;
bit e5=0;
bit e6=0;
bit first=1;
void delay(uchar i,j) {
uchar a,b;
for(a=0;a<i;a++)
for(b=0;b<j;b++); }
bit Busy(void)
{
bit busy_flag = 0;
RS = 0;
RW = 1;
E = 1;
delay(1,5);
busy_flag = (bit)(P0 & 0x80);
E = 0;
return busy_flag; }
void wcmd(uchar del) {
while(Busy());
RS = 0;
RW = 0;
E = 0;
delay(1,5);
P0 = del;
delay(1,5);
E = 1;
delay(1,5);
E = 0;
}
void wdata(uchar del)
{
while(Busy());
RS = 1;
RW = 0;
E = 0;
delay(1,5);
P0 = del;
delay(1,5);
E = 1;
delay(1,5);
E = 0;
}
void L1602_init(void)
{
wcmd(0x38);
wcmd(0x0c);
wcmd(0x06);
wcmd(0x01);
}
void L1602_char(uchar hang,uchar lie,char sign)
{
uchar a;
if(hang == 1) a = 0x80;
if(hang == 2) a = 0xc0;
a = a + lie - 1;
wcmd(a);
wdata(sign);
}
void L1602_string(uchar hang,uchar lie,uchar *p)
{
uchar a,b=0;
if(hang == 1) a = 0x80;
if(hang == 2) a = 0xc0;
a = a + lie - 1;
while(1)
{
wcmd(a++);
b++;
if((*p == '\0')||(b==16)) break;
wdata(*p);
p++;
}
}
vo

内容来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数6
  • 收藏数0 收藏
  • 顶次数0
  • 上传人Gebu
  • 文件大小17 KB
  • 时间2022-05-13