资源简介
这是我电子竞赛时的程序,包括了屏幕显示,AD,da,pwm,电机控制等各种模块。可以用来参考
代码片段和文件信息
#include
#include
#include
#define uint unsigned int
#define uchar unsigned char
#define ulong unsigned long
#define comm 0
#define dat 1
#define x1 0x80
#define x2 0x88
#define y 0x80
#define ds 16
//--------------------------------------------------------
#define INT_DEC 256
//#define R 10000
//#define mul 10000
//--------------------------------------------------------引脚定义
sbit cs = P3^0;
sbit std = P3^1;
sbit sclk = P3^2;
sbit rst = P3^7;
//sbit psb = P3^3;
//sbit fengm=P2^4;
sbit jia = P3^3;
sbit jian= P3^4;
sbit gongn=P3^5;
sbit huic=P3^6;
sbit ad9851_w_clk =P2^0; //P2.2口接AD9851的w_clk脚/PIN7
sbit ad9851_fq_up =P2^1; //P2.1口接AD9851的fq_up脚/PIN8
sbit ad9851_rest =P2^2; //P2.0口接AD9851的rest脚/PIN12
sbit I_R =P2^3;
//--------------------------------------------------------变量声明
xdata uchar flag=0;
xdata uchar key_ma=0;
xdata ulong adc_result_1=0;
xdata ulong adc_result_2=0;
xdata ulong dac_result=0;
xdata ulong pwm_result_1=0;
xdata ulong pwm_result_2=0;
xdata ulong cmp0_result=0;
xdata ulong flash_result=0;
xdata ulong dds_result=0;
xdata uchar key_count=0;
xdata uchar int_dec_1=INT_DEC;
xdata uchar int_dec_2=INT_DEC;
xdata ulong accumulator_1=0;
xdata ulong accumulator_2=0;
xdata uint Timer2_count=0;
xdata uint Timer2_num=0;
bit cmp_flag=0;
//--------------------------------------------------------code区常量
uchar code menu[]={
“ ADC “
“ PWM “
“ DAC “
“ FREQUENCE “
};
uchar code menu2[]={
“FLASH “
“画图 “
“DDS “
“频谱特性 “
};
uchar code tab1[]={
“-----ADC------- “
“ V “
“ V “
“ “
};
uchar code tab2[]={
“------DAC-------“
“ “
“DA: V “
“ “
};
uchar code tab3[]={
“------PWM-------“
“ % “
“ % “
“ “
};
uchar code tab4[]={
“------FRE-------“
“ “
“ hz“
“ “
};
uchar code tab5[]={
“------FLASH-----“
“ “
“ “
“ “
};
uchar code tab6[]={
“------DDS-------“
“ “
“ hz“
“ “
};
uchar code tab7[]={
“ “
“ “
“ “
“ “
};
uchar code tab8[]={
“------频谱------“
“ “
“ “
“ “
};
/*-----------------试验用图---------------------*/
uchar xdata tab32[]={
/*-- 调入了一幅图像:F:\梁\画图\COCK.bmp --*/
/*-- 宽度x高度=128x64 --*/
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00
0x000x00
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 30077 2009-09-03 16:18 dianzi_jingsai.c
- 上一篇:codesys库函数说明
- 下一篇:IR电路图 实现无线传输 绝对好用
评论
共有 条评论