hi there! i want to make my pic count up and down (can b any number), i'm quit familiar with the instructions but i still cant get it wright! i'm using portB as output and i'd lik to see the counting sequence using led's first and a 7 segment display later!(RB0....RB7) can sbody help?
here's what i'v done so far (i'm new to this):
status equ 03h
PortB equ 06h
TRISB equ 86h
count1 equ 22h
count2 equ 23h
count3 equ 24h
;***********************************************************
org 10h
bsf status,RP0; bank1
movlw B'00000000'
movwf TRISB; use portB as output
bcf status,RP0; bank0
start
incf count3,0 ; increment count3 and store value in w
movwf PortB ; mov w value on portB
call repeat ; repeat calls delay 5x to make it longer
goto start
repeat
call delay
call delay
call delay
call delay
call delay
return
delay
movlw D'255'
movwf count1
loop1
movlw D'255'
movwf count2
loop2
nop
decfsz count2,1
goto loop2
decfsz count1,1
goto loop1
return
end
here's what i'v done so far (i'm new to this):
status equ 03h
PortB equ 06h
TRISB equ 86h
count1 equ 22h
count2 equ 23h
count3 equ 24h
;***********************************************************
org 10h
bsf status,RP0; bank1
movlw B'00000000'
movwf TRISB; use portB as output
bcf status,RP0; bank0
start
incf count3,0 ; increment count3 and store value in w
movwf PortB ; mov w value on portB
call repeat ; repeat calls delay 5x to make it longer
goto start
repeat
call delay
call delay
call delay
call delay
call delay
return
delay
movlw D'255'
movwf count1
loop1
movlw D'255'
movwf count2
loop2
nop
decfsz count2,1
goto loop2
decfsz count1,1
goto loop1
return
end