PWM for heating car's exterior mirrors


Closed Thread
Results 1 to 12 of 12

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: PWM for heating car's exterior mirrors

    Last edited by Acetronics2; - 28th December 2012 at 20:35.
    ************************************************** ***********************
    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
    Join Date
    Dec 2012
    Posts
    5


    Did you find this post helpful? Yes | No

    Default Re: PWM for heating car's exterior mirrors

    Acetronics, if you have usefull ideas about my initial request, by my guest. Else, please, don't pollute my post with your amazing discoveries regarding old posts sent from others forums. You're so hard to follow...

  3. #3
    Join Date
    Sep 2011
    Posts
    1


    Did you find this post helpful? Yes | No

    Default Re: PWM for heating car's exterior mirrors

    Just a beginner myself, but seeing as you're still looking for help, I'll give it a stab.

    I did a similar project to the one you referenced, except I used a 12F683. The main difference being that the 12F683 has one CCP pin, which means you can use the HPWM command and save a lot of headaches.

    I also used an LM34 which does temp. in fahrenheit.

    Here is the code which should be pretty easy to modify for your purpose:
    Code:
    'This program uses a 12F683 chip wired as follows:
    'Pin 2 (GPIO 5) - Status LED          Pin 7 (GPIO 0) - to LM34 Temp sensor 
    'Pin 3 (GPIO 4) - Low Speed LED       Pin 6 (GPIO 1) - high speed LED
    'Pin 4 (GPIO 3) - Not used (MCLR)     Pin 5 (GPIO 2) - pwm to fan mosfet
    
    ' Defines: 
    
        DEFINE	ADC_BITS	10	' Set number of bits in result
        DEFINE	ADC_CLOCK	3	' Set clock source (3=rc)
        DEFINE	ADC_SAMPLEUS  50	' Set sampling time in uS
            
    ' Registers:
    
    TRISIO = 1
    ANSEL = %00010001      ''Fosc/8 conversion speed  for 4mHz processor, AN0 analog input
    CMCON0 = 7
    ADCON0.7 = 1           'Right Justified (10 bit conversion)
    
    
    'Variables:
    
    Raw_Temp var word
    Temp Var word
    Avg_Temp var word
    LED1 var GPIO.5
    LED2 var GPIO.4
    LED3 var GPIO.1
    X var byte
    
    Raw_Temp = 0
    Temp = 0
    X = 0
    
    'Program Start:
    
    LED1 = 1      'Always on status light  
       
    START:
        LED2 = 0
        LED3 = 0  
        HPWM 1,0,1000
        Gosub GETDATA
            IF TEMP => 95 THEN GOTO MOTORSTART
        PAUSE 5000
        GOTO START
        
    MOTORSTART:   'Starts motor at full speed
        HPWM 1,255,1000
        PAUSE 1000
            GOTO THIRTY
             
    THIRTY:
        hpwm 1,77,1000
        LED2 = 1
        LED3 = 0  
            GOSUB GETDATA
            IF TEMP < 92 THEN GOTO START
            IF TEMP > 105 THEN GOTO SEVENTY
        PAUSE 5000
        GOTO THIRTY
    
    SEVENTY:
        HPWM 1,180,1000
        LED2 = 1
        LED3 = 1
            GOSUB GETDATA
            IF TEMP < 100 THEN GOTO THIRTY
            IF TEMP > 115 THEN GOTO FULL
        PAUSE 5000
        GOTO SEVENTY
        
    FULL:
        HPWM 1,255,1000
        LED2 = 0
        LED3 = 1
            GOSUB GETDATA
            IF TEMP < 110 THEN GOTO SEVENTY
        PAUSE 5000
        GOTO FULL
        
    GETDATA:
       Avg_Temp = 0
         for x = 1 to 5   'Hysteresis by averaging 5 samples  
            ADCIN 0,RAW_TEMP
            pause 5
            Avg_Temp = Avg_Temp + Raw_temp
            pause 1000
            next x
         TEMP = ((Avg_Temp/5)*49) / 100    'Farenheit conversion
         PAUSE 50
    '     SEROUT GPIO.4,4,["      Temp  ",#Temp,13,10]   'For debugging
        RETURN
        
    END

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


    Did you find this post helpful? Yes | No

    Default Re: PWM for heating car's exterior mirrors

    see next ...
    Last edited by Acetronics2; - 31st December 2012 at 13:33.
    ************************************************** ***********************
    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
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: PWM for heating car's exterior mirrors

    Quote Originally Posted by maciu1 View Post
    Acetronics, if you have usefull ideas about my initial request, by my guest. Else, please, don't pollute my post with your amazing discoveries regarding old posts sent from others forums. You're so hard to follow...
    Hi, Maciu

    I have ONE useful idea for you ...

    Stop always begging and try some googling instead ...

    BTW ... LM35 AND 12F675 remind me to have crossed such applications on the web ... may be not PBP ( ? - one sure in Mikro C - ) , but, as you are just begging for code ... Hex file will be more than enough !

    Alain

    PS: I hate lazy beggars ... but you already knew it
    re PS : lazy ???

    I prove it : http://www.picbasic.co.uk/forum/showthread.php?t=12794
    ************************************************** ***********************
    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 " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default Re: PWM for heating car's exterior mirrors

    the next part of the puzzle ...
    http://jeanclaude.grimaldi.perso.sfr...ePWMdouble%29/

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

Similar Threads

  1. Sinusoidal PWM generation Using PIC 18f4431
    By oswalam in forum mel PIC BASIC
    Replies: 3
    Last Post: - 23rd February 2013, 16:49
  2. DT Multiple Software PWM and 18F2321 issue
    By microuser in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th December 2012, 09:23
  3. Weird PWM Behaviour on 16F1825
    By RossWaddell in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th October 2012, 22:59
  4. TX module heating up ????
    By Megahertz in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th June 2010, 15:38
  5. 7805 heating
    By sirvo in forum Off Topic
    Replies: 10
    Last Post: - 9th February 2007, 23:16

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