Hi, Malc
What are you looking for exactly ???
The basic reading is simply achieved only with a PULSIN Command ....
Alain
Hi, Malc
What are you looking for exactly ???
The basic reading is simply achieved only with a PULSIN Command ....
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 " !!!
*****************************************
Short example:
Code:'------------------------------------------------------------------------------- '------------------------------------------------------------------------------- @ DEVICE PIC12F683, MCLR_OFF @ DEVICE PIC12F683, INTRC_OSC_NOCLKOUT @ DEVICE PIC12F683, WDT_OFF @ DEVICE PIC12F683, BOD_ON @ DEVICE PIC12F683, PWRT_ON '------------------------------------------------------------------------------- OSCCON = %01110000 ' Internal 4MHz osc ADCON0 = 0 ' A/D off CMCON0 = 7 ' Comparators off ANSEL = 0 ' Set all digital WPU = 0 ' Internal pull-ups = off OPTION_REG = %10000000 ' Pull-ups = off, GPIO.2 = I/O, prescaler to Timer1 GPIO = %00000000 ' All outputs = 0 on boot TRISIO = %00001000 ' GPIO.3 input, GPIO.0,2,3,4,5 output '------------------------------------------------------------------------------- signal VAR GPIO.3 pulse VAR BYTE '------------------------------------------------------------------------------- main: PulsIn signal, 1, pulse ' reads signal from receiver IF (pulse >= 148) AND (pulse <= 152) Then Low GPIO.0 ' turns LED off Else High GPIO.0 ' turns LED on EndIF GoTo main '------------------------------------------------------------------------------- End '------------------------------------------------------------------------------- '-------------------------------------------------------------------------------
Thanks for the code example. I'll hook up a receiver to my Easypic5 board and have a play... I'll also have a read of the online manual![]()
Dan,
I've tried the following with a 12F675 and whilst it compiles and loads OK it doesn't do anything
GPIO.0 is high all the time. GPIO.3 glows faint on the Easypic and brightens when the switch on the TX is activated indicating the PPM signals are being received on GPIO.3Code:@ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON __CONFIG _INTRC_OSC_NOCLKOUT _WDT_ON _PWRTE_ON _MCLRE_OFF _BODEN_ON OPTION_REG = %10000000 ' Pull-ups = off, GPIO.2 = I/O, prescaler to Timer1 GPIO = %00000000 ' All outputs = 0 on boot TRISIO = %00001000 ' GPIO.3 input, GPIO.0,2,3,4,5 output ANSEL = 0 ' Set all digital WPU = 0 ' Internal pull-ups = off '------------------------------------------------------------------------------- signal VAR GPIO.3 pulse VAR BYTE '------------------------------------------------------------------------------- main: PulsIn signal, 1, pulse ' reads signal from receiver IF (pulse >= 148) AND (pulse <= 152) Then Low GPIO.0 ' turns LED off Else High GPIO.0 ' turns LED on EndIF GoTo main '------------------------------------------------------------------------------- End
I've also loaded some hex generated from assembly that works so the connections are sound. Any ideas ???
Edit:
This seems to work
seems the range between >= and <= was the issueCode:main: PulsIn signal, 1, pulse ' reads signal from receiver IF (pulse >= 100) AND (pulse <= 160) Then Low GPIO.0 ' turns LED off Else High GPIO.0 ' turns LED on EndIF GoTo main
There was no issue, Malc
Led OFF for Neutral , ON for everything else.
a bit surprising, but ... it is !
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 " !!!
*****************************************
No issue, just the the original range didn't work. Once I changed the values between the <= and >= then it worked !
Bookmarks