Hi guys i need a big help, i have a problem with connecting two microcontrollers like in picture:
If my value on my thermometer is less that 30 first led light, if led is more than 30 second led light. My question is: How i get value to second microcontroller to compare and light second led?
My code is that:
What i do to light second led? Or how i read a value on second microcontroller to light this, thanks a lot
Moderators note: Please use code tags for pieces of code
If my value on my thermometer is less that 30 first led light, if led is more than 30 second led light. My question is: How i get value to second microcontroller to compare and light second led?
My code is that:
C:
sbit LCD_RS at RC4_bit;
sbit LCD_EN at RC5_bit;
sbit LCD_D4 at RC0_bit;
sbit LCD_D5 at RC1_bit;
sbit LCD_D6 at RC2_bit;
sbit LCD_D7 at RC3_bit;
sbit LCD_RS_Direction at TRISC4_bit;
sbit LCD_EN_Direction at TRISC5_bit;
sbit LCD_D4_Direction at TRISC0_bit;
sbit LCD_D5_Direction at TRISC1_bit;
sbit LCD_D6_Direction at TRISC2_bit;
sbit LCD_D7_Direction at TRISC3_bit;
// End Software I2C connections
int value;
char value1[15];
int value2;
void main()
{
//TRISA.RA0 = 1;
// TRISA.RA1 = 1;
// TRISD.RD7 = 1;
PORTD = 0;
TRISD = 0;
PORTC = 0;
TRISC = 0;
ADC_INIT();
LCD_INIT();
lcd_cmd(_lcd_cursor_off);
lcd_cmd(_lcd_clear);
lcd_out(1,1,"Temperatura: ");
while(1)
{
value = adc_read(0);
value = value * 0.488;
floattostr(value,value1);
lcd_chr(2,9,39);
lcd_out(2,10,"C");
lcd_out(2,1,value1);
value2 = atoi(value1);
if(value2 > 29)
{
PORTD.RD0 = 1;
PORTD.RD3 = 0;
PORTD.RD7 = 1;
PORTD.RD6 = 0;
PORTC.RD6 = 1;
}
else
{
PORTD.RD0 = 0;
PORTD.RD2 = 0;
PORTD.RD7 = 0;
PORTD.RD6 = 1;
}
}
}
Moderators note: Please use code tags for pieces of code