Gautam G
Newbie level 3
- Joined
- Apr 30, 2012
- Messages
- 3
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Coimbatore
- Activity points
- 1,305
good day,
can any one help in solving this error for my project...I have to submit before may 4th...plz plz plz help me
I will display my code here... My problem is if run my program in MPLAB IDE v8.83 I am getting right result and when I have done my simulation in proteus software I am getting wrong results. will some one help me with this problem??
code:
any suggestions?
thanx guys....
can any one help in solving this error for my project...I have to submit before may 4th...plz plz plz help me
I will display my code here... My problem is if run my program in MPLAB IDE v8.83 I am getting right result and when I have done my simulation in proteus software I am getting wrong results. will some one help me with this problem??
code:
Code:
#include"p16f877a.inc"
status equ 0x03
cblock 0x20
r0,r1,temp,temp2,temp3,carry,rest,temp4
endc
org00
goto main
org 04h
retfie
main
movlw 0x00
movwf temp3
bsf status,5
bcf status,6
movlw 0xf0
movwf TRISD
movlw 0x00
movwf TRISC
bcf status,5
top
bsf PORTD,0
BCF PORTD,1
BCF PORTD,2
BCF PORTD,3
btfsc PORTD,4
goto l1
btfsc PORTD,5
goto l2
btfsc PORTD,6
goto l3
btfsc PORTD,7
goto l4
bcf PORTD,0
bsf PORTD,1
BCF PORTD,2
BCF PORTD,3
btfsc PORTD,4
goto l5
btfsc PORTD,5
goto l6
btfsc PORTD,6
goto l7
btfsc PORTD,7
goto l8
BCF PORTD,0
BCF PORTD,1
bsf PORTD,2
BCF PORTD,3
btfsc PORTD,4
goto l9
btfsc PORTD,5
goto l10
btfsc PORTD,6
goto l11
btfsc PORTD,7
goto l12
BCF PORTD,0
BCF PORTD,1
bcf PORTD,2
BSF PORTD,3
btfsc PORTD,4
goto l13
btfsc PORTD,5
goto l14
btfsc PORTD,6
goto l15
btfsc PORTD,7
goto l16
goto top
l1 movlw 0x0e
movwf PORTC
movlw 0x07
movwf temp
goto top
l2 movlw 0xcc
movwf PORTC
movlw 0x04
movwf temp
goto top
l3 movlw 0x0c
movwf PORTC
movlw 0x01
movwf temp
goto top
l4 movlw 0x00
movwf PORTC
movlw 0x00
movwf temp
goto top
l5 movlw 0xfe
movwf PORTC
movlw 0x08
movwf temp
goto top
l6 movlw 0xda
movwf PORTC
movlw 0x05
movwf temp
goto top
l7 movlw 0xb6
movwf PORTC
movlw 0x02
movwf temp
goto top
l8 movlw 0x7e
movwf PORTC
movlw 0x00
movwf temp
goto top
l9 movlw 0xce
movwf PORTC
movlw 0x09
movwf temp
goto top
l10 movlw 0xfa
movwf PORTC
movlw 0x06
movwf temp
goto top
l11 movlw 0x9e
movwf PORTC
movlw 0x03
movwf temp
goto top
l12
movlw 0xbc
subwf rest,0
btfsc status,2
goto div
movlw 0x92
subwf rest,0
btfsc status,2
goto mult
movlw 0x80
subwf rest,0
btfsc status,2
goto sub
movlw 0xe6
subwf rest,0
btfsc status,2
goto add
deck:
movf temp3,0
movwf temp4
movlw 0x00
subwf temp4,0
btfsc status,2
goto l8
movlw 0x01
subwf temp4,0
btfsc status,2
goto l3
movlw 0x02
subwf temp4,0
btfsc status,2
goto l7
movlw 0x03
subwf temp4,0
btfsc status,2
goto l11
movlw 0x04
subwf temp4,0
btfsc status,2
goto l2
movlw 0x05
subwf temp4,0
btfsc status,2
goto l6
movlw 0x06
subwf temp4,0
btfsc status,2
goto l10
movlw 0x07
subwf temp4,0
btfsc status,2
goto l1
movlw 0x08
subwf temp4,0
btfsc status,2
goto l5
movlw 0x09
subwf temp4,0
btfsc status,2
goto l9
goto top
l13 movlw 0xbc
movwf rest
movwf PORTC
movf temp,0
movwf temp2
goto top
l14 movlw 0x92
movwf rest
movwf PORTC
movf temp,0
movwf temp2
goto top
l15 movlw 0x80
movwf rest
movwf PORTC
movf temp,0
movwf temp2
goto top
l16 movlw 0xe6
movwf rest
movwf PORTC
movf temp,0
movwf temp2
goto top
add:
movf temp2,0
addwf temp,0
movwf temp3
goto deck
sub:
movf temp,0
subwf temp2,0
movwf temp3
goto deck
mult:
movlw 0x00
movwf carry
rot:
addwf temp,0
btfsc status,0
incf carry,1
decfsz temp2,1
goto rot
movwf temp3
goto deck
div:
movlw 0x00
movwf temp3
loop1:
movf temp,0
subwf temp2,1
btfsc status,0
goto loop2
movf temp,0
addwf temp2,1
goto deck
loop2:
incf temp3,1
goto loop1
last nop
end
any suggestions?
thanx guys....
Last edited by a moderator: