Shop OBEX P1 Docs P2 Docs Learn Events
help!!-- coding question — Parallax Forums

help!!-- coding question

ArchiverArchiver Posts: 46,084
edited 2001-01-23 19:20 in General Discussion
the purpose of this code is to read the input from the input
pins under the mode condition. depending on the mode the
output is one of three circuits attached to the stamp. the
circuits are a buzzer (like piezo buzzer), a led and a ISD1000A
voice playback chip.

the input modes are from an attached circuit. the detection
circuits (alarms) are also from external attached circuits
attached to the specified pins.

how long is the time duration when i say :
pause 25
pause 100
etc....

here is the code:

; variable declarations
mode var nibble
alarm var nibble
motion var alarm.bit0
door var alarm.bit1
glass var alarm.bit2

; constant and pin declarations
mode.bit0 con 5
mode.bit1 con 6
mode.bit2 con 7
mode.bit3 con 8
alarm.bit0 con 9
alarm.bit1 con 10
alarm.bit2 con 11
alarm.bit3 con 12
buzz con 13
light con 14
pin0 con 15
pin1 con 16
pin5 con 17
pin6 con 18

; program
mode = INA
GOSUB check1
end


Check1:
BRANCH mode,[noparse][[/noparse]check1, check1, check1, delay, check1, check1,
check1, check1, check1, check1, check1, check1, check,
check1, check1, check1]
alarms = INA
RETURN

Delay:
pause 900
RETURN

Check:
BRANCH alarms,[noparse][[/noparse]check, mess, mess, alarm, mess, alarm, alarm,
alarm, light, alarm, alarm, alarm, alarm]
RETURN

LED:
low light
pause 250
high light
RETURN

Mess:
BRANCH add,[noparse][[/noparse]Mess, A2, A1, Mess]
RETURN

A2:
high pin0
high pin5
pause 25
low pin5
pause 25
low pin6
pause 600
high pin6
low pin0
RETURN

A1:
high pin1
high pin5
pause 25
low pin5
pause 25
low pin6
pause 600
high pin6
low pin1
RETURN

Alarm:
low buzz
pause 50
high buzz
RETURN
Sign In or Register to comment.