Fan regulator - Any advise


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink KISS Method

    Hi,

    Looking at this interrupt stubb ... it seems translating it into pure ASM interrupt is fairly easy ... as all commands have their straight asm equivalent !!!

    BTW ... I do not see DT Interrupts fitting into a '629 ...

    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 " !!!
    *****************************************

  2. #2


    Did you find this post helpful? Yes | No

    Smile PIC Option

    Quote Originally Posted by Acetronics View Post
    BTW ... I do not see DT Interrupts fitting into a '629 ...
    I have 12F635 as well, if that helps

  3. #3
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    969


    Did you find this post helpful? Yes | No

    Default

    Am I missing something? I looked up microchip site for 16F629 ... nothing. Is it a 639 and a 635 you talk about?

    As to whether DT instant interrupts fits in a 628 or equivalent, I'm not sure, but I've used assembly language interrupts on a 628. It's very easy once you know.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Talking

    Hi, Jerson

    You should have a strong coffee ...


    DEVICE 12F629
    CONFIG INTRC_OSC_NOCLKOUT, WDT_OFF, PWRTE_ON, BODEN_OFF, CP_OFF, MCLRE_OFF
    ...
    ...
    lol ...

    For DT interrupts ... the problem is the RAM size, not the Program size ...

    So, a 12Fxxx with enough RAM ( 12F683 i.e. ) is Ok

    It won't fit into a 16F84 nor ...

    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 " !!!
    *****************************************

  5. #5
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    969


    Did you find this post helpful? Yes | No

    Default

    Hi Alain - I really needed coffee. Too much stress I guess. I mistook it for a 16F device!!! haha

    OTOH 64 bytes RAM should be good enough to do asm interrupts no?

    This is what I did with the 16F628 interrupts.
    Code:
    ' define the interrupt handler
    define      INTHAND       _IntHandler
    ' These variables are used to save the machine state on interrupt
    wsave       var byte    $20     SYSTEM          ' location for W if in bank0
    wsave1      var byte    $A0     SYSTEM          ' location for W if in bank1
    wsave2      var byte    $120    SYSTEM          ' location for W if in bank2
    ssave       var byte    BANK0   SYSTEM          ' location for STATUS register
    psave       var byte    BANK0   SYSTEM          ' location for PCLATH register
    fsave       var byte    BANK0   SYSTEM          ' location for FSR register
    
    IntHandler:
    asm
          movwf   wsave           ; Save the W register
          swapf   STATUS, W
          clrf    STATUS          ; Point to bank 0
          movwf   ssave           ; Save the STATUS register
          movf    PCLATH, W       ; Save PCLATH
          movwf   psave
          movlw   ((INTHAND) >> 8)        ; Set PCLATH for jump
          movwf   PCLATH
    
          btfss INTCON, INTF    ; branch if PULSEIN arrived
          goto  EndInt
    
    ; your code goes here
    
          ; restore the machine context
    EndInt
          movf  fsave,w         ;restore the FSR
          movwf FSR
          movf  psave,w         ;restore PCH
          movwf PCLATH
          swapf ssave, W        ;restore STATUS
          movwf STATUS
          swapf wsave, F
          swapf wsave, W        ;restore W
          retfie
    endasm
    I have not checked the datasheet for the banks used in the 12F629, but the wsave registers may need to change accordingly. Otherwise, the context save and restore takes just 4 bytes of RAM !!!!

    That also answers Damien as to the code needed for the CONTEXT RESTORE of proton

    Last edited by Jerson; - 28th August 2009 at 13:12. Reason: added code

Similar Threads

  1. Proportional fan control. I suck at math!
    By polymer52 in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 3rd January 2010, 23:10
  2. 12f635 & fan regulator
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th August 2009, 22:10
  3. Transistor selection, PWM fan control
    By 124C41 in forum Schematics
    Replies: 5
    Last Post: - 22nd December 2008, 15:33
  4. help with fan controller X10
    By iova in forum General
    Replies: 2
    Last Post: - 11th August 2006, 00:37
  5. Replies: 9
    Last Post: - 30th August 2005, 06:33

Members who have read this thread : 0

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