Quote Originally Posted by Joe S. View Post
Good Morning Dave,
I machine a LOT of magnesium, which is done dry. Here is the code for
a little device to keep the chips away. It is presently ported to your
PICKit1 (Thanks BRUCE !). This will flash D7 on your board according to how you adjust the little Pot .
Code:
@ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF 
'   *   *   *   *   * PIC12F675 *   *   *   *   * PICKit 1 Demo board
    PCON = %00000011    ' BOD off, No POR flag set
DEFINE  NO_CLRWDT 1
DEFINE  ADC_CLOCK 1

    OSCCAL = %1111100   ' SET OSC TO MAXIMUM SET OSC TO 4 MHZ INTERNAL
    CMCON   = 7	        ' Disable Analog Comparators
    ANSEL   = 1         ' Disable A/D module, all digital except AN 0
    WPU.4 = 0           ' Disable weak pull up on GPIO.4
    
    B0    VAR word         ' Byte holds 0 - 255 Word 0 - 65535
    
    
    OPTION_REG = %11111111 ' Dis/Enable internal pull-ups Bit 7
                           ' Bits 0-2 prescaler 
                           ' Bit 3 prescaler assignment 1 = WDT 0 = TMR0
                           ' Bit 4 TMR0 source edge select bit
                           ' 1 trigger on High to Low 
                           ' 0 trigger on Low to High
                           ' Bit 5 TOCS TMR0 clock source select
                           ' 1 = transition on GP2
                           ' 0 = internal clock (CLKOUT)
                           ' Bit 6 INTEDG Interrupt Edge Select
                           ' 1 = Interrupt on rising edge GP2
                           ' 0 = Interrupt on falling edge GP2
                           ' Bit 7 Pullup resistor enable bit
                           ' 1 = disabled 0 = enabled by individual port 
                           ' latch values.


    

    
Main:
Adcin 0,B0
b0 = (b0 * 10)
gpio.2 = 0
TRISIO = %11111001
GPIO.1 = 1
pause B0
GPIO.1 = 0
pause 500 
    
GOTO Main

    END
you should be able to compile with the demo version, you have. Configs set for MPASM Assembler.
Here is the hex:
Code:
:020000040000FA
:1000000052280F39A0000310A00DA00D1F08E039E1
:10001000200401389F000030A100323023209F14BB
:100020009F181028A1011E084D28A301A200FF302F
:10003000A207031CA307031C4D280330A100DF30D7
:1000400023201728A101E83EA000A109FC30031CD1
:100050002C28A00703182928A0070000A10F292891
:1000600020183228A01C362800003628080010303E
:10007000A800A101A001A70CA60C031C452822087A
:10008000A00723080318230FA107A10CA00CA50C9F
:10009000A40CA80B3B2824084D28831303138312B8
:1000A00000000800831603308E007C30900083121D
:1000B00007309900831601309F001512FF30810030
:1000C000831200300120B8002108B9003808A600CA
:1000D0003908A7000A30A200A3013720B80025087C
:1000E000B90005118316F93085008312851439088B
:1000F000A3003808162085100130A300F430162024
:0601000061286300812864
:02400E00D43F9D
:00000001FF