Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 16th January 2008, 05:50 AM   (permalink)
Default

Quote:
Originally Posted by Suraj143
You mean that my Multiplexing routine I must call every one second?
No, just try calling BCD_Split once a second. The display will still "bobble" when the ADC is near the threshold of changing values, but only at a one second rate. Maybe something like this untested/inelegant code:

Code:
Main          movlw 0x??                     ; delay value
                movwf SomeDelay

Loop		call	Multiplex		;show the display	
		call	Check_AD		;get the AD value		
		bcf	STATUS,0
		rrf	ADL,F			;divide the AD value by by 2
		call	BCD			;call BCD & make into decimals
                decfsz SomeDelay, F
		goto	Loop
 		call	BCD_Split		;move BCD results to segment digits
		goto	Main
Quote:
Sorry kchriste I cannot understand this.
You would take 256 ADC readings and add them to a 16bit location as they are acquired. The upper 8bits of the 16bit number would represent the average value of the 256 ADC readings after 256 ADC readings. You could also take the average of any other number of readings, but 256 makes the "math" really easy.
Quote:
In my diagram is it a low pass filter?
Not really, it is more of a damper to compensate for lead capacitance and noise according the the datasheet. A 2.2K resistor in series with the output of the LM35 with a capacitor to ground on the PIC side of the circuit would be a lowpass filter.
__________________
--- The days of the digital watch are numbered. ---

Last edited by kchriste; 16th January 2008 at 06:07 AM.
kchriste is online now   Reply With Quote
Old 16th January 2008, 05:58 AM   (permalink)
Default

Hi kchriste I got your point.For every one second I'll update the display & see.
Thanks for that hint.

Quote:
You would take 256 ADC readings and add them to a 16bit location as they are acquired. The upper 8bits of the 16bit number would represent the average value of the 256 ADC readings after 256 ADC readings. You could also take the average of any other number of readings, but 256 makes the "math" really easy.
What I know is for every 256 increments the ADRESH will increment by one.
Thats what I know.
Suraj143 is offline   Reply With Quote
Old 17th January 2008, 02:36 AM   (permalink)
Default Project Success 70%

Hi kchriste I followed your three steps all of the methods gave me good results.

I tried one by one, the best method was reading the average value. That is the more accurate method.

I added a 16bit register to place the 256 times AD results.& read the higher byte to get the average value.

I wrote my own coding again & applied.

Sometimes you can see the bubbles.It means if the temperature is 21 celsious when it goes to 22 C it shifting like this 21,22,21,22,21,22,21,22 this happens continuously even if I read the average temperature.

I also applied the 2.2K resister with 0.1uF capacitor (low pass filter)

So what do you think?

Code:
;************
;Main program
;************			
Display	call	Multiplex						
Loop	call	Check_AD		
	incfsz	Count256,F	;count 256 AD readings
	goto	$+9		;No,
	clrf	Count256	;yes, it has reached 256 times
	bcf	STATUS,C
	rrf	average_H,F	;make the value divide by 2
	call	BCD		;make the value into decimals
	call	BCD_Split	;convert into segment digits
	clrf	average_H	;clear 16 bit higher byte
	clrf	average_L	;clear 16 bit lower byte
	goto	Display		;show the display with updates	
	movf	ADL,W		;take the AD result to W
	addwf	average_L,F	;add the value to lower byte of average register
	btfss	STATUS,C	;has the carry bit set?
	goto	Display		;No, then show the display without updates
	incf	average_H,F	;Yes, then increment the higher byte of average register
	goto	Display		;show the display without updates
Suraj143 is offline   Reply With Quote
Old 17th January 2008, 05:08 AM   (permalink)
Default

Quote:
I wrote my own coding again & applied.
Code looks good and will display the average value. Good work.
Quote:
So what do you think?
If you want to totally eliminate the digit bobble, you would need to scale your input with an OpAmp to use the entire 10bits of the ADC. Then your code would have to add 1-2bits of hysteresis which would eliminate the bobble but also reduce the effective resolution to 8bits which would be fine in your case. Least significant digit bobble is a common artifact when a digital device displays an analog signal which is between two neighboring values:
Quote:
if the temperature is 21 celsious when it goes to 22 C it shifting like this 21,22,21,22,21,22,21,22
The real temperature is 21.5 Celsius so the display will bobble.
__________________
--- The days of the digital watch are numbered. ---

Last edited by kchriste; 17th January 2008 at 05:11 AM.
kchriste is online now   Reply With Quote
Old 17th January 2008, 05:21 AM   (permalink)
Default

Quote:
Originally Posted by kchriste
Code looks good and will display the average value. Good work.
Thank you

Quote:
Least significant digit bobble is a common artifact when a digital device displays an analog signal which is between two neighboring values:
Oh I see I thought this bobble happens only in my coding.Its a common fact

Quote:
The real temperature is 21.5 Celsius so the display will bobble.
Exactly

kchriste I just checked my temperature is correct or not?I measured the LM35 output voltage.
Its showing 0.28V = 25 Celsius

It should 28 Celsius.

Why is this happeneing?

Shall I add 3 to the result of the ADC every time?
Suraj143 is offline   Reply With Quote
Old 17th January 2008, 05:38 AM   (permalink)
Default

So you are saying that the ambient temperature is 25C and the LM35 is outputting 0.28V? If so, it is possible that the LM35 really is at 28C if it is mounted on a PCB / breadboard that has components generating heat. Also, are you measuring the voltage right at the LM35s pins Vout & Gnd? If not, it is possible that there is a voltage drop in the leads due to current draw from other devices.
__________________
--- The days of the digital watch are numbered. ---
kchriste is online now   Reply With Quote
Old 17th January 2008, 05:45 AM   (permalink)
Default

I looked at the display & it shows 25 C suddenly I measured the voltage Vout to GND in the LM35DZ.It shows 0.28V.

In the real calculation it must show 28 C.

My circuit is in a vero board I never use bread boards.
Suraj143 is offline   Reply With Quote
Old 18th January 2008, 02:40 AM   (permalink)
Default

Hi kchriste I'm trying my best to get a smooth value count in the segments without adjusting or adding any hardware changes.

I'm going to try in different ways.Something like calling AD interrupts etc....

Last night I didn't sleep even.
Suraj143 is offline   Reply With Quote
Old 18th January 2008, 03:36 AM   (permalink)
Default

You'll have to do some more tests then. If the LM35 reads 0.28V and your display reads 25 then it is probably due to the fact that your 5V supply, which I assume is used for your ADC reference, is a little high. What is the voltage reading on Vdd of the PIC?
Quote:
Shall I add 3 to the result of the ADC every time?
Only if the reading is 3 degrees low across the temperature range you'll be using.
It won't work if it reads 3 degrees low at 25C but 6 degrees low at 50C. Then you'd have to adjust the reference/supply voltage.
__________________
--- The days of the digital watch are numbered. ---

Last edited by kchriste; 18th January 2008 at 03:38 AM.
kchriste is online now   Reply With Quote
Old 18th January 2008, 03:48 AM   (permalink)
Default

Hi kchriste thanks for being with me through out the thread.
last night I measured all the voltages.

Vdd = 5V
LM35DZ output voltage = 0.28V at 25 C

I replaced another LM35DZ but same.That of course ok.The bubble thing is the main headache.
I'm trying various adjustments in my main code to get a smooth stable count up without bubbles.
Suraj143 is offline   Reply With Quote
Old 18th January 2008, 03:59 AM   (permalink)
Default

Am I the only person who gets this bubble thing error?I have never seen a similar thread like this.How others managed their LM35 temperature sensors? Didn't they get such a effect?

I'm really really upset.
Suraj143 is offline   Reply With Quote
Old 18th January 2008, 04:24 AM   (permalink)
Default

Quote:
Am I the only person who gets this bubble thing error?
If you read this article you'll see on page 5 a description of "Last-digit bobble":
http://www.ee.latrobe.edu.au/~gt/ele...s/01-units.pdf
Quote:
LM35DZ output voltage = 0.28V at 25 C
What do you get at other temperatures? Try boiling water at 100C as another calibration point.
__________________
--- The days of the digital watch are numbered. ---
kchriste is online now   Reply With Quote
Old 18th January 2008, 04:41 AM   (permalink)
Default

Ok this weekend I'm going to work out on fully about this in the weekend I'll tell the progress kchriste.

Thanks for the support.
Suraj143 is offline   Reply With Quote
Old 18th January 2008, 06:02 AM   (permalink)
Default

What sort of displays are you using, what type of regulator, how fast are you running your PIC? Your sensor must be located away from any heat source as even a few LEDs or a fast PIC can heat that LM34 up.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is online now   Reply With Quote
Old 18th January 2008, 06:27 AM   (permalink)
Default

Hi blueroomelectronics I’m using CC seven segments. I’m using two segments.

My PIC is running 4MHZ. My regulator is 7805 I measured the VDD & its 5.0V

Did you get a bobble error in your last digit? Here is the place I got stucked.
Attached Images
File Type: jpg LM35.JPG (5.1 KB, 5 views)
Suraj143 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
Guide to using an MCP2515? Sam Jelfs General Electronics Chat 0 4th April 2007 08:13 PM
Hotair Soldering Desoldering Guide or Tutorial is Needed xpacer General Electronics Chat 1 20th October 2006 05:56 PM
Orcad PCB Layout Manual Guide, Help ! sinkopa General Electronics Chat 1 31st March 2004 09:20 AM
ASM guide McGuinn Micro Controllers 4 2nd February 2004 12:37 AM
anyone willing to help and guide me?? philipsi Micro Controllers 2 23rd December 2003 07:02 AM



All times are GMT. The time now is 04:53 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.