Searching \ for 'Simple programmng problem' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=simple+programmng
Search entire site for: 'Simple programmng problem'.

Truncated match.
PICList Thread
'Simple programmng problem'
1997\06\03@184725 by Tim Crist

flavicon
face
    I'm having problems with some very simple code.  The MPLAB 3.22
    simulator seems to stick on 07H in this routine when decrementing
    the variable del_y.  What am I doing wrong?



    ;Initial program setup for PIC84

    COUNT      EQU     008H            ;Tim's Counter DEL_Y constant
    DEL_Y      EQU     00H             ;Tim's DEL_Y Variable


    ;some more program stuff...


               MOVLW   COUNT           ;Put the COUNT in W (accumulator)
               MOVWF   DEL_Y           ;Move COUNT to f (DEL_Y)
    COUNTR     DECFSZ  DEL_Y,F         ;F-1 --> DEL_Y
               GOTO    COUNTR;         ;*** Simulator gets stuck between
                                       ;*** here and "COUNTR"



    TIA,

    Tim Crist

1997\06\03@190009 by Clyde Smith-Stubbs

flavicon
face
On Tue, Jun 03, 1997 at 03:41:45PM +0000, Tim Crist wrote:
>      I'm having problems with some very simple code.  The MPLAB 3.22
>      simulator seems to stick on 07H in this routine when decrementing
>      the variable del_y.  What am I doing wrong?

What you're doing wrong is trying to use location 0 as memory - location
0 in a PIC is the INDF register which accesses memory via the pointer
register FSR. FSR is probably pointing to non-existent memory, or even
to 0, which will cause your problems.

Change the definition of DEL_Y to reference actual RAM  - it starts
at 0Ch in a 16C84.

Clyde

--
Clyde Smith-Stubbs    | HI-TECH Software,       | Voice: +61 7 3354 2411
spam_OUTclydeTakeThisOuTspamhtsoft.com      | P.O. Box 103, Alderley, | Fax:   +61 7 3354 2422
http://www.htsoft.com | QLD, 4051, AUSTRALIA.   |
---------------------------------------------------------------------------
Download a FREE beta version of our new ANSI C compiler for the PIC
microcontroller! Point your WWW browser at http://www.htsoft.com/

1997\06\03@190811 by Mike Keitz

picon face
On Tue, 3 Jun 1997 15:41:45 PST8 Tim Crist <.....tjcristKILLspamspam@spam@CCGATE.HAC.COM>
writes:
>     I'm having problems with some very simple code.  The MPLAB 3.22
>     simulator seems to stick on 07H in this routine when decrementing
>     the variable del_y.  What am I doing wrong?
>
>
>
>     ;Initial program setup for PIC84
>
>     COUNT      EQU     008H            ;Tim's Counter DEL_Y constant
>     DEL_Y      EQU     00H             ;Tim's DEL_Y Variable


00H is not a valid RAM location.  It is the INDF special-function
register.  You need to move the DEL_Y variable to a general purpose file
register.  Consult the memory map in the data book for the particular
model of PIC you are using to find an appropriate address.  Location 0x20
works in most all PICs except the 16C5x series.
{Quote hidden}

Exactly what is likely happening is the FSR is 0, so you are trying to
read INDF indirectly, which the book says will always return 0.  If you
break the program before the first decrement, you will find that the
write didn't take.  So the decfsz never skips, because 0 decrements to
0xff, which is never 0.

-Mike

1997\06\03@205949 by Jacques Bellefleur

flavicon
face
{Quote hidden}

        COUNTR     DECFSZ  DEL_Y,F         ;F-1 --> DEL_Y

shall read COUNTR   DECFSZ  DEL_Y           ; ,F is your bug

Bye,

1997\06\03@222301 by eric naus

picon face
Hi,

The code decfsz del_y,f

The F must be a 0 if you want the result going to the W register and
a 1 if you want the result going back to the register del_y.

I would also use one of the general registers for storage 0Ch up

Hope it helps.

Bye For Now

Eric Naus

At 03:41 PM 6/3/97 PST8, you wrote:
{Quote hidden}

1997\06\04@125626 by Wayne Halcomb

flavicon
face
Tim Crist wrote:
{Quote hidden}

Hi Tim,
Well I,m very new to this but I think I see the problem.
DEL_Y is equal to 8
then decfsz takes the value from the file DEL_Y decrements it and puts
that value (7) into W (because F if undefined is zero).
Set F to 1 and I think this will work.

Regards,
Wayne

1997\06\04@131258 by Marc 'Nepomuk' Heuler

flavicon
face
Hi Tim (Tim Crist), in <9705038653.AA865377974spamKILLspamCCGATE.HAC.COM> on Jun 3 you
wrote:

>      ;Initial program setup for PIC84
>
>      COUNT      EQU     008H            ;Tim's Counter DEL_Y constant
>      DEL_Y      EQU     00H             ;Tim's DEL_Y Variable
>
>
>      ;some more program stuff...
>
>
>                 MOVLW   COUNT           ;Put the COUNT in W (accumulator)
>                 MOVWF   DEL_Y           ;Move COUNT to f (DEL_Y)
>      COUNTR     DECFSZ  DEL_Y,F         ;F-1 --> DEL_Y
>                 GOTO    COUNTR;         ;*** Simulator gets stuck between
>                                         ;*** here and "COUNTR"

Choose another register address for DEL_Y (0x00 is INDF), or initialize FSR
to something meaningful before entering the loop.

More... (looser matching)
- Last day of these posts
- In 1997 , 1998 only
- Today
- New search...