Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Need help with a proyect. could you do it better?

0 votes
asked May 9, 2020 by carlos287 (150 points)
In a 4 digit 7 segment display, I am trying to show the temperature with the help of a little thermistor. I haven't take classes yet, but still studied and watched a lot of examples... this is not working. I´m bad and also decided to have this working. Appreciate a hint or comment. :)

#device adc=10
#use fast_io(b)
float a;
float x;
//#byte entrada = 0x87
#int_termo
void termo(){
setup_ADC_ports(sAN4);
setup_ADC(ADC_CLOCK_DIV_2);
entrada = 0x00;            //port_b//0xF8//
while(1) {
set_adc_channel(0);
a=read_adc();
x=log(a/41)*19;
}}
#int_display
void display() {
if(x<0) {
output_c(0xBF);
output_high(pin_b5);
delay_ms(5);
output_low(pin_b5);
}}
void main() {
enable_interrupts(int_termo);
enable_interrupts(int_display);
ext_int_edge(L_to_H);
delay_ms(300);
enable_interrupts(global);
int z;
int16 addr1, addr2;   
addr1=0x200;
write_eeprom(addr1++, 0xc0);
write_eeprom(addr1++, 0xF9);
write_eeprom(addr1++, 0xA4);
write_eeprom(addr1++, 0xB0);
write_eeprom(addr1++, 0x99);
write_eeprom(addr1++, 0x92);
write_eeprom(addr1++, 0x82);
write_eeprom(addr1++, 0xF8);
write_eeprom(addr1++, 0x80);
write_eeprom(addr1++, 0x90);
addr2=0x200;
set_tris_b(0x0f);
while(true){
setup_timer_1(T1_internal|t1_div_by_2);
z=x/10;
addr1=addr2+z;
z=read_eeprom(addr1);
output_c(z);
output_high(pin_b6);
delay_ms(5)
output_low(pin_b6);
z=x%10;
addr1=addr2+z;
z=read_eeprom(addr1);
output_c(z);
output_high(pin_b7);
delay_ms(5);
output_low(pin_b7);
}}

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...