2001 Microchip Technology Inc.
DS51159B-page 151
Debugging Techniques
The variable
num_out
is being written from within the
delay2
routine as a
result of the
decfsz delay_cnt
instruction. On closer inspection of the
delay_cnt
variable, you will find that it is being used as a 16-bit variable, but
in the source, it was only set as 8-bit. So, it overlaps with
num_out
, trashing it
in the delay routine.
Change the source code so that
delay_cnt
is set up as a 16-bit variable,
(i.e., change
delay_cnt
to
delay_cnt:2)
.
Figure A.13: Source Code File Update
A.4.3
Negative variable
When a particular variable gets to a signed negative value (8 bits), the
program misbehaves.
By using a sequential trigger and the trace display, you can see what is
happening when the variable goes negative.
To clear all break, trace and trigger points, select Debug>Clear All Points.
Configure the trace display (Window>Trace Memory, Options>Configure) to
focus on the source and destination address and data.
Summary of Contents for MPLAB ICE
Page 1: ...2001 Microchip Technology Inc DS51159C MPLAB ICE EMULATOR USER S GUIDE M...
Page 8: ...MPLAB ICE User s Guide DS51159B page viii 2001 Microchip Technology Inc...
Page 18: ...MPLAB ICE User s Guide DS51159B page 18 2001 Microchip Technology Inc NOTES...
Page 36: ...MPLAB ICE User s Guide DS51159B page 36 2001 Microchip Technology Inc NOTES...
Page 58: ...MPLAB ICE User s Guide DS51159B page 58 2001 Microchip Technology Inc NOTES...
Page 80: ...MPLAB ICE User s Guide DS51159B page 80 2001 Microchip Technology Inc NOTES...
Page 126: ...MPLAB ICE User s Guide DS51159B page 126 2001 Microchip Technology Inc NOTES...
Page 140: ...MPLAB ICE User s Guide DS51159B page 140 2001 Microchip Technology Inc NOTES...
Page 158: ...MPLAB ICE User s Guide DS51159B page 158 2001 Microchip Technology Inc NOTES...
Page 189: ...2001 Microchip Technology Inc DS51159B page 189 Index NOTES...
Page 190: ...MPLAB ICE User s Guide DS51159B page 190 2001 Microchip Technology Inc NOTES...
Page 191: ...2001 Microchip Technology Inc DS51159B page 191 Index NOTES...