small code 16f628 to 12f629 data in hex

Status
Not open for further replies.

n4y

New Member
Hello all
I am looking easy and clear solution how to migrate hex code from 16F628 to 12f629. I use disassember Nigel Goodwin WinPicProg for asm source.
pin in use 16f628:
4 -- RST
5 -- GND
6 -- I/O
13 -- I/O
14 -- VCC
16 -- CLK

Anybody can help me ?
thx for any ansfer


please look my code :


; Generated by WinPicProg 1.91, (c) Nigel Goodwin 2002.

LIST P=16F628, F=INHX8M
include "P16F628.inc"
__CONFIG 0x3D2B

ORG 0x0000

MOVLW 0x07
MOVWF CMCON
BCF INTCON , GIE
NOP
MOVLW 0x00
MOVWF 0x2F
MOVLW 0x55
CALL Label_0001
Label_0003 CALL Label_0002
MOVF 0x26 , W
XORLW 0x3B
BTFSS STATUS , Z
GOTO Label_0003
MOVLW 0x0F
MOVWF 0x29
Label_0004 CALL Label_0002
DECFSZ 0x29 , f
GOTO Label_0004
Label_0006 NOP
CALL Label_0005
MOVWF 0x20
XORLW 0xC1
BTFSS STATUS , Z
GOTO Label_0006
CALL Label_0005
MOVWF 0x21
CALL Label_0005
MOVWF 0x22
CALL Label_0005
MOVWF 0x23
CALL Label_0005
MOVWF 0x24
MOVWF 0x25
MOVF 0x21 , W
XORLW 0x0E
BTFSC STATUS , Z
GOTO Label_0007
MOVF 0x21 , W
XORLW 0x40
BTFSC STATUS , Z
GOTO Label_0008
MOVF 0x21 , W
XORLW 0x12
BTFSC STATUS , Z
GOTO Label_0009
Label_000E CALL Label_000A
CALL Label_0002
Label_000B CALL Label_0002
DECFSZ 0x24 , f
GOTO Label_000B
CALL Label_0002
CALL Label_0002
GOTO Label_0006
Label_0008 MOVF 0x22 , W
MOVWF 0x30
MOVF 0x23 , W
MOVWF 0x31
MOVF 0x24 , W
MOVWF 0x32
BSF 0x2F , 01
MOVLW 0x08
CALL Label_000C
MOVWF 0x29
XORLW 0x00
BTFSC STATUS , Z
GOTO Label_000D
MOVLW 0x02
CALL Label_000C
XORWF 0x22 , W
BTFSS STATUS , Z
GOTO Label_000D
MOVLW 0x03
CALL Label_000C
XORWF 0x23 , W
BTFSS STATUS , Z
GOTO Label_000D
MOVLW 0x04
CALL Label_000C
XORWF 0x24 , W
BTFSS STATUS , Z
GOTO Label_000D
BSF 0x2F , 00
GOTO Label_000E
Label_000D MOVF 0x21 , W
CALL Label_000F
Label_0010 CALL Label_0005
DECFSZ 0x25 , f
GOTO Label_0010
MOVLW 0x90
CALL Label_000F
MOVLW 0x00
CALL Label_000F
GOTO Label_0006
Label_0007 MOVLW 0x10
CALL Label_000C
XORLW 0x00
BTFSC STATUS , Z
GOTO Label_000E
CALL Label_000A
CALL Label_0002
DECF 0x24 , f
Label_0011 CALL Label_0002
DECFSZ 0x24 , f
GOTO Label_0011
CALL Label_0005
MOVLW 0x10
CALL Label_000C
CALL Label_000F
MOVLW 0x90
CALL Label_000F
MOVLW 0x00
CALL Label_000F
GOTO Label_0006
Label_0002 BTFSS PORTB , 07
GOTO Label_0012
BTFSS PORTB , 00
GOTO Label_0013
GOTO Label_0002
Label_0013 CALL Label_0014
MOVLW 0x7F
TRIS PORTB
CLRF 0x26
BCF PORTB , 07
CALL Label_0015
MOVLW 0x08
MOVWF 0x27
BCF STATUS , C
Label_0018 RRF 0x26 , f
BTFSS PORTB , 00
GOTO Label_0016
BSF PORTB , 07
BSF 0x26 , 07
GOTO Label_0017
Label_0016 BCF PORTB , 07
Label_0017 CALL Label_0015
DECFSZ 0x27 , f
GOTO Label_0018
BTFSS PORTB , 00
BCF PORTB , 07
BTFSC PORTB , 00
BSF PORTB , 07
CALL Label_0015
BSF PORTB , 07
MOVLW 0xFF
TRIS PORTB
GOTO Label_0015
Label_0012 CALL Label_0014
MOVLW 0xFE
TRIS PORTB
CLRF 0x26
BCF PORTB , 00
CALL Label_0015
MOVLW 0x08
MOVWF 0x27
BCF STATUS , C
Label_001B RRF 0x26 , f
BTFSS PORTB , 07
GOTO Label_0019
BSF PORTB , 00
BSF 0x26 , 07
GOTO Label_001A
Label_0019 BCF PORTB , 00
Label_001A CALL Label_0015
DECFSZ 0x27 , f
GOTO Label_001B
BTFSS PORTB , 07
BCF PORTB , 00
BTFSC PORTB , 07
BSF PORTB , 00
CALL Label_0015
BSF PORTB , 00
MOVLW 0xFF
TRIS PORTB
GOTO Label_0015
Label_0014 MOVLW 0x0E
GOTO Label_0001
Label_0015 MOVLW 0x1A
Label_0001 MOVWF 0x28
Label_001C DECFSZ 0x28 , f
GOTO Label_001C
RETURN
Label_0005 CALL Label_001D
MOVF 0x26 , W
RETURN
Label_001D BTFSS PORTB , 07
GOTO Label_001E
BTFSS PORTB , 00
GOTO Label_001F
GOTO Label_001D
Label_001F MOVLW 0x2A
CALL Label_0001
MOVLW 0x09
MOVWF 0x27
Label_0020 BCF STATUS , C
BTFSC PORTB , 00
BSF STATUS , C
RRF 0x26 , f
CALL Label_0015
DECFSZ 0x27 , f
GOTO Label_0020
RLF 0x26 , f
MOVLW 0x26
GOTO Label_0001
Label_001E MOVLW 0x2A
CALL Label_0001
MOVLW 0x09
MOVWF 0x27
Label_0021 BCF STATUS , C
BTFSC PORTB , 07
BSF STATUS , C
RRF 0x26 , f
CALL Label_0015
DECFSZ 0x27 , f
GOTO Label_0021
RLF 0x26 , f
MOVLW 0x26
GOTO Label_0001
Label_0024 MOVWF 0x26
MOVLW 0x32
CALL Label_0001
MOVLW 0xFE
TRIS PORTB
CLRF 0x2A
BCF PORTB , 00
MOVLW 0x08
MOVWF 0x27
Label_0022 CALL Label_0015
RRF 0x26 , f
RLF 0x26 , W
ANDLW 0x01
XORWF 0x2A , f
XORWF PORTB , W
XORWF PORTB , f
DECFSZ 0x27 , f
GOTO Label_0022
CALL Label_0015
MOVF 0x2A , W
XORWF PORTB , W
XORWF PORTB , f
CALL Label_0015
MOVLW 0xFF
TRIS PORTB
MOVLW 0x4F
GOTO Label_0001
Label_000F MOVWF 0x26
MOVLW 0x32
CALL Label_0001
MOVLW 0x7F
TRIS PORTB
CLRF 0x2A
BCF PORTB , 07
MOVLW 0x08
MOVWF 0x27
Label_0023 CALL Label_0015
RRF 0x26 , f
RRF 0x26 , W
ANDLW 0x80
XORWF 0x2A , f
XORWF PORTB , W
XORWF PORTB , f
DECFSZ 0x27 , f
GOTO Label_0023
CALL Label_0015
MOVF 0x2A , W
XORWF PORTB , W
XORWF PORTB , f
CALL Label_0015
MOVLW 0xFF
TRIS PORTB
MOVLW 0x4F
GOTO Label_0001
Label_000A MOVF 0x20 , W
CALL Label_0024
MOVF 0x21 , W
CALL Label_0024
MOVF 0x22 , W
CALL Label_0024
MOVF 0x23 , W
CALL Label_0024
MOVF 0x24 , W
GOTO Label_0024
Label_0009 MOVF 0x22 , W
XORLW 0x01
BTFSC STATUS , Z
GOTO Label_0025
MOVF 0x22 , W
XORLW 0x02
BTFSC STATUS , Z
GOTO Label_0025
GOTO Label_000E
Label_0025 CALL Label_000A
CALL Label_0002
MOVLW 0x38
MOVWF FSR
Label_0026 CALL Label_0005
MOVWF INDF
INCF FSR , f
DECFSZ 0x24 , f
GOTO Label_0026
CALL Label_0005
CALL Label_0005
MOVLW 0x38
MOVWF FSR
MOVF INDF , W
CALL Label_000F
INCF FSR , f
MOVF INDF , W
CALL Label_000F
MOVF 0x22 , W
XORLW 0x01
BTFSC STATUS , Z
GOTO Label_0027
BTFSS 0x2F , 01
GOTO Label_0028
MOVLW 0xC1
CALL Label_0029
MOVLW 0x20
CALL Label_000F
MOVLW 0x40
CALL Label_0029
MOVLW 0x20
CALL Label_000F
MOVF 0x30 , W
CALL Label_0029
MOVLW 0x20
CALL Label_000F
MOVF 0x31 , W
CALL Label_0029
MOVLW 0x20
CALL Label_000F
MOVF 0x32 , W
CALL Label_0029
MOVLW 0x20
CALL Label_000F
MOVLW 0x20
CALL Label_000F
GOTO Label_002A
Label_0027 MOVLW 0x00
CALL Label_000C
CALL Label_0029
MOVLW 0x20
CALL Label_000F
MOVLW 0x01
CALL Label_000C
CALL Label_0029
MOVLW 0x20
CALL Label_000F
MOVLW 0x02
CALL Label_000C
CALL Label_0029
MOVLW 0x20
CALL Label_000F
MOVLW 0x03
CALL Label_000C
CALL Label_0029
MOVLW 0x20
CALL Label_000F
MOVLW 0x04
CALL Label_000C
CALL Label_0029
MOVLW 0x20
CALL Label_000F
MOVLW 0x4F
BTFSS 0x2F , 00
MOVLW 0x4E
CALL Label_000F
Label_002A MOVLW 0x12
SUBWF 0x25 , f
MOVLW 0x4A
MOVWF FSR
Label_002B MOVF INDF , W
CALL Label_000F
INCF FSR , f
DECFSZ 0x25 , f
GOTO Label_002B
MOVLW 0x90
CALL Label_000F
MOVLW 0x00
CALL Label_000F
GOTO Label_0006
Label_0029 MOVWF 0x2C
MOVF 0x2C , W
ANDLW 0x0F
MOVWF 0x2E
SUBLW 0x09
MOVLW 0x00
BTFSS STATUS , C
MOVLW 0x07
ADDLW 0x30
ADDWF 0x2E , f
SWAPF 0x2C , f
MOVF 0x2C , W
ANDLW 0x0F
MOVWF 0x2D
SUBLW 0x09
MOVLW 0x00
BTFSS STATUS , C
MOVLW 0x07
ADDLW 0x30
ADDWF 0x2D , f
MOVF 0x2D , W
CALL Label_000F
MOVF 0x2E , W
CALL Label_000F
RETURN
Label_0028 MOVLW 0x50
CALL Label_000F
MOVLW 0x41
CALL Label_000F
MOVLW 0x53
CALL Label_000F
MOVLW 0x20
CALL Label_000F
MOVLW 0x44
CALL Label_000F
MOVLW 0x45
CALL Label_000F
MOVLW 0x20
CALL Label_000F
MOVLW 0x43
CALL Label_000F
MOVLW 0x31
CALL Label_000F
MOVLW 0x20
CALL Label_000F
MOVLW 0x34
CALL Label_000F
MOVLW 0x30
CALL Label_000F
MOVLW 0x20
CALL Label_000F
MOVLW 0x20
CALL Label_000F
MOVLW 0x20
CALL Label_000F
MOVLW 0x2E
CALL Label_000F
GOTO Label_002A
Label_000C BSF STATUS , RP0
MOVWF EEADR
BSF EECON1 , 00
MOVF EEDATA , W
BCF STATUS , RP0
RETURN

ORG 0x2000
DATA 0x00
DATA 0x00
DATA 0x00
DATA 0x00



END
 
OK, I'll ask the obvious - why don't you just use a 628? It's not like they are that hard to find or expensive.

Maybe some nice person will wade through your disassembly listing and fix it. However, the 628 has more I/O pins than the 629 so it's hard to say if it could even work. Good luck.
 
I am electronic man - hardware repair tv radio etc. Important for my pcb to 8 pin smd pic.
thx for answer
 
I am electronic man - hardware repair tv radio etc. Important for my pcb to 8 pin smd pic.
thx for answer

hi,
I would suggest you look at the pcb wiring of the 16F628 circuit before considering changing the program...
IMO there are not enough pins on the 12F.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…