Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

hepl me to solve my problm...

Status
Not open for further replies.
LIST P = PIC16F877A

#INCLUDE "P16F877A.INC"


__CONFIG _CP_OFF & _WDT_OFF & _XT_OSC & _LVP_OFF

cblock 20h
hibyte
lowbyte
temp
IRWaitCnt
msb,lsb,ones,tens,hund,thus,ss,sp,rr,tmp,tmp1,STORE,blink,hunds,tmp2,timer,ee,ff,Timer
endc


ORG 0X00


MOVLW 00H
MOVWF PCLATH
CLRF STATUS
GOTO main
;********************************************************************************
org 04h
movwf temp
swapf STATUS,W
movwf STORE
clrf STATUS
; call check
call load
retfie

;********************************************************************************
lookup

addwf PCL,F ;digit to be displayed
retlw b'00111111' ;'0'
retlw b'00000110' ;'1'
retlw b'01011011' ;'2'
retlw b'01001111' ;'3'
retlw b'01100110' ;'4'
retlw b'01101101' ;'5'
retlw b'01111101' ;'6'
retlw b'00000111' ;'7'
retlw b'01111111' ;'8'
retlw b'01101111' ;'9'
retlw b'00000000' ;'a'
retlw b'01111100' ;'b'
retlw b'00111001' ;'c'
retlw b'01011110' ;'d'
retlw b'01111001' ;'e'
retlw b'01110001' ;'f'



;*****************************************************************************************




initport
bsf STATUS,RP0
bcf TRISC,1
bcf TRISC,0
movlw 0x06
movwf OPTION_REG
movlw b'00000000'
movwf TRISD
bcf TRISB,5
movlw b'11010000'
movwf TRISB
bsf PIE1,TMR1IE
bcf STATUS,RP0
bcf PIR1,TMR1IF
bsf INTCON,GIE
bsf INTCON,PEIE
bsf T1CON,0
bcf T1CON,2
bcf T1CON,1
clrf TMR0
clrf TMR1L
clrf TMR1H

bcf PORTC,0
bcf PORTC,1
clrf PORTB
clrf ee
clrf PORTD
clrf ff

bsf PORTC,0
bcf PORTC,0
movlw 0x5f
movwf ss
bsf tmp,0
movlw 0x01
movwf ones
movlw 0x02
movwf tens
movlw 0x03
movwf hunds
movlw 0x04
movwf thus
clrf blink
clrf tmp2
bsf blink,2
return

;------------------------------------------------------------------------------------------------
mainline



nop
btfsc PORTB,4
goto mainline
call start
xorlw 0FFh
btfss STATUS,Z
goto mainline
movlw 0FFh
movwf PORTD
bsf PORTC,1
call delay
bcf PORTC,1
movfw lowbyte
movfw hibyte
movwf tmp1

movfw lowbyte
movwf tmp
xorlw 0x0c
btfss STATUS,Z
goto mainline
bsf blink,0
goto load
return

chk clrf tmp1
retlw 0Fh

start

nop
btfsc PORTB,4
goto chk
incf tmp1,f
movlw .45
subwf tmp1,w
skpc
goto start
clrf tmp1
clrf TMR0
movlw 0x06
movwf TMR0
bcf INTCON,T0IF
call Wlow
call Whigh
btfsc INTCON,T0IF
retlw 0x0F

movfw TMR0
clrf TMR0
movwf timer
movwf temp
clrc
rrf temp,f
clrc
rrf temp,f
movf temp,w
subwf timer,f
movlw 0x0c
movwf temp
nextBit movfw timer
subwf TMR0,w
skpz
goto nextBit
btfsc PORTB,4
goto waitlow
call Whigh
setc
goto clock



waitlow call Wlow
clrc
clock clrf TMR0
btfsc INTCON,T0IF
retlw 0x00
rlf lowbyte,F
rlf hibyte,F
decfsz temp,f
goto nextBit
movfw lowbyte
movwf temp
rlf temp,f
rlf hibyte,F
rlf temp,f
rlf hibyte,F
movlw 0x3f
andwf hibyte,F
movlw 0x3f
andwf lowbyte,F
retlw 0xff



Wlow btfsc INTCON,T0IF
return
btfss PORTB,4
goto Wlow
return



Whigh btfsc INTCON,T0IF
return
btfsc PORTB,4
goto Whigh
return


;----------------------------------------------------------------------------------------------------------------------
load

incf ee,1
btfss tmp,0
goto one
bcf PORTB,0
movfw ones
call lookup
movwf PORTD
btfsc blink,0
btfss ee,7
bsf PORTB,0
rlf tmp,F
GOTO finish

one
btfss tmp,1
goto ten
bcf PORTB,0
movfw tens
call lookup
movwf PORTD
btfsc blink,1
btfsc ee,7
bsf PORTB,1
rlf tmp,F
goto finish

ten btfss tmp,2
goto hund1
bcf PORTB,1
movfw hunds
call lookup
movwf PORTD
btfsc blink,2
btfsc ee,7
bsf PORTB,2
rlf tmp,F
goto finish

hund1 btfss tmp,3
goto thuds
bcf PORTB,2
movfw thus
call lookup
movwf PORTD
btfsc blink,3
btfsc ee,7

bsf PORTB,3
rlf tmp,1
goto finish

thuds btfss tmp,4
goto finish
bcf PORTB,3
clrf tmp
bsf tmp,0
goto finish

;-----------------------------------------------------------------------------
finish

swapf temp,W

movlw 0xff
movwf TMR1L
movlw 0xef
movwf TMR1H

; *** Restore Values ***
swapf STORE,W
movwf STATUS
swapf temp,F
swapf temp,w
bcf INTCON,T0IF
bcf PIR1,TMR1IF
return






convert

movf tmp,0
movwf lsb

aa
movf lsb,0
movwf ones
bcf ones,7
bcf ones,6
bcf ones,5
bcf ones,4
call load
return

bb
movf lsb,0
movwf tens
bcf tens,7
bcf tens,6
bcf tens,5
bcf tens,4
call load
return


cc
movf lsb,0
movwf hunds
bcf hunds,7
bcf hunds,6
bcf hunds,5
bcf hunds,4
call load
return



dd
movf lsb,0
movwf thus
bcf thus,7
bcf thus,6
bcf thus,5
bcf thus,4
call load
return
delay

movlw 0x05
movwf rr
back2: movlw 0xff
movwf sp
back decfsz sp,1
goto back
decfsz rr,1
goto back2
return


main
call initport
goto mainline
end
;---------------------------------------------------




this program s used for chnging the display using remote controller...in this timer1 am given to display and the timer0 for the ir decoding...nw i am getting
the display properly..bt the remote interface has some problms.....
pls help me...
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top