Shop OBEX P1 Docs P2 Docs Learn Events
basic stamp program of test — Parallax Forums

basic stamp program of test

bahaeddinebahaeddine Posts: 1
edited 2013-04-10 08:20 in BASIC Stamp
this programe can make a test transmission frequency on a port (phone line), the test result on 3 Step
300HZ, 1000HZ, 3400Hz
THE problem is that I want TO GO to the next test (100hz) if the current test is finished (300), without waiting for test time "" break ""
plees help .


'{$STAMP BS2sx}
' {$PBASIC 2.5}
' {$PORT COM9}
FreqSelect VAR Nib
irFreq VAR Word
irDetect VAR Bit
Distance VAR Nib






DTMF PIN 5 ' DTMF/Freq output
IsOn CON 1 ' AKarim is active high
IsOff CON 0 ' AKarim is active LOW
INPUT 0
INPUT 1
INPUT 2 ' same as OUTPUT 0
OUTPUT DTMF
DO
'DEBUG CLS
DEBUG "ETATS de cmd-BS2", CR,
" cmd-BS2_1 = ", BIN1 IN0,
" cmd-BS2_2 = ", BIN1 IN1,
" cmd-BS2_3= ", BIN1 IN2,CR
IF IN0=0 AND IN1=0 AND IN2=0THEN
DEBUG CLS,
" Objet", CR,
"FREQUENCE Dectect

Comments

  • bsjohnbsjohn Posts: 19
    edited 2013-04-10 08:20
    If I understand your question correctly, you want to run subsequent tests, the FREQOUT statements, when the earlier test is done. For example, if this condition is true:
    ELSEIF IN0=0 AND IN1=1 AND IN2=0 THEN
    DEBUG "Freq 300Hz " ,CR 'Transmission 300Hz FXS/FXO
    FREQOUT 5, 10000, 300, 0
    you want to jump right to:
    DEBUG "Freq 1000Hz " ,CR
    FREQOUT 5, 10000, 1000, 0
    and bypass the previous ELSEIF statement ( IN0=1 AND IN1=1 AND IN2=0 ).

    If that's the case you could do something like this but it increases the size of your program.
    ELSEIF IN0=0 AND IN1=1 AND IN2=0 THEN
    DEBUG "Freq 300Hz " ,CR 'Transmission 300Hz, 1000, 3400, 440 FXS/FXO
    FREQOUT 5, 10000, 300, 0
    DEBUG "Freq 1000Hz " ,CR
    FREQOUT 5, 10000, 1000, 0
    DEBUG "Freq 3400Hz " ,CR
    FREQOUT 5, 10000, 3400, 0
    DEBUG "Freq 440Hz " ,CR
    FREQOUT 5, 10000, 440, 0

    ELSEIF IN0=1 AND IN1=1 AND IN2=0 THEN 'Transmission 1000Hz, 3400hz, 440hz FXS/FXO
    DEBUG "Freq 1000Hz " ,CR
    FREQOUT 5, 10000, 1000, 0
    DEBUG "Freq 3400Hz " ,CR
    FREQOUT 5, 10000, 3400, 0
    DEBUG "Freq 440Hz " ,CR
    FREQOUT 5, 10000, 440, 0

    ELSEIF IN0=0 AND IN1=0 AND IN2=1 THEN 'Transmission 3400Hz, 440Hz FXS/FXO
    DEBUG "Freq 3400Hz " ,CR
    FREQOUT 5, 10000, 3400, 0
    DEBUG "Freq 440Hz " ,CR
    FREQOUT 5, 10000, 440, 0

    ELSEIF IN0=1 AND IN1=0 AND IN2=1 THEN 'Transmission 440Hz FXS/FXO
    DEBUG "Freq 440Hz " ,CR
    FREQOUT 5, 10000, 440, 0

    If size is a concern, consider rewriting your code with GOTO/GoSUB statements so redundant statements are not duplicated and to control flow.
Sign In or Register to comment.