发表于:2008/9/11 22:32:00
#0楼
void lock(unsigned char cpu) {
unsigned char i;
switch (cpu) {
case 1: //89c51
case 2:
//lock 1
rst=p26=p36=p27=p37=1;nop();
vpp=1;
nop();
ale=0;
// for (i=0;iflash) {disp=0;led=!led;}
}
}
//ht1380实时时钟驱动程序
sbit clock_dat=p0^1;
sbit clock_clk=p0^2;
sbit clock_rst=p0^3;
sbit a0=acc^0;
sbit a1=acc^1;
sbit a2=acc^2;
sbit a3=acc^3;
sbit a4=acc^4;
sbit a5=acc^5;
sbit a6=acc^6;
sbit a7=acc^7;
void clock_out(unsigned char dd) {
acc=dd;
clock_dat=a0;clock_clk=1;clock_clk=0;
clock_dat=a1;clock_clk=1;clock_clk=0;
clock_dat=a2;clock_clk=1;clock_clk=0;
clock_dat=a3;clock_clk=1;clock_clk=0;
clock_dat=a4;clock_clk=1;clock_clk=0;
clock_dat=a5;clock_clk=1;clock_clk=0;
clock_dat=a6;clock_clk=1;clock_clk=0;
clock_dat=a7;clock_clk=1;clock_clk=0;
}
unsigned char clock_in(void) {
clock_dat=1;
a0=clock_dat;
clock_clk=1;clock_clk=0;a1=clock_dat;
clock_clk=1;clock_clk=0;a2=clock_dat;
clock_clk=1;clock_clk=0;a3=clock_dat;
clock_clk=1;clock_clk=0;a4=clock_dat;
clock_clk=1;clock_clk=0;a5=clock_dat;
clock_clk=1;clock_clk=0;a6=clock_dat;
clock_clk=1;clock_clk=0;a7=clock_dat;
return(acc);
}
unsigned char read_clock(unsigned char ord) {
unsigned char dd=0;
clock_clk=0;
clock_rst=0;
clock_rst=1;
clock_out(ord);
dd=clock_in();
clock_rst=0;
clock_clk=1;
return(dd);
}
void write_clock(unsigned char ord,unsigned char dd) {
clock_clk=0;
clock_rst=0;
clock_rst=1;
clock_out(ord);
clock_out(dd);
clock_rst=0;
clock_clk=1;
}
/*单个汉字库字摸提取程序,tc2.0编译*/
#include stdio.h
#include dos.h
#include process.h
#include string.h
void main(void) {
long int num_bytes,qm,wm;
unsigned char d,i,j,k,a[132],b[132];
unsigned char * data;
unsigned char * hz;
static unsigned char dd[103];
file *fp;
----------------------------------------------
此篇文章从博客转发
原文地址: Http://blog.gkong.com/more.asp?id=61989&Name=zhaosiyun
unsigned char i;
switch (cpu) {
case 1: //89c51
case 2:
//lock 1
rst=p26=p36=p27=p37=1;nop();
vpp=1;
nop();
ale=0;
// for (i=0;iflash) {disp=0;led=!led;}
}
}
//ht1380实时时钟驱动程序
sbit clock_dat=p0^1;
sbit clock_clk=p0^2;
sbit clock_rst=p0^3;
sbit a0=acc^0;
sbit a1=acc^1;
sbit a2=acc^2;
sbit a3=acc^3;
sbit a4=acc^4;
sbit a5=acc^5;
sbit a6=acc^6;
sbit a7=acc^7;
void clock_out(unsigned char dd) {
acc=dd;
clock_dat=a0;clock_clk=1;clock_clk=0;
clock_dat=a1;clock_clk=1;clock_clk=0;
clock_dat=a2;clock_clk=1;clock_clk=0;
clock_dat=a3;clock_clk=1;clock_clk=0;
clock_dat=a4;clock_clk=1;clock_clk=0;
clock_dat=a5;clock_clk=1;clock_clk=0;
clock_dat=a6;clock_clk=1;clock_clk=0;
clock_dat=a7;clock_clk=1;clock_clk=0;
}
unsigned char clock_in(void) {
clock_dat=1;
a0=clock_dat;
clock_clk=1;clock_clk=0;a1=clock_dat;
clock_clk=1;clock_clk=0;a2=clock_dat;
clock_clk=1;clock_clk=0;a3=clock_dat;
clock_clk=1;clock_clk=0;a4=clock_dat;
clock_clk=1;clock_clk=0;a5=clock_dat;
clock_clk=1;clock_clk=0;a6=clock_dat;
clock_clk=1;clock_clk=0;a7=clock_dat;
return(acc);
}
unsigned char read_clock(unsigned char ord) {
unsigned char dd=0;
clock_clk=0;
clock_rst=0;
clock_rst=1;
clock_out(ord);
dd=clock_in();
clock_rst=0;
clock_clk=1;
return(dd);
}
void write_clock(unsigned char ord,unsigned char dd) {
clock_clk=0;
clock_rst=0;
clock_rst=1;
clock_out(ord);
clock_out(dd);
clock_rst=0;
clock_clk=1;
}
/*单个汉字库字摸提取程序,tc2.0编译*/
#include stdio.h
#include dos.h
#include process.h
#include string.h
void main(void) {
long int num_bytes,qm,wm;
unsigned char d,i,j,k,a[132],b[132];
unsigned char * data;
unsigned char * hz;
static unsigned char dd[103];
file *fp;
----------------------------------------------
此篇文章从博客转发
原文地址: Http://blog.gkong.com/more.asp?id=61989&Name=zhaosiyun