beautypg.com

Elenco Snap Circuits SnapMicro I Deluxe ® User Manual

Page 68

background image

67

Program in Basic for Green Power Meter.

The program will take 24 hours before it records the first day’s cost. To speed up program for testing

purposes, change the second pause from 59940 to 1. After testing replace original value.

setint

Syntax:

SETINT OFF

SETINT input,mask

- input is a variable/constant (0-255) which specifies input condition.

- mask is variable/constant (0-255) which specifies the mask
Function:

Interrupt on a certain inputs condition.
Information:

The setint command causes a polled interrupt on a certain input pin / flags

condition.

A polled interrupt is a quicker way of reacting to a particular input combination.

It is the only type of interrupt available in the PICAXE system. The inputs port is

checked between execution of each command line in the program, between each

note of a tune command, and continuously during any pause command. If the

particular inputs condition is true, a ‘gosub’ to the interrupt sub-procedure is

executed immediately. When the sub-procedure has been carried out, program

execution continues from the main program.

The interrupt inputs condition is any pattern of ‘0’s and ‘1’s on the input port,

masked by the byte ‘mask’. Therefore any bits masked by a ‘0’ in byte mask will be

ignored.

e.g.

to interrupt on input 3, high only in binary format

high only Input 3 Input 2 Input 1 Input 0

to interrupt on input 1 low only

to interrupt on input 0 high, input 1 high and input 2 low

128 64 32 16 8 4 2 1 or 2+1=3

4+2+1=7

add position values that are ones to convert from binary to decimal.

Change the word “decimal” to a “.” before downloading.

Lamp Wattage

Cost per kilowatt

hour to nearest
penny.

This manual is related to the following products: