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

    You want PBP to handle clearing WDT for you when you have the watchdog enabled.
    Thanks for that Bruce and for putting the TX / RX programs up in the first place.

    Dave

  2. #2
    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 all,

    Have been very busy with other things for a few Months now, things seem to have settled enough now though for me to be able to get on with the project (long overdue).

    These last few nights I've been building the project intergrating the rfpic module, ldr night cct sensor and VB program. Things arn't going smoothly though, everything worked well on the breadboard but not in the finished cct.....I'll get there though.

    Really pleased to be back.

    Dave

  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!

    I'm having major problems trying to get the TX program to do what I want it to, namely TX after a timing loop executes. Just for information, if I comment out the timing loop the program TX's no problem and sends and receives a test WORD.

    Here's the setup:

    Code:
    INTCON = %00001000  ' Enable port change wakeup from sleep
    Code:
    WPU = %00010000     ' pull-up on for GPIO.4 (external pull-up already on GPIO.3)
    It's GPIO.4 we're looking at here. That's the pin that will receive the input from a 555 timer / potential divider using an ldr to detect that it's dark and therefore TX the days count over.

    Code:
    OPTION_REG = %00001111 'Watch_Dog_Timer ON with a 128 prescaler
    Here's the main body of the program. it's a little bit of a mess because I've commented out the GPIO.3 COUNTS part of the program and also added then commented out INTCON.0 = 0 in various places to try and get it to do the timer loop / COUNT then TX.

    Code:
    IF GPIO.3= 1 AND GPIO.4= 1 THEN ' Nothing has happened so SLEEP
           E_OUT=0       ' Disable transmitter
           INTCON.0 = 0  ' No Inputs detected or it's still light so clear int on change flag
           @ SLEEP       ' and start snoozin..zzzzzzzzzzz indefinatly
           @ NOP         ' Do nothing for 1st instruction on wake-up
      ELSE  
       'IF  GPIO.3=0 THEN GOSUB COUNTS 'Bird detected at box - GOTO LABEL COUNTS   
       IF  GPIO.4=0 THEN DARK   'It's got dark? or just cloudy - GOTO LABEL DARK
      ENDIF     
      GOTO MAIN          'Back to sleep / continue counting
        
        
     'COUNTS:
        '  VISITS = VISITS +1 'Bird at box so increment counter
        '  INTCON.0 = 0       ' Clear int on change flag
      'RETURN                 ' Then back to sleep....
         
          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)
         @ SLEEP
         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 
        pauseus 25  ' Let transmitter settle
        DAT_OUT = %10101001
       
        'INTCON.0 = 0  ' Clear int on change flag
          
        'Build checksum of 2 data bytes
        CHK_SUM = (DAT_OUT * 2)    
        
    Transmit:
        'LET VISITS = VISITS / 2  'Just VISITS too not from the box 
        LET VISITS = 300 'Test data number
        SEROUT2 D_OUT,BAUD,[PreAmble,Synch,DAT_OUT,DAT_OUT,CHK_SUM,VISITS.highbyte,VISITS.lowbyte]
        PAUSE GUARD ' 5mS guard time gives decoder time to respond,calculate,change,etc.
        INTCON.0 = 0  ' Clear int on change flag - moved here from above
        GOTO Main
            
        END
    I think the problem maybe that the COUNTER loop never gets completed because the IOC which comes from GPIO.4 isn't reset and the counter loop is using @SLEEP but never gets that far.

    Any ideas greatfully received.

    Dave
    Last edited by LEDave; - 4th April 2011 at 17:42.

  4. #4
    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!

    What happens if the @SLEEP below is commented?
    Code:
    WHILE COUNTER < 2      ' 4.608sec Loop time (Loop for 30 mins = 781)
         @ SLEEP
         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.

  5. #5
    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!

    What happens if the @SLEEP below is commented?
    It TX's straight away and the led on the Pickit1 (receiver) flashes three times (as intended). There is no 5 sec delay from the timing loop though.

    It's as if the timing loop COUNT is just being bypassed, have I set it up right?

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

  6. #6
    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; - 5th April 2011 at 00:30.

  7. #7
    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.

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