Hi, Gecko
Some little gags here and there ... but try it !!!
'12F675
@ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF ' clock source internal
OPTION_REG.5 = 0
DEFINE PULSIN_MAX 2500
DEFINE OSCCAL_1K 1
CMCON = 7 'Tout digital pour 12F675
ADCON0 = 0 'ADC off "
ANSEL = 0
VRCON = 0
Pulselen var Byte ' Pulselen can be 0 - 255, 100 = 1 ms, 200 = 2 ms
Init var Byte ' Init used to flash LED
Compte var Byte
In var GPIO.3
Led var GPIO.1
Clear ' set all variables = 0
TRISIO = %001000
High Led
ReadPWM:
PulsIn In, 1,Pulselen ' pin 4 - read high pulse length, times out after .65535 seconds
If Pulselen < 80 OR Pulselen > 220 Then
Pause 15
Compte = Compte + 1
IF Compte // 16 THEN
Pulsout Led, 10000
ENDIF
Else
HIGH Led
ENDIF
GoTo ReadPWM
END
I'll do better next time ...
Alain
PS: ... breadboard verified .... Yess !!!
Last edited by Acetronics2; - 26th August 2006 at 10:25.
************************************************** ***********************
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