Hey guys, i wrote a program in assembly for the 80C51 and it worked but now i have to write the same one for the PIC16F84A in assembly language, and it just wont work. Can someone figure out what mistakes i did?
This program controls one 7-segment display to count from 0-9 whilst the other 7-segment display to count from 9-0 at the same time.
If you want to see the 80C51 program (in asm) just tell me and i'll post that too.
Can anyone figure out what's wrong in this program i wrote?? Plz help me!

LIST P=16F84
INCLUDE "P16F84.INC"
__CONFIG _XT_OSC & _PWRTE_ON & _WDT_OFF & _CP_OFF
RADIX HEX
;
PORTB EQU 0x06
PORTA EQU 0x05
;
R1 EQU 0x0C
R2 EQU 0x0D
R3 EQU 0x0E
;
ORG 0
;
MOVLW 0x1F
TRIS PORTA
;
MOVLW 0x00
TRIS PORTB
;
CLRF PORTA
CLRF PORTB
;
REPEAT: MOVLW 0x0F
MOVFW PORTB
;
MOVLW 0x0F
MOVFW PORTB
;
PA_0: BTFSC PORTA,0
GOTO PA_0
;
CALL DISP
BTFSC PORTA,0
GOTO PA_0
;
MOVLW 0x06
MOVFW PORTB
MOVLW 0xF6
MOVFW PORTB
;
CALL DISP
;
MOVLW 0xDA
MOVFW PORTB
MOVLW 0xFE
MOVFW PORTB
;
CALL DISP
;
MOVLW 0xF2
MOVFW PORTB
MOVLW 0xE0
MOVFW PORTB
;
CALL DISP
; 
MOVLW 0x66
MOVFW PORTB
MOVLW 0xBE
MOVFW PORTB
;
CALL DISP
;
MOVLW 0xB6
MOVFW PORTB
MOVLW 0xB6
MOVFW PORTB
;
CALL DISP
;
MOVLW 0xBE
MOVFW PORTB
MOVLW 0x66
MOVFW PORTB
;
CALL DISP
;
MOVLW 0xE0
MOVFW PORTB
MOVLW 0xF2
MOVFW PORTB
;
CALL DISP
;
MOVLW 0xFE
MOVFW PORTB
MOVLW 0xDA
MOVFW PORTB
;
CALL DISP
;
MOVLW 0xF6
MOVFW PORTB
MOVLW 0x60
MOVFW PORTB
;
CALL DISP
;
GOTO REPEAT
;
;
DISP: MOVLW 1
MOVFW R3
LP3: MOVLW 0x0F
MOVFW R2
LP2: MOVLW 0x0F
MOVFW R1
LP1: DECFSZ R1
GOTO LP1
DECFSZ R2
GOTO LP2
DECFSZ R3
GOTO LP3
;
RETURN
;
END
;
;At blast time, select:-
;
;memory unprotected
;watchdog timer disabled
;standard crystal (4MHz)
;power up timer on

Edited 6 Years Ago by WaltP: Added CODE tags -- with all the help about them, how could you miss using them????

Hey guys, i wrote a program in assembly for the 80C51 and it worked but now i have to write the same one for the PIC16F84A in assembly language, and it just wont work. Can someone figure out what mistakes i did?
This program controls one 7-segment display to count from 0-9 whilst the other 7-segment display to count from 9-0 at the same time.
If you want to see the 80C51 program (in asm) just tell me and i'll post that too.
Can anyone figure out what's wrong in this program i wrote?? Plz help me!

LIST P=16F84
INCLUDE "P16F84.INC"
__CONFIG _XT_OSC & _PWRTE_ON & _WDT_OFF & _CP_OFF
RADIX HEX
;
PORTB EQU 0x06
PORTA EQU 0x05
;
R1 EQU 0x0C
R2 EQU 0x0D
R3 EQU 0x0E
;
ORG 0
;
MOVLW 0x1F
TRIS PORTA
;
MOVLW 0x00
TRIS PORTB
;
CLRF PORTA
CLRF PORTB
;
REPEAT: MOVLW 0x0F
MOVFW PORTB
;
MOVLW 0x0F
MOVFW PORTB
;
PA_0: BTFSC PORTA,0
GOTO PA_0
;
CALL DISP
BTFSC PORTA,0
GOTO PA_0
;
MOVLW 0x06
MOVFW PORTB
MOVLW 0xF6
MOVFW PORTB
;
CALL DISP
;
MOVLW 0xDA
MOVFW PORTB
MOVLW 0xFE
MOVFW PORTB
;
CALL DISP
;
MOVLW 0xF2
MOVFW PORTB
MOVLW 0xE0
MOVFW PORTB
;
CALL DISP
; 
MOVLW 0x66
MOVFW PORTB
MOVLW 0xBE
MOVFW PORTB
;
CALL DISP
;
MOVLW 0xB6
MOVFW PORTB
MOVLW 0xB6
MOVFW PORTB
;
CALL DISP
;
MOVLW 0xBE
MOVFW PORTB
MOVLW 0x66
MOVFW PORTB
;
CALL DISP
;
MOVLW 0xE0
MOVFW PORTB
MOVLW 0xF2
MOVFW PORTB
;
CALL DISP
;
MOVLW 0xFE
MOVFW PORTB
MOVLW 0xDA
MOVFW PORTB
;
CALL DISP
;
MOVLW 0xF6
MOVFW PORTB
MOVLW 0x60
MOVFW PORTB
;
CALL DISP
;
GOTO REPEAT
;
;
DISP: MOVLW 1
MOVFW R3
LP3: MOVLW 0x0F
MOVFW R2
LP2: MOVLW 0x0F
MOVFW R1
LP1: DECFSZ R1
GOTO LP1
DECFSZ R2
GOTO LP2
DECFSZ R3
GOTO LP3
;
RETURN
;
END
;
;At blast time, select:-
;
;memory unprotected
;watchdog timer disabled
;standard crystal (4MHz)
;power up timer on

Maybe try getting a specialized Windows interface. You could try here...good luck!
http://www2.electronicproducts.com/Compiler_adds_to_design_kit-article-maysw1-may2001.aspx

This article has been dead for over six months. Start a new discussion instead.