PICAXE Manual Section 2

Total Page:16

File Type:pdf, Size:1020Kb

PICAXE Manual Section 2 www.picaxe.com BASIC COMMANDS Section 2 1 Contents Introduction. ................................................................................................... 4 PICAXE Software ............................................................................................... 4 Labels ............................................................................................................ 5 Comments ....................................................................................................... 5 Constants ........................................................................................................ 6 Symbols .......................................................................................................... 6 Directives ....................................................................................................... 7 Variables - General ......................................................................................... 10 Variables - Storage ......................................................................................... 11 Variables - Scratchpad .................................................................................... 12 Variables - System .......................................................................................... 13 Variables - Special function ............................................................................. 14 Variables - Mathematics .................................................................................. 22 Variables - Unary Mathematics ......................................................................... 25 Input / Output Pin Naming Conventions ........................................................... 27 adcconfig ...................................................................................................... 28 adcsetup ....................................................................................................... 29 backward ...................................................................................................... 34 bcdtoascii ..................................................................................................... 35 bintoascii ..................................................................................................... 36 booti2c ........................................................................................................ 37 branch .......................................................................................................... 39 button .......................................................................................................... 40 calibadc (calibadc10) ..................................................................................... 42 calibfreq ....................................................................................................... 43 clearbit ......................................................................................................... 44 compsetup .................................................................................................... 45 count ........................................................................................................... 50 daclevel ........................................................................................................ 51 dacsetup ....................................................................................................... 52 debug ........................................................................................................... 54 dec ............................................................................................................. 55 disablebod .................................................................................................... 56 disabletime ................................................................................................... 57 disconnect .................................................................................................... 58 do...loop ...................................................................................................... 59 doze ............................................................................................................. 60 eeprom (data) ............................................................................................... 61 enablebod ..................................................................................................... 62 enabletime .................................................................................................... 63 end ............................................................................................................. 64 exit ............................................................................................................. 65 for...next ...................................................................................................... 66 forward ......................................................................................................... 67 fvrsetup ........................................................................................................ 68 get ............................................................................................................. 69 gosub (call) .................................................................................................. 70 goto ............................................................................................................. 71 hi2cin .......................................................................................................... 72 hi2cout ........................................................................................................ 74 hi2csetup ..................................................................................................... 76 hi2csetup - slave mode (X2 parts only) ............................................................. 76 hi2csetup - master mode ................................................................................. 78 halt ............................................................................................................. 80 hibernate ...................................................................................................... 81 high ............................................................................................................. 83 high portc ..................................................................................................... 84 hintsetup ...................................................................................................... 85 hpwm ........................................................................................................... 86 (c) Revolution Education Ltd. Web: www.picaxe.com 1 revolution All rights reserved. Version 7.9 02/2012 www.picaxe.com BASIC COMMANDS Section 2 2 hpwmduty ..................................................................................................... 90 hserin ........................................................................................................... 91 hserout ......................................................................................................... 93 hsersetup ...................................................................................................... 94 hspiin (hshin) ............................................................................................... 96 hspiout (hshout) ............................................................................................ 97 hspisetup ...................................................................................................... 98 i2cslave ...................................................................................................... 102 if...then \ elseif...then \ else \ endif .............................................................. 104 if...then {goto} ........................................................................................... 106 if...and/or..then {goto} ................................................................................ 106 if porta...then {goto} ................................................................................... 107 if portc...then {goto} ................................................................................... 107 if...then exit ............................................................................................... 108 if...and/or...then exit ................................................................................... 108 if...then gosub ............................................................................................ 109 if...and/or...then gosub ................................................................................ 109 inc ........................................................................................................... 111 infrain ........................................................................................................ 112 infrain2 ...................................................................................................... 114 infraout ...................................................................................................... 115 input .......................................................................................................... 120 inputtype ..................................................................................................
Recommended publications
  • Introduction to Microcontrollers 9/16/2017
    Introduction to Microcontrollers 9/16/2017 Introduction to Microcontrollers June 2017 Scott A. Theis — W2LW Rev 5 (08/02/2017) What’s it all about • How to get started • What are some of the common controller options • General introduction to terms and types • Input and Output • Information on getting started Sampling of Microcontrollers • tinyAVR — As little as 6 pins, over 1MHz • PICAXE — As little as 8 pins, up to 64MHz • Ardunio (ATMega) — Standalone or on board, 16+MHz • Raspberry Pi — Single-Board Computer, up to (and over) 1GHz • There are dozens of common microcontrollers Propeller BasicStamp 8051 MIP • There are a number of single-board computers: Beagle Bone NetDuino Intel Galileo ASUS Tinker Scott A. Theis, W2LW 1 Introduction to Microcontrollers 9/16/2017 Focus • Arduino and PICAXE— Microcontroller: • Well suited for specific application • Code is lightweight (so is memory) • Does not have an operating system per se • Raspberry Pi — Single-Board Computer: • Really a small computer with GPIO pins and lots of interface logic • Can be used for a wide spectrum of tasks • Lots of options and compute power Covering…. • Introduction, Jargon and Background • General Purpose Input and Output (GPIO) • Integrated Development Environment (IDE) • Some Examples Introduction, Background and Jargon Scott A. Theis, W2LW 2 Introduction to Microcontrollers 9/16/2017 The Arduino • Created as a simple, open source, easy to use platform • Developed in 2003 as a less costly replacement to the BASIC Stamp • Support has grown dramatically in the past
    [Show full text]
  • PICAXE Manual 1
    PICAXE Manual www.picaxe.com IMPORTANT! This PDF is designed to be used with the shortcut links (document outline) visible on the left hand side. Displaying these links makes it much easier to navigate through this manual! revolution www.picaxe.com GETTING STARTED Section 1 2 Contents About this manual ............................................................................................ 4 Software Overview ............................................................................................ 4 Software Comparison ........................................................................................ 5 Software Quick Choice Guide .............................................................................. 5 Third Party Software ......................................................................................... 5 Technical Support Forum ................................................................................... 5 Quick Start - Project Board PCB Preparation ......................................................... 6 Quick Start - Flashing an LED ............................................................................. 7 At a glance - specifications: .............................................................................. 8 At a glance - download circuit: .......................................................................... 8 At a glance - pinout diagrams (older parts): ........................................................ 9 At a glance - pinout diagrams (M2 parts): ........................................................
    [Show full text]
  • November 2019 DATTA VIC - 6Th December 2019: 5
    WELCOME Scorpio With the academic year drawing to a close most schools are well into their program planning for 2020. Please Technology contact Scorpio if we can help with this process. For 2020 orders see page 2. NEWSLETTER INSIDE THIS ISSUE All Scorpio’s comprehensive catalogues are online and are regularly updated. Page 1 STEM AT PRIMARY– END OF YEAR IDEAS STEM at Primary – End of year ideas Teacher Conferences & Workshops With the end of the year approaching students need Page 2 additional motivation to keep learning. Secondary Robot Buggy for PICAXE or We’ve put together some ideas that we believe would be ARDUINO perfect! Our online catalogues have many more ideas. Some items are available as kits but others are a mix and match to Page 3 suit your requirements. This Month’s Q&A Technology Tips: Magnetism – a range of magnets available Picaxe and Arduino Simple electrical circuits Simple vehicles – The Blue Brothers series provides Page 4 a fun and educational learning experience. Deconstruction – children love to take things apart Wordsearch – Design and Technology (to tinker). Parts can be used in a Makerspace area to Page 5 and 6 construct a huge range of items. Try this idea: construct Art works. These could be sold or auctioned Article – Clocks – A Journey Through to raise money for equipment or class projects. The Time & Craftsmanship students could be entrepreneurs during this process – make, market, advertise, sell. Our office will be closed from Outside activities could include: 3 p.m. on the 20th December 2019 until 9.00 a.m.
    [Show full text]
  • Warf Electronics Shopping - Catalog Electronics Shopping IOIO for Android FR4 1.6Mm Blank PCB Board Single Side 6X6" 1Oz
    เลขประจําตัวผูเสียภาษี 3271161630 Warf Electronics Shopping - Catalog Electronics Shopping IOIO for Android FR4 1.6mm Blank PCB board Single Side 6x6" 1oz. ELE-SP072006172 ELE-WA491996121 1,950.00 THB 50.00 THB IN-14 RUSSIAN NIXIE TUBES IN-14 IN14 NEW NOS Line Iso-Regulation IRG-600 ELE-WA491996260 ELE-WA491986075 400.00 THB 27,500.00 THB LC-3 Purist Line Conditioner PS-8 Clean Power Station ELE-WA491986053 ELE-WA491986069 11,650.00 THB 5,850.00 THB ISO Clean Power Station ชุดกรองไฟ NFC-3 ELE-WA491986071 ELE-WA491986072 12,600.00 THB 8,600.00 THB ชุดกรองไฟ NFC2 ชุดกรองไฟ NFC-1 ELE-WA491986073 ELE-WA491986074 11,500.00 THB 14,500.00 THB อุปกรณชวยขจัดสัญญาณรบกวน LI-500 เครื่องกรองไฟ LC-1 MKII ELE-WA491986076 ELE-WA491986077 7,800.00 THB 4,890.00 THB CPS-8 SE Clean Power Station CPS-8 Clean Power Station ELE-WA491986054 ELE-WA491986068 8,800.00 THB 6,800.00 THB Line Iso-Regulation IRG-600 Black PS-8 SE Clean Power Station ELE-WA491986070 ELE-WA491986067 28,500.00 THB 7,800.00 THB AudioengineUSA N22 Amplifier / Headphone Amp Bellari HA540 Tube Headphone Amp ELE-WA491976078 ELE-WA491976079 7,500.00 THB 11,500.00 THB Burson Headphone Amp 160 Cavalli Audio Liquid Fire Headphone Amp (pre order) ELE-WA491976081 ELE-WA491976082 26,900.00 THB 49,900.00 THB Centrance DACmini Centrance DACport 24/96 USB Headphone Amp ELE-WA491976083 ELE-WA491976084 29,500.00 THB 14,500.00 THB Creek Audio OBH-11 Headphone Amplifier Creek Audio OBH-21 Headphone Amplifier ELE-WA491976085 ELE-WA491976086 9,800.00 THB 14,500.00 THB Creek Audio OBH-21 SE Headphone Amplifier
    [Show full text]
  • List of Projects Using Raspberry Pi with Advance View: 1
    List of Projects using Raspberry Pi with advance view: 1. Mobile Remote Surveillance Camera This interesting project will cover all things required for the ultimate goal of building a mobile remote surveillance camera. https://youtu.be/6FrEs4C9D-Y This interesting but complicated project will cover things from designing building a robot, to advanced congurations in linux (raspberry pi) to building an Android application…... Listed under: Phone Projects 2. Android Controlled Toy Using Raspberry Motor Shield The terrain vehicle which is managed with raspberry pi, arduino and controlled vi android software. Story At the end of the project we will manage a terrain vehicle which controlled by android device's accelemoter sensor The project contains Motor shield, raspberry pi, arduino and dc…... Listed under: Motor Projects 3. GrovePi Windows IoT: LED Blink This tutorial shows the simplest thing that you can do with the GrovePi: Blink a LED. Introduction to GrovePi with Windows IOT: LED Blink Tutorial This tutorial shows the simplest thing that you can do with the GrovePi: Blink a LED. This a great…... Listed under: LED Projects 4. Azure IoT Hub nRF24L01 Windows 10 IoT Core Field Gateway Windows 10 IoT Core on RPI based nRF24L01 eld gateway which enable sensor nodes to securely & reliably upload telemetry to AzureIoT Hubs. Overview For school Internet of Things (IoT) projects I needed a robust eld gateway for uploading telemetry data from a number "cheap n…... Listed under: Home Automation Projects 5. Windows 10 IoT Core on Raspberry Pi 2 – Adafruit Sensor data Pushing data to Microsoft Azure Event hubs from Windows 10 IoT Core with Raspberry Pi-2 connected with the Adafruit 10DOF IMU This is my rst blog on Windows 10 IoT Core with Raspberry Pi-2 connected with the Adafruit 10DOF IMU (A combo board provides 3-axis…..
    [Show full text]
  • MICROCONTROLLER INTERFACING CIRCUITS 1 Section 3
    www.picaxe.co.uk MICROCONTROLLER INTERFACING CIRCUITS 1 Section 3 Contents About this manual .......................................................................................... 2 Microcontroller Interfacing Circuits ................................................................... 3 What is a PIC Microcontroller? .......................................................................... 3 What is a PICAXE microcontroller? ..................................................................... 3 Interfacing to the PICAXE Microcontroller .......................................................... 4 Note on the BASIC Code Samples ...................................................................... 5 Note on Component Selection .......................................................................... 5 Standard Interfacing Circuits ............................................................................ 6 Standard Circuits 1 - The Transistor Interfacing Circuit ........................................ 6 Standard Circuits 2 - Using a Darlington Driver IC ............................................... 7 Standard Circuits 3 - The Relay Interfacing Circuit .............................................. 8 Standard Circuits 4 - The Power MOSFET Interfacing Circuit ................................. 8 Output Device Interfacing ................................................................................ 9 Output Device 1 - Light Emitting Diode (LED) .................................................... 9 Output Device 2 - Signal Lamp
    [Show full text]
  • Bury the Hatchet, Unbury the Axe by Wouter Spruit (NL) Getting Started with PICAXE
    Elektor•Post Project No. 8 Bury the hatchet, unbury the axe By Wouter Spruit (NL) Getting started with PICAXE Microcontrollers can be used to add processing capabilities to any project, and off-the shelf microcontrollers are often used to fulfill a specific purpose. Programming a microcontroller with your own firmware gives you complete freedom to implement smart input and output for your projects. The PICAXE system gives any hobbyist the chance to program a microcontroller and inter- face it to peripherals with little hassle and at low cost. Figure 1. PICAXE chip sizes. What? Why? How? a range of accessories: from components, The PICAXE products are a range of Microchip breadboards, cams and gears to cables, I2C PIC microcontrollers programmed with a spe- peripherals, LCD screens and starter packs. cial firmware by Revolution Education [1]. The The website aims to offer everything neces- philosophy behind the PICAXE system is that sary to get started programming the PICAXE the best way to learn how to program and right away. The online store even offers kits to implement microcontrollers in a project is to build toys like such as robots based on PICAXE use a cheap system that doesn’t require a lot microcontrollers. All peripherals for sale come of experience but still offers complex interfac- with extensive documentation on how to inter- ing capabilities that make the microcontrol- face them with a (PICAXE) microcontroller. lers suitable for more advanced projects. The So even if you’re not using a PICAXE micro- PICAXE line offers a range of microcontrollers controller in your project, checking out this of different shapes and sizes, from simple store for components might be worthwhile.
    [Show full text]
  • BASIC COMMANDS Section 2 1
    www.picaxe.com BASIC COMMANDS Section 2 1 IMPORTANT! This PDF is designed to be used with the shortcut links (document outline) visible on the left hand side. Displaying these links makes it much easier to navigate through this manual! (c) Revolution Education Ltd. Web: www.picaxe.com 1 revolution All rights reserved. Version 7.9.2 10/2015 www.picaxe.com BASIC COMMANDS Section 2 2 Contents Introduction. ................................................................................................... 5 PICAXE Software ............................................................................................... 5 Labels ............................................................................................................ 6 Comments ....................................................................................................... 6 Constants ........................................................................................................ 7 Symbols .......................................................................................................... 7 Pre-Processor and Directives .............................................................................. 8 Variables - General ......................................................................................... 13 Variables - Storage ......................................................................................... 14 Variables - Scratchpad .................................................................................... 15 Variables - System .........................................................................................
    [Show full text]
  • EVERYDAY PRACTICAL ELECTRONICS Is Fully and Service Engineers Protected, and Reproduction Or Imitations in Whole Or in Part Are Expressly Forbidden
    Copyright Ó 2004, Wimborne Publishing Ltd (408 Wimborne Road East, Ferndown, Dorset, BH22 9ND, UK) and TechBites Interactive Inc., (PO Box 857, Madison, Alabama 35758, USA) All rights reserved. WARNING! The materials and works contained within EPE Online — which are made available by Wimborne Publishing Ltd and TechBites Interactive Inc — are copyrighted. You are permitted to make a backup copy of the downloaded file and one (1) hard copy of such materials and works for your personal use. International copyright laws, however, prohibit any further copying or reproduction of such materials and works, or any republication of any kind. TechBites Interactive Inc and Wimborne Publishing Ltd have used their best efforts in preparing these materials and works. However, TechBites Interactive Inc and Wimborne Publishing Ltd make no warranties of any kind, expressed or implied, with regard to the documentation or data contained herein, and specifically disclaim, without limitation, any implied warranties of merchantability and fitness for a particular purpose. Because of possible variances in the quality and condition of materials and workmanship used by readers, EPE Online, its publishers and agents disclaim any responsibility for the safe and proper functioning of reader-constructed projects based on or from information published in these materials and works. In no event shall TechBites Interactive Inc or Wimborne Publishing Ltd be responsible or liable for any loss of profit or any other commercial damages, including but not limited to special, incidental, consequential, or any other damages in connection with or arising out of furnishing, performance, or use of these materials and works. ISSN 0262 3617 PROJECTS .
    [Show full text]
  • PICAXE Power!
    PICAXE Power! Robert C. Mazur, VA3ROM, http://my.tbaytel.net/va3rom I’m not talking about the versatile pickaxe hand tool but the versatile PICAXE PIC microcontroller integrated circuit. This article is to introduce the computer programming and electronic use of this powerful series of microchips and the other products developed specifically for them. Background The PICAXE was created in 1999, by the British company Revolution Education (Rev Ed) as a method of teaching computer programming and electronics in schools. The From left to right: 14-pin, 18-pin and 8-pin first microchip (PIC16F872) could be PICAXE chips, compared to a penny. They programmed using 5 volts instead of 12 volts are small but very powerful! and didn’t require a special chip “burner”. In 2002, the company introduced the PICAXE- 08 microcontroller and hasn’t looked back! Rev Ed provides the free computer program (a form of Visual Basic) for creating PICAXE specific programs and related design software. The PICAXE operates between a low of 1.8 volts (M2 series) to 3.6 volts (M series) up to a maximum of 5 volts and can be programmed in circuit instead of having to remove and reprogram it. They are built upon the older PIC (peripheral interface controller) chip that includes a special loader program that executes your program and the chip can be burned over and over until you get it right. They come in various sizes with increasing memory capacity and abilities, from the 8-pin Rev Ed Schools Experimenter Board to the 40-pin PICAXE. Most start learning on (AXE092) is a self-contained kit to the 8-pin M series and new M2 series as they program and experiment with the 8-pin have a smaller selection of available functions PICAXE.
    [Show full text]
  • Elektronikladen | ELMICRO Sparkfun Preisliste
    Elektronikladen | ELMICRO http://elmicro.com SparkFun Preisliste November 2011 EVP EUR netto BOB-00099 Real Time Clock Module 11,20 BOB-00193 Adapter board for Microchip ICD and ICD2 4,50 BOB-00194 Adapter board for SFE ICSP Connections 3,00 BOB-00196 Breakout Board for RF-24G Transceiver 0,80 BOB-00198 Breakout Board for CP2102 USB to Serial 16,50 BOB-00199 Breakout Board for CP2103 USB to Serial w/ GPIOs 16,50 BOB-00203 Breakout Board for Photo Interrupter CNZ1120 0,80 BOB-00204 Breakout Board for SD-MMC Cards 7,50 BOB-00493 Breakout Board CF Compact Flash Cards - Slim 7,50 BOB-00494 SOIC to DIP Adapter 8-Pin 2,20 BOB-00495 SOIC to DIP Adapter 20-Pin 3,00 BOB-00496 SOIC to DIP Adapter 28-Pin 3,00 BOB-00497 SSOP to DIP Adapter 8-Pin 2,20 BOB-00498 SSOP to DIP Adapter 16-Pin 2,20 BOB-00499 SSOP to DIP Adapter 20-Pin 3,00 BOB-00500 SSOP to DIP Adapter 28-Pin 3,00 BOB-00544 Breakout Board for microSD Transflash 7,50 BOB-00549 GPIB-USB Controller 166,70 BOB-00573 Breakout Board for SIM Cards 11,20 BOB-00716 Breakout Board for RJ45 1,50 BOB-00717 SOT23 to DIP Adapter 0,70 BOB-00718 Breakout Board for FT232RL USB to Serial 11,20 BOB-00747 Breakout Board for LMD1820x H-Bridge 1,50 BOB-00765 Ethernet Interface Board - ENC28J60 33,30 BOB-07841 Breakout Board for FT245RL USB to FIFO 13,50 BOB-08130 Breakout Board for PCF8575 I2C Expander 9,00 BOB-08276 Breakout Board for XBee Module 2,20 BOB-08508 AVR Programming Adapter 1,10 BOB-08551 Breakout Board for FT232RQ USB to Serial 25,60 BOB-08552 Breakout Board for Serial DB9 1,10 BOB-08595 Spartan
    [Show full text]
  • Dcc2016 Rest.Indd
    Introduction To The PICAXE By Darrell Davis KT4WX - ARRL Technical Specialist 6350 Mills Road, Fort Meade, FL 33841-9584 Email: [email protected] Phone (863) 245-9923 ABSTRACT The purpose of this paper is to introduce the amateur radio operator to designing microcontroller based projects with the PICAXE microcontroller. Being the PICAXE microcontroller is programmed in BASIC programming language, the ease of learning to use the device for the newcomer as well as the radio amateur who has programmed in BASIC programming in times past, is much easier. This paper will explain what PICAXE microcontrollers are and how to get started in using them in project designs. Keywords: PIC, PICAXE, Microcontroller, BASIC, Programming. I. INTRODUCTION TO THE PICAXE History of the PICAXE Microcontroller: The PICAXE microcontroller was first introduced in 1999 by Revolution Education Ltd. (also known by the abbreviation Rev-Ed), a British company. The PICAXE microcontroller is a PIC Microcontroller pre-loaded with a BASIC interpreter developed by Rev-Ed. Since that time Rev-Ed. Has made many improvements to the BASIC interpreter and has added more PICAXE controllers to their product line as well. Advantages of using the PICAXE versus the PIC or other microcontrollers: (1) For the amateur radio operator who is new to programming microcontrollers, the PICAXE is a great way to get started in programming with microcontrollers, because it is programmed in a customized version of BASIC and is easier for newcomers to get started with.. The PIC Microcontroller by Microchip, the AVR microcontroller by Atmel Semiconductor, or other 8 bit microcontroller lines are programmed with a derivative of the C or C++ programming language.
    [Show full text]