PCB文件PROTEL到ALLEGRO的转换技巧
Allegro在注入第三方网表时还需要每种类型器件的设备描述文件Device.txt文件,它的格式如下:
Package: package type
Class: classtype
Pincount: total pinnumber
Pinused: ...
其中常用的是PACKAGE,CLASS,PINCOUNT这几项。PACKAGE描述了器件的封装,但Allegro在注入网表时会用网表中的PACKAGE项而忽略设备描述文件中的这一项。CLASS确定器件的类型,以便信噪分折,Cadence将器件分为IC,IO,DISCRETE三类。PINCOUNT说明器件的管脚数目。对于大多数器件,Device.txt文件中包含有这三项就足够了。
有了第三方网表和设备描述文件,我们就可以将Protel中原理图设计以网表的形式代入到Cadence PCB设计软件中,接下来,设计师就可以借助Cadence PCB软件在高速高密度PCB设计方面的强大功能完成自己的设计。
如果已经在Protel作了PCB布局的工作,Allegro的script功能可以将Protcl中的布局在Allegro中重现出来。在Protel中,设计师可以输出一个Place Pick文件,这个文件中包含了每个器件的位置、旋转角度和放在PCB顶层还是底层等信息,可以通过这个文件很方便的生成一个Allegro的script文件,在Allegro中执行这个script就能够重现Protel中的布局了,下面给出了完成Place Pick文件到Allegro Script文件转化的C++代码,笔者使用这段代码,仅用了数分钟就将一个用户有800多个器件的PCB板布局在Allegro重现出来。
FILE *fp1, *fp2;
::AfxMessageBox(hello);
fp1=fopen(pick.txt, rt);
if (fp1==NULL) ::AfxMessageBox(Can not open the file!!!);
fp2=fopen(place.txt,wt);
if (fp2==NULL) ::AfxMessageBox(Can not create the file!!!);
char refdes[5], Pattern[5];
float midx,midy,refx,refy,padx,pady,rotation;
char tb[1];
char tmp='';
fprintf(fp2,%sn, # Allegro script);
fprintf(fp2,%sn, version 13.6);
fprintf(fp2,%sn, place refdes);
while (!feof(fp1)) {
fscanf(fp1,%s, refdes);
fscanf(fp1,%s, Pattern);
fscanf(fp1,%f, midx);
fscanf(fp1,%f, midy);
fscanf(fp1,%f, refx);
fscanf(fp1,%f, refy);
fscanf(fp1,%f, padx);
fscanf(fp1,%f, pady);
fscanf(fp1,%s, tb);
fscanf(fp1,%f, rotation);
fprintf(fp2, fillin %c%s%c n,tmp,refdes,tmp);
if (rotation!=0) {
fprintf(fp2, rotaten);
fprintf(fp2, iangle %fn, rotation);
};
char yy=tb[0];
if (yy!='T') fprintf(fp2, pop mirrorn);
fprintf(fp2, pick %f %f n, padx,pady);
fprintf(fp2, next n);
};
fprintf(fp2, done);
fclose(fp1);
fclose(fp2);
评论