A couple newbie start-up questions.

Artie2

New Member
Hi everyone. I just got my first 08M starter kit and have a couple questions as I read over the manual.

1. Even though the Picaxe initializes itself to a certain pre-determined start-up state, do you generally start your program with an initialization routine? In other words, do you define certain pins as inputs or outputs, (just to be sure), even though thats the default power-up state? I suppose another way to say this is . . . is the default power-up state reliable?

2. Can you use the "dirs =" command to assign I/O to pins that are already hardware set? For example, is there any problem with issueing the command: "let dirs = %00001111" even though pin 3 is hard-wired to be an output?

3. I know that in basic, the "LET" command is archaic and never used. Is this also true in Picaxe programming? Can I omit it in all cases?

Thanks all. Looking forward to playing with this thing. :)
 

womai

Senior Member
1. The startup state is reliable (meaning it will always be the same at each startup). Nevertheless, explicitly initializing things your program cares about is a good idea. It makes the program more readable (because it makes things more obvious), but more importantly, it makes you program immune in changes in the underlying Picaxe firmware (which may cause the defaul startup state to change).

2. Using DIRS again on pins that are already set in the desired direction does no harm.

3. You can omit the "let" command and just write e.g. b0=123
 
Top