20M2 Cheat sheet

grimjordax

New Member
I do a lot of platform jumping between different projects and dialects of languages and may not touch a picaxe for a while. I found that whenever I sat back down to write up a quick program for a picaxe project I found myself pouring over the manuals again just to jog my memory about the proper syntax. I was wishing I just had a quick ref card to jog my brain and save me some time. I couldn't really find what I was looking for so I decided to compile something myself. It is by no means complete and does not contain every single command or syntax variant. It was just the most important stuff and is tailored specifically to the 20M2, my favorite picaxe. I thought I would share it. Feel free to mod and tailor it to your needs. I'm sure I will change it as I use it. This is the first rev.
 

Attachments

hippy

Technical Support
Staff member
Pressing the "F1" function key in Programming Editor will bring up the Quick Syntax List which is also useful for a quick recap of commands and syntax.
 

Circuit

Senior Member
A very useful aide memoire indeed. PICAXE Editor 6 does give a pop-up hint on the syntax of each command if you hover over it whilst writing a program, but your additional notes are most useful. It makes me wonder if the Editor could not be improved by giving context-sensitive syntax hints according to the PICAXE chip that has been selected with an additional line or two giving the purpose/limitations etc. of the command, as you have done, which would also be helpful. I know just what you mean when you highlight the problems of platform-jumping and having to remember syntax details again which is why I appreciate the pop-up hints so much in the new editor.

edit: Hippy, I don't know how I missed that! Now you have pointed me to it, the F1 listing is excellent and really helpful but I had not cottoned-on to that one! I always hit the "help" dialogue at the top right of the bar - perhaps it would be sensible to add a reference in this general help panel to the F1 key. This panel gives all the details for the manuals, on-line help, tech back up etc. but does not refer the user to the simple press of the F1 key! The simplest of updates, I think, and a worthy one?
 
Last edited:

jims

Senior Member
I've put a strip of masking tape above the function keys on my keyboard and written the description eg:
'F1, "SYNTEX"; F4, "SYNTEX CHECK"; F5, "DOWNLOAD PROGRAM"F6,"DEBUG"; F8, "SERIAL TERMINAL"; etc. This is so helpful to me that I'l probably leave it there even after I learn them. Jims
 

lbenson

Senior Member
Nice document, thanks. One suggested emendation: "bptr" for the M2 devices is a word variable, so it can be used to access all of ram--bytes 0-511.
 

AllyCat

Senior Member
Hi,

Yes indeed, a useful document. Actually, I think bptr is only a "9-bit" register (i.e. to address the 512 bytes of RAM), but time (and task) and more usefully the other six "system" variables (S_Wn) are all 16-bit variables, giving more than 20 directly-addressable words in total, if needed.

However, aren't the "One Wire" commands (OWIN, etc.) only available on X2 devices (except by bit-bashing)?

Cheers, Alan.
 

lbenson

Senior Member
16-bit, it seems, though only 9 bits are used in accessing the available ram. In PE6
Code:
#picaxe 20m2

bptr = 16000
w1 = bptr
bptr = 0
sertxd(#bptr," ")
bptr = w1
sertxd(#bptr," ")
yields "0 16000".

The full 16 bits is not useful for accessing ram, but can be if you want bptr to be an additional word storage variable.
 

AllyCat

Senior Member
Hi,

Hmm, is that with the simulator or a real chip? And I wonder if PE5 and PE6 are the same?

My PE5 simulator yields "0 128" with your code (and "0" for bptr = 512 : sertxd(#bptr) ).

Cheers, Alan.
 
Top