Hello Guys,
Welcome to learning Microcontrollers.
I had made a course for you guys to learn under my direction supervision on Udemy.
This course will make you a master of PIC microcontroller based projects making using MikroC for PIC software.
Please do take this course the link is below. This will greatly help my channel aswell to grow.
https://www.udemy.com/course/pic-micr...
A beautfiul quote:
The road to sucess is always under construction.
/
/
///////////////////////////////////////////////////// Hello guys,
Calculating the voltage of a battery is a very important thing in any project. This is one of the way to do that.
NOTE: Youtube description dont allow using greater than and less than mathematical symbols. For that
GT = Greater than
LT = Lesser than
After you copy paste this code simply change them as shown in video.
MikroC for PIC programming from video:
float data1;
void main() {
ADC_Init();
Delay_ms(50);
PORTB = 0x00;
TRISB = 0x00;
PORTB = 0x00;
Delay_ms(50);
while(1)
{
data1 = ADC_Read(0);
Delay_ms(50);
if (( data1 GT 0 ) && ( data1 LT 137 ))
{
PORTB = 0b00000001;
}
else if (( data1 GT 137 ) && ( data1 LT 274 ))
{
PORTB = 0b00000010;
}
else if (( data1 GT 274 ) && ( data1 LT 411 ))
{
PORTB = 0b00000100;
}
else if (( data1 GT 411 ) && ( data1 LT 548 ))
{
PORTB = 0b00001000;
}
else if (( data1 GT 548 ) && ( data1 LT 685 ))
{
PORTB = 0b00010000;
}
else if ( data1GT 685 )
{
PORTB = 0b00100000;
}
else
{
PORTB = 0b00000000;
}
}
}