hi !
I have to realize a temperature controller using pic 16f877a . normali, the microcontroller reads the temperature continuously and compares it to the desired value. when the desired value is higher than the measured value, the relay and the red LED are activated. when the desired value is equal to the measured value, the green LED is activated. but i dont find this faction (the relay and the leds do not work ). this is my code on micrc please helpe me to find the
fault :sad:
I think that 'PORTC.RC5' is wrong is this PORTD.RD5 or PORTC.RC5?
I can't see where you are setting TRISD to make pins 2, 3 and 5 as outputs.
Depending on the load on the lines to the relay and LEDs, you could well be suffering the RMW problem that MCUs with only a PORT register can have. It would be better to create a shadow register for the output bits, set that how you want then and then write that shadow register to the PORT.
Susan
I think that 'PORTC.RC5' is wrong is this PORTD.RD5 or PORTC.RC5?
I can't see where you are setting TRISD to make pins 2, 3 and 5 as outputs.
Depending on the load on the lines to the relay and LEDs, you could well be suffering the RMW problem that MCUs with only a PORT register can have. It would be better to create a shadow register for the output bits, set that how you want then and then write that shadow register to the PORT.
Susan
When i run the code in the micro c software, i have no errors, but when i run the code in the appropriate schematic in isis, i don't find the operation that i wont. Because, when i compare the temperature of the sensor with the static telmperature that i put in the program(50), normally, if temp<temp_ref, the red led and the heater operates (ON), and if temp>=temp_ref, the green led is ON and the heater is OFF. But i don't find this functions.