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 Re: 12f675_fuse_about_to_blow!

    If I press and hold down push button GP4 on the transmitter, the receiver flashes the led continually. I would have thought / was expecting that when the push button on GPIO.4 was pressed and held down you would get a four / five second delay before the receiver received anything and started to flash.

    Tonights silly question:

    How does setting the OPTION reg and WDT then become associated with the loop COUNTER? The WDT has a period of 18ms so setting the bits 111 gives 128*18ms =2.304secs the COUNTER loop should run twice giving a delay of 4.608secs right? But if the program doesn't read COUNTER as being associated with the WDT it's going to count to two in a flash and it will appear that the TX sends the data instantly(which is what is happening). Should the WDT and COUNTER be 'joined' via a 'SYMBOL statement in the program under SYMBOL? or something like this?

    Dave
    Last edited by LEDave; - 4th April 2011 at 23:30.

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


    Did you find this post helpful? Yes | No

    Default Re: 12f675_fuse_about_to_blow!

    Just guessing as I have not done this before...
    Code:
    WHILE COUNTER <= 2      ' 4.608sec Loop time (Loop for 30 mins = 781)
          INTCON.0 = 0
         @ SLEEP
         COUNTER=COUNTER+1
         'IF  GPIO.3= 0  THEN COUNTS 'Bird at box (it's not dark) so continue counting
    WEND
    I hope someone else will jump in on this...
    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 Re: 12f675_fuse_about_to_blow!

    Hi mackrackit,

    I've made the changes and the Transmitter lights the it's reference led about once every nine seconds but doesn't transmit at all (doesn't seem to get that far).

    I still can't get my head around how the WDT associates with the loop COUNTER, plus the more I read on this it seems that if the WDT isn't reset back to zero before it reaches FF+1 (I think) it then reboots the program which makes sense....Mmm, more reading and thinking to do, interesting though.

    Dave

  4. #4
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: 12f675_fuse_about_to_blow!

    First let me say, this is an awesome thread. I have been meaning to read it from the beginning, but I am a slow reader.

    LEDave, WDT in the snippet you just posted works like this:
    Assuming PBP knows you are using the WDT, clear WD is sprinkled around the program for you to keep from resetting the chip. But to get to these, the program must run.

    @sleep basically stops the program and the chip just, well sleeps. Because of this, the WDT never gets cleared. The WD can wake up the PIC, so when WDT overflows, the PIC wakes up and resumes where it left off. So this is how the WDT is associated with the counter.

    Hope this helps
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

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


    Did you find this post helpful? Yes | No

    Default Re: 12f675_fuse_about_to_blow!

    Bert,
    will this make it work as expected?
    Code:
    WHILE COUNTER <= 2      ' 4.608sec Loop time (Loop for 30 mins = 781)
          INTCON.0 = 0
         @ SLEEP
        CLEARWDT
         COUNTER=COUNTER+1
         'IF  GPIO.3= 0  THEN COUNTS 'Bird at box (it's not dark) so continue counting
    WEND
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: 12f675_fuse_about_to_blow!

    Dave, sorry for being only clear as mud with my explaination. I ment to say : because of this, the WD never gets cleared WHILE SLEEPING. When the pic is asleep, WDT overflows thus waking up the PIC.

    I tried to quickly look over the program a few posts up, but I don't have a good feel for it yet. I don't think adding the CLRWDT will help only because when the pic wakes, it should be a long time (~2sec) before the next overflow.

    I did notice when @SLEEP is used elsewhere in the program, the line following is @NOP. Maybe this is needed to give the pic a chance to get the sleep from its eyes? I would try using @NOP right after the @SLEEP and see if this works.

    I have never used any of the power saving modes before, but if the pic needs a nop upon waking up, it may be ignoring the counter=counter+1. Therefore the while is never satisified.

    In any event,if the NOP is needed, adding CLRWDT may solve the problem, we just won't know why it did.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

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


    Did you find this post helpful? Yes | No

    Default Re: 12f675_fuse_about_to_blow!

    Hi Bert

    Thanks for your input and welcome to the thread. I was heading towards the CLRWDT after reading this (quite an interesting website):

    http://www.hobbyprojects.com/pic_tut...utorial13.html

    Well here's the section of code as it stands:

    Code:
    DARK:   
          'INTCON.0 = 0    ' Clear int on change flag
                           ' It could be night time...It might only be a cloud though...   
                           ' so back to sleep / wake / sleep for half an hour..zwzwzw
          
          COUNTER=0        ' clear before entry
    WHILE COUNTER <= 2     ' 4.608sec Loop time (Loop for 30 mins = 781)
         INTCON.0 = 0      ' Clear int on change flag
         @ SLEEP
         @ NOP 
         CLEARWDT
         COUNTER=COUNTER+1
         'IF  GPIO.3= 0  THEN COUNTS 'Bird at box (it's not dark) so continue counting
    WEND     
                       
        if  GPIO.4= 0  then ENCODE  ' It really ia dark so carry on and transmit VISITS
        
        'IF  GPIO.4= 1  THEN Main  '(changed from return) It's not dark after all so carry_on_sleeping_counting 
        
    Encode:  
        E_OUT=1     ' Turn transmitter on
    What happens now is when the push button on GPIO.4 is pressed (and held down) After a count of 9 seconds approx (I was expecting a count of two to give half that time) the TX board led lights but still nothing is transmitted.

    The program still doesn't seem to get to encode and transmit, frustrating, any other thoughts?

    Dave

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