# 20 updated to our friend's desires ...
Alain
# 20 updated to our friend's desires ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
hi, the code works fine under slow speed, it will count up to 3 and go off the led for 1 s, then on back again.
Please see actual code.
I need much faster reading from the pic, other wise, it will count moreto go off, on breadboard, it may not even go on again.Code:DEFINE OSC 4 cnt VAR BYTE delay var byte boton VAR GPIO.2 mosfet VAR GPIO.1 ' ANSEL = 0 '12F675 for test CMCON = 7 OPTION_REG.7 = 0 'Pullups enabled WPU = %00000100 cnt = 0 GPIO = %00000110 ' Nosurprise startup ... TRISIO = %00000100 '****************************************************************************** Detect: 'Button presses W/Debounce ' delay = 0 BUTTON Boton ,0,255,0,delay,1,pressed ' Slow Things down GOTO Detect '****************************************************************************** Pressed: ' Some > 10ms press detected IF cnt <=1 Then 'tocount uptu 3, bigger values will add up. cnt = cnt + 1 ELSE cnt = 0 LOW mosfet PAUSE 1000 high mosfet ENDIF WHILE !Boton : WEND ' Wait Boton release !!! goto detect END
For some oscure reason, my Pbasic compiler, does not like the configuration line you put, after the OSCAL SETTING, in line one.
So I have to set it manualy, using software configuration bit facility.
See my circuit, but, instead of 2 only one led, on GP1, and Push boton on GP2.
Best regards.
Thanks Acetronics.
Last edited by gutisie; - 26th September 2010 at 12:21.
Hi,
Keep cool ... there's no miracle in that ...oooooomg!!!! you did it!!! it works!!!
If you need faster response ... forget about your pushbutton !!!Button bouncings will give a totally random functionning ...
another "detector" type has to be used.
Now, modified code reacts for 2 pushings only ???
The obscure reason is you use PM as an assembler and not MPASM with your Microcode IDE ...
Alain
Last edited by Acetronics2; - 26th September 2010 at 16:29.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Hi thanks for your response, much appreciated.
The compiler, i use is Pbasic?..with Mplab ide....these are at least the software names.
Do you need a screen capture of the compiling results?
And about the button...what type would you use?...I am absolutly clue less.....and desperate...and tyre...and bald....and...etc...
Any way....Ir sensors?...proximity switches?....
I once more depend on your wisdom master....![]()
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Hi Ace,
Thanks for your reply.
The button is pressed by the piston on a gear box. As i said on other post, my actual reading is 15 to 20 cycles per sec. And i need to stop the piston, after 3 cycles.
I have some Ir sensors. But putting them inside the gearbox or some where around, it is not a good idea.
Hence, buttons is the best for my application i think.
Thanks.![]()
Bookmarks