
Originally Posted by
Russ Kincaid
I really appreciate your help, I hope you are not tired of my dumb questions!
I tried your program; the clock starts when power is applied but nothing happens when footsw is low.
> YOU must define what the pic does if ready is low !!! I Wrote something the program to run ... ( GOTO start ) ... so program just loops !!!
When footsw goes high, the clock stops and reset will not start it.
> No reason the clock stops ... except ...
> mmmhhh, I do not see PORTA settings anymore ...and is Reset tied to Vcc ???
> Got it ... we must add CMCON = 7 at the program top !!! to turn comparators OFF
I have to turn power off and on or if I put footsw low, the clock will start again, as long as footsw is low. I put the nap statement in to see if it was seeing that part of the program; it isn't.
I don't understand the WHILE - WEND, what is that doing?
> As long as READY = 0 does the following lines ... here, as there is nothing to do, it just verfies READY state ... and also allows interrupts !!!
TRISB = %00111111 'PORT B ALL INPUT, EXCEPT 6 & 7 OUTPUT
option_REG = %01111111 'enable weak pullups on port B
FOOTSW var portb.5 'Foot switch OR CCREADY must be high
READY var portb.4 'at start
T var word
J VAR WORD
RENCA var portb.7 'FREQUENCY OUTPUT TO J1 PIN 13
EJECT var portb.6 '100 mS PULSE TO J1 PIN 21
on interrupt goto poo
START:
LOW RENCA : LOW EJECT
WHILE READY = 0
WEND
GOTO START
DISABLE INTERRUPT
poo:
IF NOT FOOTSW THEN FALSE
nap 6
T = 100
freq:
toggle renca 'frequency should be 500 Hz (2mS period)
PAUSEus T*7 ' 1 mS at 4 mHz
GOTO freq
false:
RESUME
ENABLE INTERRUPT
end
> Pauseus 700 won't give 500 Hz ...
Alain
Last edited by Acetronics2; - 27th May 2006 at 12:46.
************************************************** ***********************
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 " !!!
*****************************************
Bookmarks