susuying
Newbie level 4
hey,
i currently use the LM35 sensor to detect the temperature changes. the microcontroller that i use is PIC18F4550, and the output detector is just the LED.
i using 5 LED as the output.
Below is my coding, is there any problem?
void main(void)
{
TRISB=0B00000000
#define LED1 PortBbits.RB0
if (t=25)
{
LEC1=1; //will make port B0 high
}
else
{
LED1=0; //will make port B0 low
}
#define LED2 PortBbits.RB1
if(t=26)
{
LEC2=1; //will make port B1 high
}
else
{
LED2=0; //will make port B1 low
}
#define LED3 PortBbits.RB2
if(t=27)
{
LED3=1; //will make port B2 high
}
else
{
LED3=0; //will make port B2 low
}
#define LED4 PortBbits.RB3
if(t=28)
{
LED4=1; //will make port B3 high
}
else
{
LED4=0; //will make port B3 low
}
i currently use the LM35 sensor to detect the temperature changes. the microcontroller that i use is PIC18F4550, and the output detector is just the LED.
i using 5 LED as the output.
Below is my coding, is there any problem?
void main(void)
{
TRISB=0B00000000
#define LED1 PortBbits.RB0
if (t=25)
{
LEC1=1; //will make port B0 high
}
else
{
LED1=0; //will make port B0 low
}
#define LED2 PortBbits.RB1
if(t=26)
{
LEC2=1; //will make port B1 high
}
else
{
LED2=0; //will make port B1 low
}
#define LED3 PortBbits.RB2
if(t=27)
{
LED3=1; //will make port B2 high
}
else
{
LED3=0; //will make port B2 low
}
#define LED4 PortBbits.RB3
if(t=28)
{
LED4=1; //will make port B3 high
}
else
{
LED4=0; //will make port B3 low
}