---- START NEW MESSAGE --- Received: from cherry.ease.lsoft.com [209.119.0.109] by dpmail10.doteasy.com with ESMTP (SMTPD32-8.05) id A6FA448023E; Thu, 29 Jan 2004 13:11:22 -0800 Received: from PEAR.EASE.LSOFT.COM (209.119.0.19) by cherry.ease.lsoft.com (LSMTP for Digital Unix v1.1b) with SMTP id <11.00CC327C@cherry.ease.lsoft.com>; Thu, 29 Jan 2004 16:02:07 -0500 Received: from MITVMA.MIT.EDU by MITVMA.MIT.EDU (LISTSERV-TCP/IP release 1.8e) with spool id 1792 for PICLIST@MITVMA.MIT.EDU; Thu, 29 Jan 2004 16:02:01 -0500 Received: from MITVMA (NJE origin SMTP@MITVMA) by MITVMA.MIT.EDU (LMail V1.2d/1.8d) with BSMTP id 3131; Thu, 29 Jan 2004 16:00:53 -0500 Received: from linda-2.paradise.net.nz [202.0.58.21] by mitvma.mit.edu (IBM VM SMTP Level 430) via TCP with ESMTP ; Thu, 29 Jan 2004 16:00:52 EST X-Comment: mitvma.mit.edu: Mail was sent by linda-2.paradise.net.nz Received: from smtp-1.paradise.net.nz (smtp-1a.paradise.net.nz [202.0.32.194]) by linda-2.paradise.net.nz (Paradise.net.nz) with ESMTP id <0HS900FGXRPHMD@linda-2.paradise.net.nz> for PICLIST@MITVMA.MIT.EDU; Fri, 30 Jan 2004 10:00:54 +1300 (NZDT) Received: from Paradise (202-0-40-99.adsl.paradise.net.nz [202.0.40.99]) by smtp-1.paradise.net.nz (Postfix) with SMTP id 86478827AA for ; Fri, 30 Jan 2004 10:00:53 +1300 (NZDT) MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Mailer: Microsoft Outlook Express 6.00.2800.1158 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7bit X-Priority: 3 X-MSMail-priority: Normal References: <2193429B07D9914D97216EBBAA6AB8BD1A0509@whitlam.corp.gli.com.au> <5.2.0.9.2.20040129073858.01554480@mail.cedar.net> Message-ID: <001b01c3e6ab$179d80a0$7b01a8c0@Paradise> Date: Fri, 30 Jan 2004 10:00:42 +1300 Reply-To: pic microcontroller discussion list Sender: pic microcontroller discussion list From: Russell McMahon Subject: Re: [PIC:] Process To: PICLIST@MITVMA.MIT.EDU Precedence: list X-RCPT-TO: Status: U X-UIDL: 371856335 > I spend too much time debugging. I do too :-) But these things help me: 1. Write anything at all complex as pseudo code - my own HLL if you will. Once written, duplicate the text block produced and use the second copy as comments for the real code. Thus I have the full pseudo code at the top and a line by line "compilation" of it to follow with comments 2. Name variables, constants etc with specific first letter. V variable , K Constant etc. Need varies with "typing" of the assembler. Nothing worse than using a onstant as an address when you meant to do an immediate load. I even get carried away enough to put port names that pins belonmg to into both the port name AND the pin name :-) 3. Where state machines are concerned, write as a state diagram then turn the transitions into psuedo code then treat as in 1 above. 4. Realise that "boundary conditions" are where most errors occur. Starts of loops, terminating conditions etc. 5 Comment like mad. Write full explanations about what the routine does and why at the top. Discuss philosophy and state of Moon if it helps. Russell McMahon -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details. .