Simple Reset code needed for pic12f675 Please Help!


Results 1 to 5 of 5

Threaded View

  1. #1

    Default Simple Reset code needed for pic12f675 Please Help!

    I have a code I found on the internet that is a simple hot/cold detector with 2 led's. Well the problem is if a new ambient temperature is introduced it will just stay on the color of the ambient temperature unless I turn the unit off and back on again to reset the unit. Well I have found an electrical work-around using a 555 timer to reset the circuit every 30 seconds which is what I desire. However I am getting tired of building the 555's every time I build them so I know someone out there can write a simple code to do this for me automatically through the pic chip12... I have contacted the original owner of the code and he said he doesn't have the time to even look at it, so Im hoping someone here can help me. It would be greatly appreciated! Basically I need the chip to turn off then back on every 30 seconds as if I would do it with the on/off switch manually.
    Here is a sample of the code im using.
    Code:
    @ Device PIC12F675,PROTECT_OFF,INTRC_OSC_NOCLKOUT,MCLR_OFF
    DEFINE ADC_BITS 10 
    DEFINE ADC_CLOCK 3 
    DEFINE ADC_SAMPLEUS 50 
    
    
    ' Requires Pic Basic Pro to compile for the Microchip 12F675.
    
    
    
    
    CMCON=7
    GPIO=%00000000
    TRISIO=%010110
    ANSEL=%00111110
    ADCON0=%11001100
    
    
    t VAR WORD
    c VAR WORD
    cl VAR WORD
    m VAR BYTE
    hh VAR BYTE
    ch VAR BYTE
    u VAR BYTE
    d VAR BYTE
    
    
    u=0
    d=0
    hh=2
    ch=1
    cl=0
    
    
    pause 250
    ADCIN 3, t
    ADCIN 2, c
    if(t>c) then
     cl=t-c
     m=1
    endif
    if(t<c) then
     cl=c-t
     m=0
    endif
    
    
    loop:
    
    
    ADCIN 3, t
    ADCIN 2, c
    if m=1 then
     t=t-cl
    else
     t=t+cl
    endif
    
    
    if u>10 then
     GPIO.0=0
     GPIO.5=1
    endif
    
    
    if d>10 then
     GPIO.5=0
     GPIO.0=1
    endif
    
    
    if t>(c+ch) then
     u=u+1
     d=0
     goto loop
    else
     if t<(c-hh) then
      d=d+1
      u=0
      goto loop
     endif
    endif
    
    
    u=0
    d=0
    GPIO.0=0
    GPIO.5=0
    nap 2
    GoTo loop
    Last edited by Archangel; - 28th November 2013 at 08:02.

Similar Threads

  1. Replies: 14
    Last Post: - 22nd January 2012, 04:06
  2. Help needed with source code
    By orangekitty in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th October 2010, 10:06
  3. Simple TMR1 application example needed
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th February 2010, 09:52
  4. help with code needed
    By ccronin4 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 24th December 2005, 22:48
  5. PIC18 USB simple example needed
    By harryweb in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 29th September 2005, 22:20

Members who have read this thread : 1

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

Tags for this Thread

Posting Permissions

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