Soldering station


Results 1 to 38 of 38

Threaded View

  1. #1
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579

    Default Soldering station

    Using Pensol SL10, one cheap 12F675 and N3310 display, I made for myself this soldering station. Works fine, the mos-fet remains cool, but... I wonder if my code it's the better way to drive the mos-fet and keep most accurate temperature of iron ("pwm mosfet, 255, 300").
    Any advice it's wellcome ! Thanks in advance !
    Code:
    '===============================================================================
    '*                   Statie digitala de lipit, cu display de NOKIA 3310        *
    '*                 Digital solering station with N3310 display            *    
    '*                           by Dan Niculescu, june 2011                        *
    '===============================================================================
    
    @ DEVICE PIC12F675, intrc_osc_noclkout, wdt_off, mclr_off
    DEFINE OSC  4
    DEFINE ADC_BITS 10
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 50
    
    CMCON    = 7
    TRISIO   = %001001
    INTCON   = 0 
    GPIO     = 0
    
    ANSEL    = %00010001
    ADCON0   = %10000001
    wpu      = %00000010
     
                D_C      var     GPIO.2       
                SDIN     var     GPIO.4
                SCK      var     GPIO.5
                MOSFET   var     GPIO.1
              buton    var     GPIO.3
    
                LcdReg          var  byte        
                x               var  byte
                y               var  byte
                z               var  byte
                a               var  byte
                PosX            var  byte
                PosY            var  byte
                Chr             var  byte
                LcdData         var  byte
                Offset          var  byte
                Char            var  byte
                adval           var  word
                w1              var  word
              vt              var  word
              cnt             var  byte
                grup            var  word
                mode               var  byte
              calibra         var  word
                i               var  byte
                 
                DATA @0,$3E,$51,$49,$45,$3E,_       ' 0                   
                        $00,$42,$7F,$40,$00,_       ' 1
                        $42,$61,$51,$49,$46,_       ' 2
                        $21,$41,$45,$4B,$31,_       ' 3
                        $18,$14,$12,$7F,$10,_       ' 4
                        $27,$45,$45,$45,$39,_       ' 5
                        $3C,$4A,$49,$49,$30,_       ' 6
                        $01,$71,$09,$05,$03,_       ' 7
                        $36,$49,$49,$49,$36,_       ' 8
                        $06,$49,$49,$29,$1E,_       ' 9
                        $08,$08,$3E,$08,$08,_       ' +
                        $08,$08,$08,$08,$08,_       ' -
                        $00,$60,$60,$00,$00,_       ' .
                        $00,$02,$05,$02,$00,_       ' grad
                        $3E,$41,$41,$41,$22,_       ' C
                        $7F,$02,$0C,$02,$7F,_       ' M     
                        $00,$00,$00,$00,$00,_       ' space
                     $08,$04,$7F,$04,$08,_       ' arrow up
                        $20,$40,$7F,$40,$20         ' arrow down
    
        Low D_C                                  'Command/Data
    
               pause 500                 
               LcdReg  =  %00100001         'LCD Extended Commands.
               call    PrintCtrlLcd
               LcdReg  =  $FF               'Set LCD Vop (Contrast).Initial $C5
               call    PrintCtrlLcd
               LcdReg  =  %00000110         'Set Temp coefficent.
               call    PrintCtrlLcd
               LcdReg  =  %00010011         'LCD bias mode 1:48.
               call    PrintCtrlLcd
               LcdReg  =  %00100000         'LCD Standard Commands
               call    PrintCtrlLcd
               LcdReg  =  $0C               'LCD in normal mode.  $0D inverse
               call    PrintCtrlLcd                 
    Pause 100
    Call CursorHome
    Pause 100               
    Gosub LCD_Clear
    mode = 0
    Pause 500                ' time to give-up :) 
    '===================== READING VOLTAGE ==============================
    Main:
    low mosfet
    call Borderline
    pause 50
     vt=0
     grup=0
         for cnt = 1 to 20
     ADCON0.1 = 1
     WHILE ADCON0.1 = 1 : WEND
     Pause 10
     adval.HighByte = ADRESH
     adval.LowByte = ADRESL
     PAUSE 10
         vt=adval * 500
         vt=div32 1023
         grup=vt+grup
     PAUSE 10
         next cnt
     w1=grup / 20
    
    '===================== setting cursor for display the voltage
                    LcdReg  =  %10000000 + 25        ' cursor  X
                    call    PrintCtrlLcd
                    LcdReg  =  %01000011             ' cursor  Y
                    call    PrintCtrlLcd
    '===================== now display results 
     if (w1 dig 2) <1 then
                    char = 16  
                    call Printchar
                    else         
                    Char = (w1 dig 2)            
                    call    PrintChar 
     endif      
    
    
                    Char = (w1 dig 1)           
                    call    PrintChar
    
     if (w1 dig 0) < 5 then            
                    Char = 0          
                    call    PrintChar  
            else
                    char = 5
                    call PrintChar
     endif                         
                    Char = 16                 
                    call    PrintChar
                
                    Char = 13
                    call  PrintChar
                   
                    Char = 14
                    call  PrintChar
    
                    
    if buton = 0 then 
    mode = mode + 1
    gosub memo
    endif
    
    
    gosub check
    Pause 100                
    Goto Main
    
    '================== L C D ===========================================                
    
    CursorHome:     LcdReg  =  %10000000            ' cursor Home
                    call    PrintCtrlLcd
                    LcdReg  =  %01000000            ' cursor Home
                    call    PrintCtrlLcd
                    return
    
    PrintChar:      offset = Char * 5          
                
                    for a = 1 to 5                
                        read offset, LcdReg
                        call  PrintDataLcd
                        offset = offset + 1
                    next a
                    LcdReg = 0
                    call    PrintDataLcd
                    return
                                        
    PrintCtrlLcd:   D_C = 0                             
    
    PrintDataLcd:   for x = 1 to 8                
                        SDIN = LcdReg.7              
                        SCK = 1
                        LcdReg = LcdReg << 1
                        SCK = 0
                    next x               
                    D_C = 1
                    return               
                    
    LCD_Clear:
                    PosX=0:PosY=0:Gosub LCD_GotoXY
                    D_C = 1
                    FOR Chr=1 TO 252
                        LcdData=0:Gosub LCD_ByteOut
                        LcdData=0:Gosub LCD_ByteOut
                    next Chr
                    return
    
    LCD_GotoXY:
                    D_C = 0
                    LcdData=%01000000 | PosY :Gosub LCD_ByteOut
                    LcdData=%10000000 | PosX :Gosub LCD_ByteOut
                    return
    
    LCD_ByteOut:
                    SHIFTOUT SDIN,SCK,1,[LcdData]
                    return  
    
    GotoXY:                
    LcdReg = %01000000 | Posy : call    PrintCtrlLcd    'Y
    LcdReg = %10000000 | Posx : call    PrintCtrlLcd    'X
    
    '===============================================================================
    memo:
    
    if mode = 1 then
     gosub poz
     char = 17
     call    PrintChar
     calibra = 4800
    endif
    
    if mode = 2 then  
     gosub poz
     char = 15
     call    PrintChar
     calibra = vt
    endif
    
    if mode = 3 then 
     gosub poz
     char = 18
     call printchar
     calibra = 10
    endif
    
    if mode > 3 then 
      mode = 0
     gosub poz
     char = 16
     call printchar
    endif
    
    return
    '===============================================================================
    check:
    if mode >= 1 then
        if w1 < (calibra-2) then  pwm mosfet, 255, 300       
        else
        low mosfet
    endif
    return
    '===============================================================================
    Poz:
                    LcdReg  =  %10000000 + 67        ' cursor  X
                    call    PrintCtrlLcd
                    LcdReg  =  %01000011             ' cursor  Y
                    call    PrintCtrlLcd
    return
    '===============================================================================               
    BorderLine:                          
    '=================================== RAW UP
          LcdReg  =  %10000000            ' cursor  X  
          call    PrintCtrlLcd
          LcdReg  =  %01000000            ' cursor  Y
          call    PrintCtrlLcd
          for y = 0 to 83                   
          LOokup y, [$FF,$01,$01,$01,$01,_
                     $01,$01,$01,$01,$01,$01,$01,$01,$01,$FD,$FD,$FD,$85,$85,$FD,$FD,$79,_        'D
                     $01,$01,$FD,$FD,$FD,$01,$01,$79,$FD,$FD,$85,$A5,$ED,$ED,$69,$01,$01,_        'IG
                     $FD,$FD,$FD,$01,$05,$05,$05,$FD,$FD,$FD,$05,$05,$05,$01,_                    'IT
                     $F9,$FD,$FD,$25,$25,$FD,$FD,$F9,$01,$01,$FD,$FD,$FD,$81,$81,$81,$81,_        'AL
                     $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$FF] ,LcdReg       
          call    PrintDataLcd
          next y
    '===================================  RAW 1 to 4                               
    for i= 1 to 4
    posx=0
    posy=i
    gosub GotoXY
                   lcdReg= $FF
                   call    PrintDataLcd
    next i
    
    for i = 1 to 4
    posx=83
    posy=i
    gosub GotoXY
                   lcdReg= $FF
                   call    PrintDataLcd
    next i   
    '===================================  RAW DOWN              
          LcdReg  =  %10000000           
          call    PrintCtrlLcd
          LcdReg  =  %01000101            
          call    PrintCtrlLcd
          for y = 0 to 83                   
          LOokup y, [$FF,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_             
                   $80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_          
                   $80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_          
                   $80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_          
                   $80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_          
                   $80,$80,$80,$80,$80,$80,$80,$80,$FF] ,LcdReg
          call    PrintDataLcd
          next y 
    Return
    
    '===============================================================================
    
    End             'of program
    Attached Images Attached Images      

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