Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

7-Segment display "flash" problem

Status
Not open for further replies.

BiDoU

Newbie level 6
Joined
Jan 23, 2005
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
121
Hello all,

I have a problem with my display. The problem is when I need to do some "long" mathematics calculus (after a ADC conversion), my display "flash" less than one second, but it's visible for human eyes...

I program in C. I think to use interrupt for my display but I don't know exactly how to use it.

I use the ADIF flag for now, and it doesnt change anything. My mathematical formula use the log function. Maybe it's that cause the little flash of my display.

Maybe someone have an idea to solve my problem?!

Thank you very much.
 

Hi,

I dont know what PIC you are using ( i think that because you wrote that you are using ADIF ).
Any way, use one of the timers of the pic and when they reach the maxmium of thier counter, they will raise a flag. That will cause the pic to interupt, re-load the value to the timer and re init the LCD. Go abck to main to calculate what ever you need.
Aslo, if you are using MPLAB you can use the internal debugger so calculate how long it takes to calculate the A/D value...
Good luck.
 

    BiDoU

    Points: 2
    Helpful Answer Positive Rating
Thank you,

humm as well, I forgot to specify somethings:

- I use a PIC16F877A.

- It's really three 7-Segment led (not a LCD) that I use. I need to multiplex them.

Code:
unsigned char ucLectureTemp(unsigned char ucChoixCapteur)
{
     unsigned int uiAdCount;
     float fVbridge, fRtherm, fTemp;
     ADCON0 = (ucChoixCapteur << 3) + 0xC1; // enable ADC, RC osc.
	ADGO = 1;
	//vMainDisplay();
	if(bgConvTerminer == 1)
     {
	  //vMainDisplay();
	  bgConvTerminer = 0;
	  uiAdCount = ((ADRESH << 8)|(ADRESL));
       fVbridge = (float)uiAdCount*(VREF/RESOLUTION);

       fRtherm = (VREF - fVbridge) / (fVbridge/RFIX);

       fTemp = A_CONST + B_CONST*(log(fRtherm));

       fTemp = (1.0 / (fTemp + C_CONST*(log(fRtherm)*log(fRtherm)*log(fRtherm)))) - 273.15;

       return((unsigned char)fTemp);
     }
     else
     {
       return(0xFF);
     }
}

This function is the problem I think. It's for the read of ADC and calculate the temperature with a thermistor value. (ADCON1 is configured in a init function).

And when this function is called, my three 7-segment led display "flash"...
 

Hi,

We it could be... The only thing that i can think about is to tell you to try and not use float.
Whe you can do is read you value, multiply it ( or shift it left <<, its the same) by 100 or 1000. then calculate what ever you need and then bring it down again, or leve it as is... That will be done faster...

Good luck.
 

    BiDoU

    Points: 2
    Helpful Answer Positive Rating
Thank you,

but there is a solution for log() ? It's possible to use another thing than the log() function ? Or there is a solution to calculate the formula in the interruption routine by part ? Like humm, to do it "in same time" instead my other function ?
 

BiDoU said:
Thank you,

but there is a solution for log() ? It's possible to use another thing than the log() function ? Or there is a solution to calculate the formula in the interruption routine by part ? Like humm, to do it "in same time" instead my other function ?

If you use:
 fRtherm = log((VREF - fVbridge) / (fVbridge/RFIX));

And later use this instead of log(fRtherm) you would save the time for 3 log calculations maybe this is a start?

It would also be a good idea to do the display refresh by interrupt.
If you post or PM me your complete code maybe I am able to help you :)

best regards
 

    BiDoU

    Points: 2
    Helpful Answer Positive Rating
hai

you can use timer for refreshing 7 segment
by using timergenerate some 10ms delay with interuupt
each and every time interrupt comes the 7 segment will get
refreshed. then there will be no blinking
 

pvinbox@yahoo.com said:
hai

you can use timer for refreshing 7 segment
by using timergenerate some 10ms delay with interuupt
each and every time interrupt comes the 7 segment will get
refreshed. then there will be no blinking

the same problem seems with my coding.im using 877 and driving 7seg display.but i do matrix coding to common anode displays like
decide the number to send->send it to the diplay->select other display*
decide whether to increase tens digit->increase goto start
[/code]
but in the simulation it seem its increasing and power is off for some time.how can i solve this problem?
 

Same problem I encountered in CCS C when I am using pow(), it requires a faster clocking to use those math.h functions.
 

glenjoy said:
Same problem I encountered in CCS C when I am using pow(), it requires a faster clocking to use those math.h functions.

Yes, it's what I thinked. I use a 4 MHz crystal at this time. Maybe I should use 8 MHz or more...
 

but the problem is that ;for example im simulating it and havent tested it and i asked it to my teacher today and he said 4MHz Xtal oscilator should be fine.and he said that it shouldnt blink in real circuit?!
 

If your simulation is in proteus and it blinked, chances are it will blink also in real application.

4Mhz I think will be slow for complex mathematical calculations, but of course if you have a C compiler that can optimize a code for real efficiency, it is a different story.
 

ok.thank u for the reply "Glenjoy" :)
but which Xtal should i use.when i dont wait after displaying the number.it says something wrong about transistor rise time i think(because im using matrix driving with proteus)>it warns about "time step" so where is the error.
 

Do not use transistors in proteus simulation, just adds a problem and LEDs does not give output when I am using transistors and connect Collector to Vcc.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top