12.07.2015 Views

PICAXE Manual Section 1 - TechnoPujades - Free

PICAXE Manual Section 1 - TechnoPujades - Free

PICAXE Manual Section 1 - TechnoPujades - Free

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

www.picaxe.co.uk<strong>Section</strong> 1 45GETTING STARTEDGeneral Purpose Variables.There are 14 or more general purpose byte variables. These byte variables arelabelled b0, b1 etc. Byte variables can store integer numbers between 0 and 255.Byte variables cannot use negative numbers or fractions, and will ‘overflow’without warning if you exceed the 0 or 255 boundary values (e.g. 254 + 3 = 1)(2 - 3 = 255)However for larger numbers two byte variables can be combined to create a wordvariable, which is capable of storing integer numbers between 0 and 65535.These word variables are labelled w0, w1 etc, and are constructed as follows:w0 = b1 : b0w1 = b3 : b2w2 = b5 : b4w3 = b7 : b6w4 = b9 : b8w5 = b11 : b10w6 = b13 : b12 etc.Therefore the most significant byte of w0 is b1, and the least significant byte ofw0 is b0.In addition bytes b0 and b1 (w0) are broken down into individual bit variables.These bit variables can be used where you just require a single bit (0 or 1) storagecapability.b0b1= bit7: bit6: bit5: bit4: bit3: bit2: bit1: bit0= bit15: bit14: bit13: bit12: bit11: bit10: bit9: bit8X1 and X2 parts also support bit16-bit31 (b2-b3)You can use any word, byte or bit variable within any mathematical assignmentor command that supports variables. However take care that you do notaccidentally repeatedly use the same ‘byte’ or ‘bit’ variable that is being used aspart of a ‘word’ variable elsewhere.All general purpose variables are reset to 0 upon a program reset.revolution(c) Revolution Education Ltd. Email: info@rev-ed.co.uk Web: www.rev-ed.co.ukVersion 6.9 07/2009All rights reserved.45

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!