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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

www.picaxe.co.uk<strong>Section</strong> 1 72GETTING STARTEDExample:setint %10000000,%10000000‘ activate interrupt when pin7 only goes highmain:low 1pause 2000goto main‘ switch output 1 off‘ wait 2 seconds‘ loop back to startinterrupt:high 1if pin7 = 1 then interruptpause 2000setint %10000000,%10000000return‘ switch output 1 on‘ loop here until the‘ interrupt cleared‘ wait 2 seconds‘ re-activate interrupt‘ return from subIn this example an LED on output 1 will light immediately the input is switchedhigh. With a standard if pin7 =1 then.... type statement the program could takeup to two seconds to light the LED as the if statement is not processed during thepause 2000 delay time in the main program loop (standard program shownbelow for comparison).main:low 1pause 2000if pin7 = 1 then sw_ongoto main‘ switch output 1 off‘ wait 2 seconds‘ loop back to startsw_on:high 1‘ switch output 1 onif pin7 = 1 then sw_on‘ loop here until the condition is clearedpause 2000‘ wait 2 secondsgoto main‘ back to main looprevolution(c) Revolution Education Ltd. Email: info@rev-ed.co.uk Web: www.rev-ed.co.ukVersion 6.9 07/2009All rights reserved.72

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

Saved successfully!

Ooh no, something went wrong!