picaxe programming

Associate
Joined
27 Aug 2006
Posts
260
hi form my gcse project at school i have made an alarm with a simple circuit cnsisting of a 18x chip
it has 3 outputs
output 0 = led
output 1 = led
output 5 = diren running through a npn transistor

i has 5 inputs
input 0 = ptm (for alarm code)
input 1 = ptm (for tamper proff switch)
input 2 = proximity switch
input 6 = ptm (for aarm code)
input 7 = ptm (for alrm code)

i would like to do if input 1 or 2 are pressed then it would set the leds flashing and the siren sounding whille this is happening i would like to be able to push in a code using input (0,6,7) i have been trying for 4 days and haven't got very far so would u plz help i have a simple prog up to yet but doesnt work here it is


main:

if input1 = 1 then break
if input2 = 0 then break
goto main

break:
high 0
high 1
high 5
if input0 = 1 then first
goto break
first:
if input6 = 1 then second
goto first

second:
if input7 = 1 then third
goto second

third:
if input7 = 1 then forth
goto third

forth:
if input6 = 1 then fifth
goto forth

fifth:
if input0 = 1 then sixth
goto fifth

sixth:
low 0
low 1
low 5
goto main



ps sorry for the shocking spellings
 
Isn't the deadline only a week or two away? Our AS Level one is next Thursday.

1) Can you use code tags? Makes it easier to read :p
2) What have you got working so far?
3) What is your code input device. Is it a numeric keypad?
4) By the sounds of it the issue you have is in having the PICAXE do several things at once, am I right?

Best way to go about doing this is write the procedure for flashing the LEDs (since this will have pause commands in) and then build into it the code for polling the keypad.
A warning though; because of the pause commands, if the keypad is pressed while the PICAXE is on a pause command nothing will happen so you'll want to choose a fairly high frequency for the LED flashing (to stop lag with the keypad). Otherwise I think you would end up having to develop a primitive time share system (assuming the keypad doesn't support interupts).

Hope this helps, null :)
 
Back
Top Bottom