12f675_fuse_about_to_blow!


Closed Thread
Results 1 to 40 of 929

Hybrid View

  1. #1
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Have got the night time trigger to send the Visits_total over from the TX to RX working.

    It works on a 555 timer chip instead of an op-amp Schmitt trigger (very handy same voltage for 555 & PIC).The cct dia is below(see attachment). Only needed to add an ORP12 - LDR and a 10k resistor across the input, might have to tweak the resistor value but works a treat with my hand acting as approaching darkness.

    Another step forward.

    Dave
    Attached Images Attached Images  

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    COOL!!!!

    Not having seen your code so maybe you have this or considered this...

    It is easy to have false triggers when sensing light, sensing "dark" at dusk could give trouble. You may want to incorporate a timer of some kind not to send the data until you are "sure" it is dark. The dark trigger has to be active for 30 minutes???

    What if there is a bug on the sensor?? A real bug...
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit

    It is easy to have false triggers when sensing light, sensing "dark" at dusk could give trouble. You may want to incorporate a timer of some kind not to send the data until you are "sure" it is dark. The dark trigger has to be active for 30 minutes???
    Mm, how about sending the PIC back to SLEEP awaiting another Interrupt_On_Change (the birds have started visiting again it was only a cloud) so carry on counting. If after say SLEEP 1800(about half an hour) the LDR is still high then Send_Data it really is dark!

    What if there is a bug on the sensor?? A real bug...
    Oh dear, Badgers I don't mind (even Bears seem kind of cuddly) but bugs!!!

    I think the code would have to be something like:

    Code:
    IF Count_Input_Pin is HIGH for >50ms THEN SEND:
    
    SEND:
    
    'Mrs LEDave  into the garden and clean the sensor.
    
    RETURN.
    That's an interesting point though because the Birds don't always fly straight into the nest box they quite often hang by the hole then enter so the timing(or lenght of time) of the INPUT COUNTER will need some thinking about.

    Dave
    Last edited by LEDave; - 9th December 2010 at 16:45.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I have not been able to program Mrs. Mackrackit. Fuzzy logic

    Mm, how about sending the PIC back to SLEEP awaiting another Interrupt_On_Change (the birds have started visiting again it was only a cloud) so carry on counting. If after say SLEEP 1800(about half an hour) the LDR is still high then Send_Data it really is dark!
    That should work.

    the INPUT COUNTER will need some thinking about.
    "Debounce" so one count per bird...
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    I have not been able to program Mrs. Mackrackit. Fuzzy logic
    Lol, I think we're starting to skate on thin ice here

    That should work.
    I sometimes wonder is there a 'best of practise' when it comes to programming - Then again I'm still pretty much at the 'if it works I'm happy' stage of things......

    "Debounce" so one count per bird...
    Ah, I remember Debounce.

    Right then, onto the sensor input / count.

    Dave

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I sometimes wonder is there a 'best of practise' when it comes to programming
    Yup, it is called seeing how Darrel or Bruce would do it..

    Then again I'm still pretty much at the 'if it works I'm happy' stage of things......
    Me too!
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Problem:

    I'm using SLEEP uncalibrated to put the PIC to SLEEP until an IOC occurs earlier on in the program. I'm also using SLEEP 1800 to put the PIC to sleep and test that it's still dark before transmitting the VISITS data. I'm getting an error when I compile the program though (see attachment). I've turned the _WDT_ON but still this error. Any ideas? Is using SLEEP an SLEEP Period in the same program uncompatable?

    Code:
    DARK:
         E_OUT=0           ' Disable transmitter
         INTCON.0 = 0      ' Clear int on change flag
         @ SLEEP 1800      ' It could be night time...It might only be a cloud though...   
                           ' so back to sleep for half an hour..zzzz
         @ NOP             ' Do nothing for 1st instruction on wake-up
                  
        if  GPIO.4= 0  then ENCODE  ' It really ia dark so carry on and transmit VISITS
        
        IF  GPIO.4= 1  THEN RETURN  ' It's not dark after all so carry_on_counting
    Forgot to add, if I comment out the line:

    Code:
     @ SLEEP 1800      ' It could be night time...It might only be a cloud though...
    the program compiles

    Dave
    Attached Images Attached Images  
    Last edited by LEDave; - 12th December 2010 at 01:33.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts