Let Dirs

John F

Member
When I program for the 08M2, I use let dirs = %000 [etc]. That works andf passes syntax check. But when I go to program the 18m, and use let dirs = %111[etc] I get error 'Unknown symbol - dirs.

Does anyone have an idea of why this is happening?
 
The pins of portC on the newer M2 & X2 chips can be set individually to be either inputs or outputs. The 08M2 has just the one portC so you can use either the "let dirs" command or the "let dirsC" command to set this.
The pins on the older chips are all fixed to be either inputs or outputs. You can't set the pins as you would like to so the "let dirs" command is invalid.
You can see which of the 18X pins are inputs and which are outputs in the pdf manual 1 section "At a glance - pinout diagrams (older parts)"
 
The pins of portC on the newer M2 & X2 chips can be set individually to be either inputs or outputs. The 08M2 has just the one portC so you can use either the "let dirs" command or the "let dirsC" command to set this.
The pins on the older chips are all fixed to be either inputs or outputs. You can't set the pins as you would like to so the "let dirs" command is invalid.
You can see which of the 18X pins are inputs and which are outputs in the pdf manual 1 section "At a glance - pinout diagrams (older parts)"
Thanks! I'm using an old m18, which previously worked with let dirs, but if I have understood you correctly the technology has passed me by, the compiler has been updated and let dirs is no longer needed or supported for this part.

My next problem is that although the 08M2 chip programs perfectly well, when I try to load a program into the 18M I get a 'hardware not found' error message. Could this be related to the compiler being updated to work with the new chips?
 
when I try to load a program into the 18M I get a 'hardware not found' error message. Could this be related to the compiler being updated to work with the new chips?
No, that is not the issue. The Picaxe Editor software comes with an individual compiler for every picaxe chip that was ever sold.
e.g. I have the latest PE v6.2.0.0 installed and it has the "picaxe18m.exe" compiler for the 18M chip installed.

The 'hardware not found' error message means that PE is not able to communicate with the chip over the serial connection.
The are many reasons this can happen.
- As you have been programming the 08M2 chip I will assume that the USB-Serial cable and the Windows software to drive the cable are working don't need testing.
- You've switched from programming the 08M2 to programming the 18M chip so double-check that the download circuit connections to the 18M are correct.
- If there is an existing program on the 18M that is in a very tight loop then this can prevent the chip responding to PE. The fix for this is to do a hard-reset. Start the PE download and quickly disconnect and reconnect power to the 18M. Do this a few times to make sure.
 
Back
Top