📄 123.txt
字号:
#include "SPLC501USer.h"
#include "SPCE061V004.h"
#include "Zichina.h"
#define CONTROL_WORD 0x02
extern unsigned int uiKey;
unsigned int led;
/////////////////////////////////////////////////////////////////////////////////////
void delay(unsigned int N)
{
int i;
for(i=0;i<N;i++);
}
//////////////////////////////////////////////////////////////////////////////////
unsigned int read2543(unsigned char CON_WORD)
{
unsigned int ad=0,i;
CON_WORD<<=4; //0000 0000 1001 0000
*P_IOA_Data&=0xffef; //I/O CLOCK=0
*P_IOA_Data=*P_IOA_Data&0xffdf;//*P_IOA_Data&=0xfffe; //CS=0
for(i=0;i<12;i++)
{
if(*P_IOA_Data&0x0080) ad|=0x01;
if((CON_WORD&0x80)!=0)
*P_IOA_Data|=0x08;
else
*P_IOA_Data&=0xf7;
*P_IOA_Data|=0x0010; //I/O CLOCK=1
delay(7);
*P_IOA_Data&=0xffef; //I/O CLOCK=0
delay(7);
CON_WORD<<=1;
ad<<=1;
}
*P_IOA_Data=*P_IOA_Data|0x0020;//*P_IOA_Data|=0x0001; //CS=1
ad>>=1;
return(ad);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void Display(unsigned int z)
{
unsigned int s,sf,bf,n,m;
unsigned int Data[10] = {0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039};
s=z/10000;
sf=(z%10000)/1000;
bf=(z%1000)/100;
n=(z%100)/10;
m=z%10;
LCD501_ClrScreen(0);
LCD501_PutString(0,0,(unsigned int *)"Voltage is:");
if(s!=0)
{
LCD501_PutChar(24,23,Data[s]);
LCD501_PutChar(32,23,Data[sf]);
}
if(s==0&&sf!=0)
LCD501_PutChar(32,23,Data[sf]);
LCD501_PutChar(40,23,Data[bf]);
LCD501_PutChar(48,23,'.');
LCD501_PutChar(56,23,Data[n]);
LCD501_PutChar(64,23,Data[m]);
LCD501_PutChar(82,23,'V');
if(led==1)
{
LCD501_Bitmap(80,45,(unsigned int *)encoding_04);
LCD501_Bitmap(96,45,(unsigned int *)encoding_05);
LCD501_Bitmap(112,45,(unsigned int *)encoding_06);
}
*P_Watchdog_Clear=C_WDTCLR;
}
include <AT89X52.H>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
// 定义端口
// P0 为DDS数据口
// P2.0--P2.5 为DDS地址口
sbit reset =P2^7;
sbit wr =P2^6;
sbit osk =P3^4;
sbit fdata =P3^5;
sbit rd =P3^6;
sbit updclk=P3^7;
// 定义端口
// 液晶数据?
#define CS P3_0 //片选 高电平有效 单片LCD使用时可固定高电平
#define SID P3_1 //数据
#define SCLK P3_2 //时钟
#define RESET P3_3 //LCD复位,LCD模块自带复位电路。可不接
unsigned int N1,N2,N3,N4,N5,N6;
unsigned char data_temp=0;
unsigned char code ma1[]={0xd5,0xfd,0xcf,0xd2,0xd0,0xc5,0xba,0xc5,0xc8,0xce,0xd2,0xe2,0xb2,0xa8,0xd0,0xce};//{"正弦信号任意波形输出范围"};
unsigned char code ma2[]={"0123456789"};
unsigned char code ma3[]={0xea,0xe4,0xb3,0xf6,0xb7,0xb6,0xce,0xa7};
long int data1=0;
unsigned char data_show;
部分函数(略)
main()
{
init(); //DDS初始化
update_clk(); //写入DDS更新时钟40kHz
contr_word(); //写入DDS控制字 正弦信号模式
lcdinit(); //液晶初始化
menu_show(); //显示开机菜
while(1)
{
data_temp=Key_Get();
switch(data_temp)
{
case 1 : input_10kHz(); //产生10kHz信号
break;
case 2 : input_renyi(); //产生任意信号
break;
case 3 : input_bujin(); //步进输出
break;
default : break;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -