Truncated match.
PICList
Thread
'problem with incf (beginners ?)'
1997\06\25@152514
by
Andre Abelian
|
Hi all.
I am having problem with speed. incf instruction is not working.
What am I going wrong?
Do you recommend any C beginners book.
thank you
LIST P=16C56
;-------------------------------------------------------------------------
; BIT MASK ASSINMENTS
;-------------------------------------------------------------------------
W EQU 0
F EQU 1
ONE EQU 1
Z EQU 2
ZERO EQU 2
FSR EQU 04
RB7 EQU 7
RB6 EQU 6
C EQU 0
CARRY EQU 0
RA0 EQU 0
RA1 EQU 1
COUNT1 EQU 0C
COUNT2 EQU 0D
COUNT3 EQU 0E
;------------------------------------------------------
; PORT ASSINMENTS
;-----------------------------------------------------
PORTB EQU 06
PORTA EQU 05
STATUS EQU 03
ORG 0
INIT
MOVLW B'00000000' ; MAKE PORTB OUTPUT
TRIS PORTB ; DO IT
MOVWF PORTB
MOVLW B'11111111' ; MAKE PORTA INPUT
TRIS PORTA ; DO IT
CLRF PORTA ; CLEAR PORTA
START
MOVLW .100
MOVWF COUNT3
;-------------------------------------------------------
; MAIN PROGRAMM
;-------------------------------------------------------
BSF PORTB,0 ; SET BIT0 ON
ROT_L
BTFSC PORTA,RA1
GOTO D1
INCF COUNT3
D1
CALL DELAY ; CALL DELAY FOR 200 MS
BCF STATUS,C ; CLEAR CARRY BIT IN STATUS REGISTER
RLF PORTB,ONE ; ROTATE RB0 TO LEFT
BTFSS PORTB,7
GOTO ROT_L
GOTO ROT_R
ROT_R
BTFSC PORTA,RA1
GOTO D2
INCF COUNT3
D2
CALL DELAY ; CALL DELAY 200 MS
BCF STATUS,C
RRF PORTB,ONE
BTFSS PORTB,0
GOTO ROT_R
GOTO INIT
;---------------------------------------
; DELAY SUBROUTINE
;--------------------------------------
DELAY
MOVLW .200 ; LOAD VARIABLE VALUE
MOVWF COUNT1
MOVF COUNT3,W
MOVWF COUNT2
DELAY1
DECFSZ COUNT1,ONE
GOTO DELAY1
DECFSZ COUNT2,ONE
GOTO DELAY1
RETLW 00
;--------------------------
END
1997\06\25@162021
by
Michael S. Hagberg
without having to get up a read the programming specs
i think the incf needs a location ie
incf count3,f
just a note 'f' should be defined in the include header file.
you can also use
decfsz count1,f
michael
1997\06\25@165922
by
Quentin
Andre Abelian wrote:
> Hi all.
> I am having problem with speed. incf instruction is not working.
> What am I going wrong?
>
<snip>
> ROT_L
> BTFSC PORTA,RA1
> GOTO D1
> INCF COUNT3
>
<snip>
> ROT_R
> BTFSC PORTA,RA1
> GOTO D2
> INCF COUNT3
<snip>
Hi
It looks like you do not specify the destination file in INCF.
INCF f,d where "d" is either 0 or 1, where 0 is W reg and 1 is same
source file.
So your line should read
INCF COUNT3,ONE
I hope this is it :)
Quentin
1997\06\25@183413
by
Gennady Palitsky
Quentin wrote:
{Quote hidden}>
> Andre Abelian wrote:
>
> > Hi all.
> > I am having problem with speed. incf instruction is not working.
> > What am I going wrong?
> <snip>
>
> > ROT_L
> > BTFSC PORTA,RA1
> > GOTO D1
> > INCF COUNT3
> <snip>
>
> Hi
> It looks like you do not specify the destination file in INCF.
>
> INCF f,d where "d" is either 0 or 1, where 0 is W reg and 1 is same
> source file.
>
> So your line should read
>
> INCF COUNT3,ONE
>
> I hope this is it :)
>
> Quentin
I think, line should read
INCF COUNT3,1
And I wonder if it will solve the problem, because even if you forget ,1
- it will be ascribed as default value.
Gennady
More... (looser matching)
- Last day of these posts
- In 1997
, 1998 only
- Today
- New search...