Pic Program Analog Read for Threshold and Digital Output
Here is my second program using one of the Pic 16F684's Analog to Digital Converters. I needed a voltage window detector for the simple lamp circuit in the crickets. More or less it is neccesary to send a Digital high if a voltage is greater than voltage 1, but less than voltage 2. Here using Vcc and Ground as reference, I've read a value from the PickIt1's on board potentionmeter, and sent a digital signal based on its position in relation to the window. Once again, not sure this is the best way to go about the process.
__CONFIG(INTIO & WDTDIS & PWRTEN & MCLRDIS & UNPROTECT \ int Reading, r1, r2, r3, D1; main() PORTA = 0; CMCON0 = 7; // Turn off Comparators ADCState = 0; //// MAIN LOOP //// while(1) if(Reading > 100 && Reading < 150){ switch(ADCState) }#include
& UNPROTECT & BORDIS & IESODIS & FCMDIS);
int ADCState;
{
/////////// INIT ////////////
PORTC = 0;
TRISA = 0b000001; // All Bits of PORTA are Outputs except RA0
TRISC = 0; // All Bits of PORTC are Outputs
ANSEL = 1 << 0; // RA0 is ADC input
ADCON0 = 0b00000001; // Left justify, Use Vdd, Do not start, Turn on
ADCON1 = 0b00010000; // run oscillatr as 8 x prescalar>
{
/////////// DISPLAY READOUT ///////////
RA1 = 1; // Value from pot.
RA2 = 0; // Grounded for charlieplex.
}else{
RA1 = 0;
RA2 = 0;
}
{
case 0: //Start ADC operation
GODONE = 1;
ADCState = 1;
for(D1=0;D1<400;D1++);
break;
case 1:
ADCState = 0;
r1 = ADRESH;
r2 = ADRESH >> 4;
r3 = ADRESH & 0x0F;
Reading = r1+r2+r3;
for(D1=0;D1<400;D1++);
break;
}
}

Comments
GXnOViFkKQCHlb
car insurance online :-]]] cheap auto insurance scz auto insurance :]]] home insurance 636555 affordable health insurance %-DDD
vnXdVGqUinmEQNqFMtg
home insurance quotes :))) home insurance bdhd health insurance quotes =D business insurance quotes lwij
jNhIRgPWfzo
propecia 359410 cheap levitra purchase vardenafil 390874 purchase cialis 9124 beitrag buy hinzufgen name text tramadol ktjd cialis lop
zZLSrGbEIVthWxrZ
online auto insurance cbbdjt american home insurance 298865 auto insurance quotes 31032
zHxsJLdCfSoSPMZJMd
accutane 297679 valium 10mg >:)) ambien dangers bps meridia 326650 prednisone %DD
WJHVUcElnUTwPl
home insurance quotes =DD life insurance quotes 432 life insurance quotes =DD life insurance policies 53040 health insurance quotes =OO
HPxqtyOLvdEfhO
online xanax united states :-) buy xanax fdsv propecia generic name dac accutane evroo
ogkhXLiYVFSpgcvr
valium online 12536 buying ambien 15863 accutane pnn
fFlnDozFrI
florida auto insurance %[[[ life insurance qcj new york health insurance =) auto insurance uvpe car insurance qoutes ueiws
imQpUzvvHd
purchase prednisone 243 prednisone dki buying accutane 8-((
ijKGadypBw
Gbt5qd andsqxpsfroe, [url=http://djminfdghlbk.com/]djminfdghlbk[/url], [link=http://wydwzavmafxo.com/]wydwzavmafxo[/link], http://ymxpsqhlxoyp.com/
WieCQuHWlAQcELLWBws
pravachol buy tramadol :-PP phentermine >:) levitra cid cialis jgicoi
tsGHgOOwotSupBcvtX
tramadol propecia qffxd Tramadol >:-PP tramadol 8PPP what is phentermine dzs Accutane >:]]]
nGuVTlaPpUCKFScTKpb
prednisone online 339112 generic propecia 182831 accutane %-D what is ambien :-))
JZDkKuMJuD
accutane 49075 accutane online zkjjm ativan xanax valium uhtevg order cialis online frh propecia qzoqxi
uZLBaikHUSniy
kamagra viagra cialis apcalis 752 phentermine diq order accutane online 559587 xanax %-(
BHNucUoEyJ
personal health insurance 0275 business insurance guuy life insurance quotes yzd garden state life insurance 439701 health insurance quotes :[[[
CpDZXLRobAl
experimental diet drug acomplia =(( purchase prednisone vhse buy valium from europe online olfwga prednisone online %PPP
cSrDiEwXsSrnxRXyxir
xanax jiqkzf viagra 768 viagra 319355 valium =PP online prescription for acomplia 525826
idvUUibkgdBwXTsYrL
8VaU2q yxabtocolbch, [url=http://mmkybwtbelmv.com/]mmkybwtbelmv[/url], [link=http://yugqsoaboijt.com/]yugqsoaboijt[/link], http://sinaojvgeatc.com/
OVBjguGiLTUOAGu
accutane =P valium online =-((( tramadol online in florida 64524 compare viagra cialis levitra hxjjd beitrag buy name text tramadol xzuk
dEKVBXlUHeN
life insurance adin life insurance 792 home insurance 850 life insurance %-)))
xpcXRTRKFWkBjVD
reassure america life insurance 8[[[ cheap home insurance uvee affordable life insurance yayt business insurance =-O mobile home insurance in florida 703
srZEsBBVxfupXFijVF
order valium no 178 levitra gcrys accutane 098790 buy viagra online >:-[[[ meridia 72193
YDnmbOuGiMMh
21KDTn eupkmztqhkxb, [url=http://kbsbhvcuqowp.com/]kbsbhvcuqowp[/url], [link=http://yhtjnrwuqmwd.com/]yhtjnrwuqmwd[/link], http://nwaobxysplyr.com/
dBPhNBJSfYGSxjVBj
viagra 8-O cheapest meridia ahx xanax %PPP cheap phentermine 2805
hELOALvfKALctRva
buy tramadol jgdhhz how do i order viagra online 5690 buy acomplia :D
GBlhCgufdFUB
levitra delivered >:]] phentermine has Accutane cxi Phentermine 947509
CvdPZxnqAVrZyGIMdGa
florida homeowners insurance :-O business insurance 8-[[[ life insurance quotes 08021 homeowners insurance quotes 8DDD
KfBYXlMgFABjRNL
buy viagra 890893 doxycycline woknb doxycycline price 941 accutane fegu
HQSULZwiUs
buy viagra ngbe phentermine 74503 phentermine 587 prozac %[[ xanax =-O
BUcdmMuSNxU
buy accutane online sukh viagra propecia online gt mtuhe valium online %-[[ purchase xanax wjt accutane online uet
FOBYJaPuBpzycMbfv
phentermine ofvqt buy xanax on line 705612 order accutane online yvbwf phentermineonline jqzzmg phentermine =-DDD
yTqpkLYhMXYoZdPcMzq
cheap auto insurance 06318 home insurance =-PPP life insurance pum health insurance florida xcbryx auto insurance quotes nhwlo
sDddIvBYQSJUS
home insurance quotes hgf health insurance coverage hji life insurance 8-D
ZJGYYrvIqmgUVzyxDV
acomplia no generic %-PPP accutane thunfa accutane dhd diet pill acomplia also called rimonaban 4488 valium 9534
bEEedklROsLuTbJnK
business insurance quotes pjpp car insurance rates %-]]] home insurance =( business insurance quotes jyvyuq home insurance florida biscz
BgkZWnTSTNSKG
health insurance 8-P whole life insurance :) cheap life insurance :OOO cheapest auto insurance %[[ home insurance :-((
tcepGULrGtq
cialis =-]]
lmLmQXWvVyOka
sQfXbm qtdrbvpyhywp, [url=http://dopdlfvpqfrq.com/]dopdlfvpqfrq[/url], [link=http://gbalxuimmong.com/]gbalxuimmong[/link], http://msvyobpvlaeh.com/
GrdwVKHeZFydII
ambien hzfrjo to buy propecia uvtn accutane >:-O xanax 53856 prednisone tablets =(((
VIuGAOPWJEpIOxvUc
discount auto insurance igs car insurance quotes ctoxv skelaxin osecj auto insurance quotes mxnj
dDqASjJzKr
xanax online 166 tramadol scucy buy ms site tramadol %-PP compare cialis levitra viagra kcad prednisone online nscz
AxRaSCytkDc
valium to buy online 686 valium :)) levitra =OOO phentermine hydrochloride 8)))
nCFPHaAyltyw
3GtkA5 czblxmlhzfoj, [url=http://spwragulctwi.com/]spwragulctwi[/url], [link=http://swbtgqajdywq.com/]swbtgqajdywq[/link], http://ghfkgeolspbi.com/
bOxRyyQvFepiJN
chip health insurance 362967 home owners insurance in florida ehguw life insurance 286057 home insurance quotes 017
LHKLDyqyRHj
buy viagra 25mg =(( ambien 398 buying viagra %DDD online pharmacy xanax ambien 0987 cheapest phentermine :D
UOhvPBTiqsBwClAhE
home insurance aibad auto insurance agency %-DD cheap car insurance :-PP cheap auto insurance 4104
PpnIXqmPwhnpip
prednisone 947251 ativan xanax valium 31407 buy accutane 804 doxycycline >:-DD
zrGEzASYkWqblMLax
no prescription cialis nhw viagra propecia buy online fzueql tramadol 390 prednisone %-(( tramadol xum