THANK YOU !!!!
I will try the soft and I will keep You inform.
I write this code. It's something wrong :
- if I press but1 and rel1 goes low because of 'check' (over-load detected), but2 don't work not at all (must disconect power), and rel1 goes high only after two press of but1 ;
- if I press but2 and rel2 goes high, if I press but1 rel2 goes low ;
- if I press but2 and rel2 goes low because of 'check' (over-load detected), but1 don't work not at all (must disconnect power), and rel 2 goes high only after two press of but2.
Can help me ? Thanks in advance.
btw: The 'check' subroutine works fine !
OOPS, my fault
In post #5 the lineShould have beenCode:GP3PressDone ; we're doneThat's how it get's out of the loop under those conditions.Code:GOTO GP3PressDone ; we're done
Sorry,
DT
In your LAST version, you missed the LOW statement.Code:if but1=1 and rel2=0 then high rel1 pause 20 while but1=1 call check wend pause 20 while but1 = 0 call check if rel1=0 then GOTO Btn1PressDone ; pause 10 endif wend LOW rel1 while but1=1 wend pause 20 endif Btn1PressDone:
DT
Thank You so much for help !
I think this is my worst project... I damage two PIC, now I have just one, and this project don't work, even with so much help...I write so many lines of code but nothing works right...
This is the last version. Bugs:
-if press but2, ON/OFF rel2 works fine, but if I press but1 after but2, then rel2 goes OFF and nothing works more, need to disconect power
-if press but1, ON works, without OFF ; after OFF because of 'check' nothing works more, need to disconect power.
This is one nightmare !!!
Hope I don't became verry, verry boring...and I am really sorry about my english...
No arguments here.
I guess it's the language barrier.
I've built the circuit you described, and am using the following program ...
As far as I can tell, it does exactly what you want it to do.
Code:@ DEVICE PIC12F675, intrc_osc_noclkout, wdt_OFF, pwrt_on, mclr_off, bod_off DEFINE OSC 4 DEFINE ADC_BITS 10 DEFINE ADC_CLOCK 3 DEFINE ADC_SAMPLEUS 50 CMCON = 7 OPTION_REG = %10000110 TRISIO = %00011110 ANSEL = %00011000 ADCON0 = %10001101 adval var Word vt var word but1 var gpio.3 but2 var gpio.2 rel1 var gpio.5 rel2 var gpio.0 main: rel1=0 rel2=0 btn1: if but1=1 and rel2=0 then high rel1 pause 20 while but1=1 call check wend pause 20 while but1 = 0 call check if rel1=0 then GOTO Btn1PressDone ; pause 10 endif wend LOW rel1 while but1=1 wend pause 20 endif Btn1PressDone: btn2: if but2=1 and rel1=0 then high rel2 pause 20 while but2=1 call check wend pause 20 while but2 = 0 call check if rel2 = 0 then GOTO Btn2PressDone ; pause 10 endif wend low rel2 while but2=1 wend pause 20 endif Btn2PressDone: GOTO MAIN check: adcin 3, adval vt=adval * 5000 vt=div32 1023 if vt > 1250 then gpio.0=0 gpio.5=0 endif return end
DT
Bookmarks