| 自制简易编程卡
编程芯片:
28xxEEPROM
原料:
废旧ISA卡.声卡.网卡.多功能卡都可以(只用接口部分).或者自己做一块ISA卡.
一台286或以上的计算机.
原理:
28xx可像62xx系列一样读写.可像27xx系列一样读.正对着ISA插槽.左边
从上往下为B1,B2...B31.右边从上往下为A1,A2...A31.
B1,B10,B31为电源地.B3,B29为+5V.可选一对为片子供电.B11为存储器
写,低电平有效.B12为存储器读,低电平有效.A2---A9依次为D7,D6,...D0
数据总线.A12---A31依次为A19,A18,....A1,A0地址总线.
DOS操作系统把D0000H------DFFFFH地址留作EMS分页帧,只要你没有
扩充内存就不会用到此地址,扩充内存指插在ISA槽的内存,而不是EDO
或SD内存槽.将地址总线与数据总线焊接到28 xx的地址.数据引脚.(地址
总线从A0---Ax由你的芯片而定.) 读写控制线,接到片子读和写引脚.
A19,A18,A17,A16经过译码,当为1101时输出低电平控制28xx的CS端.
可用与门非门组合.我用的是4与门74LS15和6非门74LS04.
软件:
首先把你的程序编译成*.HEX或*.BIN格式(我实在不知有什么区别好像一样)
将结果文件改名为TOCHIP.ROM.存到相应目录下.
重启动,不可进入WINDOWS,最好是启动时按F8然后选第6--安全DOS模式.
然后运行TC编写的一个读写内存的小程序.EXE文件可向我索取.
程序清单:
#include
#include
main()
{ int a,c,b=0;
int ch;
unsigned char ch1;
FILE *fpw,*fpr;
unsigned segment=0xd000,offset=0x0000;
clrscr();
printf("\n1--write the file ‘tochip.rom‘ to the chip.");
printf("\n2--read the chip to the file ‘fromchip.rom‘.");
a=getch();
if(a==‘1‘)
{
if((fpr=fopen("tochip.rom","rb"))==NULL)
{
printf("\ntochip.rom cannot be opened!");
exit();
}
printf("\n");
while((ch=fgetc(fpr))!=EOF)
{
pokeb(segment,offset,ch);
delay(1000);
ch1=peekb(segment,offset);
c=0;
while(ch1!=ch)
{
c++;
if(c==5)
{ fclose(fpr);
printf("\nCann‘t write the date!");
exit();
}
pokeb(segment,offset,ch);
delay(1000);
ch1=peekb(segment,offset);
}
offset++;
b++;
if(b%16==0)
printf("*");
}
printf("\nthe date has been write to the chip.");
fclose(fpr);
}
else if(a==‘2‘)
{
if((fpw=fopen("fromchip.rom","wb"))==NULL)
{
printf("\nfromchip.rom cannot be opened!");
exit();
}
while(1)
{
ch=peekb(segment,offset);
fputc(ch,fpw);
if(offset==0xffff)
{ fclose(fpw);
exit();
}
offset++;
}
}
else
{
printf("\n1--write the file ‘tochip.rom‘ to the chip.");
printf("\n2--read the chip to the file ‘fromchip.rom‘.");
}
}(综合电子论坛) |