Re: get a sensor digital input to work on a pickit 2 16f690 lpc
OK Jasonstew,
Here is a code that makes "cylon" eye pattern, and speed will be controled by the rheostat on your board.
Code:
@MyConfig = _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON
@MyConfig = MyConfig & _MCLRE_OFF & _BOR_OFF
@ __config MyConfig
DEFINE OSC 4
DEFINE ADC_BITS 8
DEFINE ADC_CLOCK 1
DEFINE ADC_SAMPLEUS 50
PortA = 1
PortB = 0
PortC = 0
TRISA = 1
TRISB =%01010000
TRISC = %00000000
i var word 'locks up @ 255 with byte
ANSEL = 1
ANSELH = 0
CM1CON0 = 0
CM2CON0 = 0
Backlight Var word
main:
ADCIN 0,BACKLIGHT
for i = 1 to 255
portC = i
i=i << 1 - 1
pause backlight
next i
for i = 255 to 1 step -1
i=i >> 1 + 1
portc = i
pause 25
next i
goto main
end
Do not make too much over the variable names, I recycled some code in this.
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