Just a thought: could the programming editor accept some pseudo-command to aid project documentation... an idea inspired by the old COBOL "environment division" in a way, the aims are:
1. put something in a standard format towards the top of the program that documents how all of the pins are supposed to be used (input, output, grounded, open, connected to a temperature sensor, EEPROM, etc).
2. Use that information to check at compile time for silly mistakes, such as an output to an input pin.
3. Optionally use that information by external programs (or tools accessed from pull-down menus) that might print a picture of the chip and the wiring immediately around it for checking... hopefully the software would be told the type of picaxe chip selected, and might even know the prototype board details). Being an external program, it could be up to developers of projects/boards that use a picaxe to provide something really useful to developers or schools, even to the level of a complete set of instructions on how to wire everything, what to test before switching on, etc... to make it more fool-proof.
4. Ideally, combine this with the "symbol" facility so programmers can simultaneously define a symbol (such as green_led) to either a standard pic pin name (e.g. RA1 or P1A) or a leg name or whatever, and have the value for the symbol change if it needs to if a different picaxe chip is used. Perhaps even allow conditional symbols - assigning particular pins depending on the chip selected... to allow one program to be used with the 08M, 14M or 20M for example.
5. At some stage add to this some of the concepts of libraries or OO - by adding to your library a definition for (say) a DS1820, assigning a pin to this device might make standard routines available for using it (which would only take up memory if used in your program), and would imply appropriate tests on the choice of pin and its IO mode. users should be able to build up libraries for many devices, e.g. a CD4094 (with several pins assigned to the data and clock and optionally other uses) so the programmer can call routines to output complete bytes etc. Obviously the addition of conditionally-linked subroutines is a major addition to the editor, but it could be allowed for as a future step when designing an environment section.
Such a section (which would be too messy as a single-line syntax) might look something like this (with indentation which got lost in posting):
define environment:
author Barney.Rubble@bedrock.net
copyright GPL
version 1.04B
requires:
picaxe 08M or 14M
supply regulated
components:
leds:
green x1
red x1
resistors:
330 ohms x2 "R2..3"
10k x1 "R1"
switch (push on)
pins:
button = in3
green_led = out1 (output)
red_led = out2 (output)
uses:
debounce from switch_routines
end environment
Notice that very little of this would actually be used by the editor - it is mostly a giant multi-line comment (in a particular format) although more and more may be noticed by editor software or external programs as time goes by - e.g. revision control systems, aids to those preparing experiments for classes, etc.
The key is to encourage good documentation (including of the hardware) in a simple way that can be expanded in usefulness later.
Mark
1. put something in a standard format towards the top of the program that documents how all of the pins are supposed to be used (input, output, grounded, open, connected to a temperature sensor, EEPROM, etc).
2. Use that information to check at compile time for silly mistakes, such as an output to an input pin.
3. Optionally use that information by external programs (or tools accessed from pull-down menus) that might print a picture of the chip and the wiring immediately around it for checking... hopefully the software would be told the type of picaxe chip selected, and might even know the prototype board details). Being an external program, it could be up to developers of projects/boards that use a picaxe to provide something really useful to developers or schools, even to the level of a complete set of instructions on how to wire everything, what to test before switching on, etc... to make it more fool-proof.
4. Ideally, combine this with the "symbol" facility so programmers can simultaneously define a symbol (such as green_led) to either a standard pic pin name (e.g. RA1 or P1A) or a leg name or whatever, and have the value for the symbol change if it needs to if a different picaxe chip is used. Perhaps even allow conditional symbols - assigning particular pins depending on the chip selected... to allow one program to be used with the 08M, 14M or 20M for example.
5. At some stage add to this some of the concepts of libraries or OO - by adding to your library a definition for (say) a DS1820, assigning a pin to this device might make standard routines available for using it (which would only take up memory if used in your program), and would imply appropriate tests on the choice of pin and its IO mode. users should be able to build up libraries for many devices, e.g. a CD4094 (with several pins assigned to the data and clock and optionally other uses) so the programmer can call routines to output complete bytes etc. Obviously the addition of conditionally-linked subroutines is a major addition to the editor, but it could be allowed for as a future step when designing an environment section.
Such a section (which would be too messy as a single-line syntax) might look something like this (with indentation which got lost in posting):
define environment:
author Barney.Rubble@bedrock.net
copyright GPL
version 1.04B
requires:
picaxe 08M or 14M
supply regulated
components:
leds:
green x1
red x1
resistors:
330 ohms x2 "R2..3"
10k x1 "R1"
switch (push on)
pins:
button = in3
green_led = out1 (output)
red_led = out2 (output)
uses:
debounce from switch_routines
end environment
Notice that very little of this would actually be used by the editor - it is mostly a giant multi-line comment (in a particular format) although more and more may be noticed by editor software or external programs as time goes by - e.g. revision control systems, aids to those preparing experiments for classes, etc.
The key is to encourage good documentation (including of the hardware) in a simple way that can be expanded in usefulness later.
Mark