Searching \ for 'Pretty Code ??' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/index.htm?key=pretty+code
Search entire site for: 'Pretty Code ??'.

Truncated match.
PICList Thread
'Pretty Code ??'
1998\01\07@045458 by Mark Birks

flavicon
face
Hi folks,

Having just got my first PIC 16C84 Code to compile and work (an LCD
Driver) I have decide that I should make the code tidy and modular as a
framework for future projects.

Does anyone have any example code that shows the correct order for
include files, macros, equates, subroutines etc etc that I could
use/adapt for a template code structure ??

Please feel free to email me directly with the code as I can't seem to
get onto the PICLIST at present.

      \\\|///
    \\  - -  // "Yes it IS safe
     (  @ @  )   to switch on"
+---oOOo-(_)-oOOo------------------+
| Mark Birks                       |
| Hardware Section Leader          |
| OmniBus Systems, Stanford House, |
| Stanford-on-Soar,                |
| Loughborough, Leicestershire. UK.|
|                                  |
| Tel/Fax: +44 (0)990 004300/333   |
| E-Mail: spam_OUTmarkbTakeThisOuTspamomnibus.co.uk      |
|   ooo0                           |
|  (    )   0ooo                   |
+---\  (----(   )------------------+
    \_)     ) /
           (_/

1998\01\07@084417 by Tom Mariner

flavicon
face
Hello Mark,

You are on the PicList, that's how we all got the message.

We always use the following standards of order when writing micro code:

Title (Including subtitle with version number)
Version History with major version accomplishments indicated (Coded,
Tested, Documented)
External Macro Includes
Internal Macros
Program Operation Switches ("Conditional Compile Switches")
Comments including Pin-Outs and unusual conditions
Ram Definitions [We use relative definitions rather than absolute]
Bit Definitions
Constant Equates
Program Code (with no embedded numbers) (All code blocks Commented and most
lines)

We find this arrangement allows [relatively] easy transfer of code and
reaquaintance with the code after an absence. This is important because we
generally do consulting work for customers and have the obligation to leave
a product that can be supported by them or us.

Tom




Does anyone have any example code that shows the correct order for
include files, macros, equates, subroutines etc etc that I could
use/adapt for a template code structure ??

Please feel free to email me directly with the code as I can't seem to
get onto the PICLIST at present.

1998\01\07@102636 by myke predko

flavicon
face
I'll take the plunge (being first on the block to be flamed)....

This note is also copied directly to Mark.

>Does anyone have any example code that shows the correct order for
>include files, macros, equates, subroutines etc etc that I could
>use/adapt for a template code structure ??

For assembly language: I tend to use the same header which contains:

1.  Title of the Program (using the "TITLE" directive so it shows up on the
first line).
2.  A brief Description of the code or file.
3.  My name/date
4.  Update History
5.  Pin Interface description

Next:

1.  List Statement.  I put all the information here so I don't have to
specify anything when I invoke MPASM.
2.  Appropriate Errorlevel statements masking errors/warnings/messages I
don't want to see in the listing.
3.  Device Include File.
4.  Pin/Bit Defines
5.  Macros
6.  Variable Declarations
7.  "__CONFIG" Statement with the Device Information (I only allow the
programmer to update the config bits, rather than this error-prone human).

If I am programming for a 16C5x or 12C5xx (the low end parts), then I jump
over the subroutines which follow next.

For other devices, subroutines follow the mainline code IFF there isn't an
Interrupt handler (else I try to keep the interrupt handler starting at
address 4 and not break it up to avoid problems with PCLATH).  If there is
an interrupt handler, I jump over it.

In terms of variables, for single byte variables, I try to put them all in
Bank 0 and arrays in Bank 1 (and higher, now that I've just started playing
with the 16C76) because this minimizes how much I have to play with RP0.


Now, having said all this, I don't really think there is a "best" format,
the important thing to do is to use a format that works for you and that you
can be consistant with.

I've been using the same format for PC Assembler for about 15 years now
(groan) and I really haven't had to change it too much over the years
(including writing "C" subroutines and .COM TSRs).

myke

"I was well aware that the processes of puberty are often fatal to psychic
power."
- Sir Arthur Conan Doyle

1998\01\07@105259 by Martin R. Green

flavicon
face
On Wed, 7 Jan 1998 07:53:45 -0500, Tom Mariner
<.....Tom_MarinerKILLspamspam@spam@EMAIL.MSN.COM> wrote:

>Hello Mark,
>
>You are on the PicList, that's how we all got the message.
>

Maybe not, unlike many other similar lists, you don't have to be
subscribed to PICLIST to post to it.  Anyone can send to
PICLISTspamKILLspamMITVMA.MIT.EDU and it will make it to the list.

CIAO - Martin.

Martin R. Green
.....elimarKILLspamspam.....NOSPAMbigfoot.com

To reply, remove the NOSPAM from the return address.
Stamp out SPAM everywhere!!!

1998\01\07@192824 by Justin Crooks

flavicon
face
I can tell you how I do it:
title
list
radix

; Commentary
;
include files (.inc's with macros, equ's and stuff)

EQU's
org stuff
start
main routine

subroutines

include files (.asm's with more subroutines and EQU's and stuff)

end

----------
{Quote hidden}

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