Olin's personality doesn't always rub me the right way, BUT...

...he IS right, I think, in that commenting code helps to find bugs.

Now, that doesn't mean that other people can't help out and point out the
obvious bug, I just wanted to try to get past the... personality issues...
and point out that going over this code and commenting it would be a good
way to find the problem.

Especially if you did the commenting by looking up the instructions and
reading their function.

---
James Newton (PICList Admin #3)
mailto:jamesnewton@piclist.com 1-619-652-0593
PIC/PICList FAQ: http://www.piclist.com or .org

-----Original Message-----
From: pic microcontroller discussion list
[mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Olin Lathrop
Sent: Friday, October 13, 2000 04:49
To: PICLIST@MITVMA.MIT.EDU
Subject: Re: [PIC]: Spot the Bug! AKA table reads


> Here's extracts of my code. Can anyone spot the bug?

Yes, I can.  However I don't believe in helping those who haven't even done
the simple little things to help themselves.  There is not a single comment
in the first section of code below.  Go back and force yourself to explain
what you think each instruction is doing, and there's a reasonable chance
you'll figure out the problem on your own.  Another suggestion is to look
over the instruction set again.  You are doing some things the hard way.

> display_message
>                 movlw   0
>                 movf    offset
>
>                 movlw   ">"
>                 call    send_ascii
>
>                 movlw   LOW TABLE
>                 addwf   offset
>                 movlw   HIGH TABLE
>                 btfsc   status,c
>                 addlw   1
>                 movwf   PCLATH
>                 movf    offset,w
>
>                 call    TABLE
>                 call    send_ascii
>
>                 movlw   "<"
>                 call    send_ascii
>
>                 return

> TABLE
>                 movwf   PCL     ; called with displacement in W
>                 retlw   "A"
>                 retlw   "B"
>                 retlw   "C"
>                 retlw   "D"


*****************************************************************
Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, olin@cognivis.com, http://www.cognivis.com

--
http://www.piclist.com hint: To leave the PICList
mailto:piclist-unsubscribe-request@mitvma.mit.edu

--
http://www.piclist.com hint: To leave the PICList
mailto:piclist-unsubscribe-request@mitvma.mit.edu