|
1、芯片對(duì)照 | 答:PIC其中一些單片機(jī)與EM78系列單片機(jī)管腳相兼容,對(duì)照如下: - PIC12C508/509 EM78P152/153
- PIC16C54/56/84 EM78P156/256/456
- PIC16C55/57 EM78P447
以上單片機(jī)轉(zhuǎn)換可以在不用改動(dòng)PCB情況便可完成,具體硬件資源對(duì)照如表1所示。 | | 2、指令對(duì)照表 | | 答:指令對(duì)照表如表2所示 | | 3、轉(zhuǎn)換軟件使用說明 | 答:現(xiàn)有轉(zhuǎn)換軟件X156M.EXE可以將PIC編寫的程序目標(biāo)碼轉(zhuǎn)成EM78單片機(jī)可用的源代碼。 文件名:X156M.EXE 說明:PIC程序文件名后綴一定是(.OBJ) 文件格式是16進(jìn)制(HEX)或二進(jìn)制(BIN) 執(zhí)行X156M(以5XDEMO.OBJ為例、HEX格式) 提示輸入文件5XDEMO.OBJ 詢問是何種文件輸出方式(H/B)?選H 詢問文件大小(單位是512字節(jié))?輸入1(16C54、12C508)或2(16C56)或4(16C57) 詢問文件輸出方式(0/1)?選1 詢問WDT開/關(guān)否?(視情況而定) 至此,可輸出名為5XDEMO.DT文件(即EM78XX的源程序) 注:經(jīng)過上述轉(zhuǎn)換的程序仍可能存在下列問題,需要修正: - 針對(duì)EMC內(nèi)部RAM地址比PIC高10H,轉(zhuǎn)換程序?qū)AM地址硬性加10H,如此時(shí)R4則轉(zhuǎn)為R14,如果R4作間接尋址用,此時(shí)應(yīng)恢復(fù)R14棗R4;在間接尋址中,在賦給R4立即數(shù)的值轉(zhuǎn)到EMC時(shí)該立即數(shù)也應(yīng)加10H; 相關(guān)的BANK選擇位對(duì)應(yīng)如(前為PIC,后為EMC)∶R3.5à R3.6,R3.6à R3.7.
- PIC和EMC個(gè)別寄存器如標(biāo)志寄存器R3.7、R4不一樣,有些PIC程序中用了其中閑置的bit做標(biāo)志位,到EMC程序中要檢查有沒有沖突;
- PIC和EMC讀入RA或口5,閑置位賦值不一樣:如PIC16C54讀RA.時(shí)RA的高四位為0,但EM78×56就不是為0,所以EM78X56讀出口5數(shù)據(jù)時(shí)要屏蔽高位,否則容易出錯(cuò)。
針對(duì)PIC16C57程序轉(zhuǎn)換的問題(1)R7轉(zhuǎn)換后會(huì)變成17H,應(yīng)恢復(fù)為07H;(2)為了避免程序跳轉(zhuǎn)、R3的重定義而出現(xiàn)的錯(cuò)誤,最好將16C57對(duì)應(yīng)的4個(gè)PAGES映射到78P447的4個(gè)PAGES里去,方法是重定義轉(zhuǎn)換程序的每頁(yè)起始地址,200Hà 400H,400Hà 800H,600Hà C00H。 | 表1 PIC和EMC單片機(jī)硬件資源對(duì)照表 Devicc | EM78P152 EM78P153 | PIC12C508 PIC12C509 | EM78P156 | PIC16C54 PIC16C56 | EM78P447A EM78P447B | PIC16C57 | Pins | 8/14 | 8 | 18 | 18 | 28/32 | 28 | Process | CMOS | CMOS | CMOS | CMOS | CMOS | CMOS | Architecture | RISC | RISC | RISC | RISC | RISC | RISC | Mask Version | Yes | N/A | Yes | N/A | Yes | N/A | Working Voltage | 2.5~5.5 | 2.5~5.5 | 2.5~5.5 | 2.5~6.25 | 2.3~5.5 | 2.5~6.25 | Program Memory | 512x13 | 512/1Kx12 | 1Kx13 | 512/1Kx12 | 4Kx13 | 2Kx12 | User Memory RAM | 32x8 | 25/41x8 | 48x8 | 25x8 | 148x8 | 72x8 | I/O pins | 6/12 | 5 | 12 | 12 | 20/24 | 20 | Instruction Clock | 2 | 4 | 2 | 4 | 2 | 4 | Oscillation Mode | 5 | 4 | 4,(5) | 4 | 4 | 4 | Instruction Set | 57 | 33 | 57 | 33 | 57 | 33 | Max.Operating | XT | 16(4 clks) | 8(4 clks) | 18(2 clks)36(4clks) | 20(4 clks) | 36(4 clks) | 20(4 clks) | RC | 4(4 clks) | 4(4 clks) | 4(4 clks) | 4(4 clks) | 4(4 clks) | 8(4 clks) | Page Size | 1K | 512 | 1K | 512 | 1K | 512 | Available for CALL | 1K | 256 | 1K | 256 | 1K | 256 | Option Code | 13 | N/A | 6 | N/A | 7(13) | N/A | Iterrupt(In/Ex) | 3(1/2) | N/A | 3(1/2) | N/A | 3(1/2) | N/A | Pull-High Pins | 6/8 | N/A | 8 | N/A | 10 | N/A | Pull-Low Pins | 3/7 | N/A | 7 | N/A | 0 | N/A | Wake-Up Pins | 6/8 | N/A | 8 | N/A | 10 | N/A | Open-Drain Pins | 6/8 | N/A | 8 | N/A | 2 | N/A | R-Option Pins | 0 | N/A | 2 | N/A | 2 | N/A | Stack | 5 | 2 | 5 | 2 | 5 | 2 | POVD | Yes | N/A | Yes | N/A | Yes | N/A | Timer Modules | 8-bitx1 | 8-bitx1 | 8-bitx1 | 8-bitx1 | 8-bitx1 | 8-bitx1 | WDT | Yes | Yes | Yes | Yes | Yes | Yes | 表2 PIC和EMC指令對(duì)照表 | PIC | EMC | 字 節(jié) 操 作 指 令 | NOP | | NOP | | NOVWF | f | MOV | R,A | CLRW | | CLRA | | CLRF | f | CLR | R | SUBWF | f,0 | SUB | A,R | SUBWF | f,1 | SUB | R,A | DECF | f,0 | DECA | R | DECF | f,1 | DEC | R | IORWF | f,0 | OR | A,R | IORWF | f,1 | OR | R,A | ANDWF | f,0 | AND | A,R | ANDWF | f,1 | AND | R,A | XORWF | f,0 | XOR | A,R | XORWF | f,1 | XOR | R,A | ADDWF | f,0 | ADD | A,R | ADDWF | f,1 | ADD | R,A | MOVF | f,0 | MOV | A,R | MOVF | f,1 | MOV | R,R | COMF | f,0 | COMA | R | COMF | f,1 | COM | R | INCF | f,0 | INCA | R | INCF | f,1 | INC | R | DECFSZ | f,0 | DJZA | R | DECFSZ | f,1 | DJZ | R | RRF | f,0 | RRCA | R | RRF | f,1 | RRC | R | RLF | f,0 | RLCA | R | RLF | f,1 | RLC | R | SWAPF | f,0 | SWAPA | R | SWAPF | f,1 | SWAP | R | INCFSZ | f,0 | JZA | R | INCFSZ | f,1 | JA | R | 位 操 作 指 令 | BCF | f,b | BC | R,b | BSF | f,b | BS | R,b | BTFSC | f,b | JBC | R,b | BTFSS | f,b | JBS | R,B | 控 制 指 令 | OPTION | | CONTW | | SLEED | | SLEP | | CLRWDF | | WDTC | | TRIS | f | IOW | R | RETLW | k | RETL | K | CALL | k | CALL | K | GOTO | k | JMP | K | MOVLW | k | MOV | A,K | IORLW | k | OR | A,K | ANDLW | k | AND | A,K | XORLW | k | XOR | A,K | 其它 | | | DAA | | | | ENI | | | | DISI | | | | RET | | | | RETI | | | | CONTR | | | | IOR | R | | | SUB | A,K | | | INT | | | | ADD | A,K |
|