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.
Last edited by Archangel; - 22nd February 2010 at 05:17.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks