We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
posted on 2016/04/30 08:07:45 PM CEST
compiler : microC
pic : pic18f45k22
i want a code that generate output on Rd4 if input is 2.5 v and on Rd5 if input is 3 v
plz help me i am a beginner
USER Comments
posted on 2016/05/05 07:24:59 PM CEST
really appreciate, i am 15 years old and trying to make some programs... this really helped to start adc ... tnx again
Do you want to report abuse comment ID: 1754 in "adc" request.
posted on 2016/05/05 07:19:29 PM CEST
tnx alot
Do you want to report abuse comment ID: 1753 in "adc" request.
posted on 2016/05/04 09:14:39 AM CEST
Try this
unsigned int ad1;
void main() {
TRISD4_Bit=0; //Output
TRISD5_Bit=0; //output
while(1)
{
ad1= ADC_Read(0); //Read AN0
//3v=>930
//2,5V=>775
// For 3V
if (ad1>930)
{
LATD5_BIT=0;
}
else
{
LATD5_BIT=1;
}
// For 2.5V
if (ad1>775)
{
LATD4_BIT=0;
}
else
{
LATD4_BIT=1;
}
}
Do you want to report abuse comment ID: 1749 in "adc" request.