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.

[SOLVED] need help in develop decimal point logic in seven segment

Status
Not open for further replies.
ya alexan sir sensor giving output 75mv per mm and max distance of sensor is 5mm and i want to auto tune sensor at each 3mm distance so when sensor is at 3mm distance my seven segment should display 99.9 in digital. and for your question
What is the expected resolution of the sensor?
For example it gives 75mV from 1mm, can it give 82.5mV for 1.1mm ?

i don't check that this is possible or not.
 

hi mr. alexan_e sir i am still not finding the solution.?? still confused in how to do calibration for different scaling.please sir your guidance is needed.
 

You are currently using
scale=(((uint32_t)t)*((uint32_t)5000))/1023;

The max you can get from the above is 5000mv
When you multiply this with 100 and devide with 75 as you do you can get a max of
(5000*100)/75=6667 which is 66.67mm , you can't get any more that that with the current settings.
The only solution to increase the range is to use an external voltage divider but you will loose accuracy in the low readings.

---------- Post added at 12:37 ---------- Previous post was at 12:35 ----------

Are you sure that the sensor can give more than 5v to the input of the ADC?
If the max output is 5v then the range is limited to 66.67mm
 

ya maximum input to adc is 5v from sensor sir. so should i go for using floating numbers ??
 

You can use anything you want but I don't see the point, you can't get more than 66.67mm no mater what you do.
By using floats you will only increase the code size and reduce the efficiency, is this what you want?
 

ok sir so can i replace adc? can i use 12 bit adc sir?will that solve problem?????
 

I feel like we can't understand each other.
Can the sensor provide more than 5v, yes or no?
If it can then you can use two resistors externally to form a voltage divider, the measured voltage will be that half that the one provided by the sensor and you can get double the range.
 

sensor is not providing direct output to adc i used signal conditioner ad698 it can go more then 5 v or i can do that with amplification with opamp and then use your suggested voltage divider this way is possible i think. what you suggest sir???
 

If it can provide more than 5v then you only need a voltage divider to input only half the voltage in the ADC.
Then do all the calculations normally and in the last step use
scale=((uint32_t)scale * 200)/75;

As I said by doing this you will loose accuracy because what is currently 5v/1023=4.88mV per ADC step will become 4.88mV*2=9.76mV
 

ok sir i will test that and let you know about result thanx in advance
 

As I said by doing this you will loose accuracy because what is currently 5v/1023=4.88mV per ADC step will become 4.88mV*2=9.76mV

That is not correct, the ADC input accuracy will be exactly the same but by dividing the input signal each mm will be 75mV/2=37.7mV so 0.1mm will give 3.77mV which is less that the ADC step , that is where you will get an error.

When the input is

0.1mm the voltage after the divider will be 3.77mv , this will probably be read a 1 from the ADC
0.2mm the voltage after the divider will be 7.54mv , this can result in a 1 or 2 from the ADC
0.3mm the voltage after the divider will be 11.31mv , this can result in a result from 2 from the ADC
....

In addition to the above you have the ADC accuracy specs that will make the result even worse.
A 12bit ADC can improve that but you need an external device with increases the cost and complexity.

Another solution is oversampling but I don't know how successful it will be
http://www.atmel.com/Images/doc8003.pdf
 

Mr. Ud23,
You can use a signal conditioner IC like AD598 to change the LVDT secondary output(analog sine wave) to a scaled dc signal.
 

A LVDT requires a constant amplitude ac voltage at a frequency not readily available. This means that an oscillator of the appropriate frequency must be connected to an amplifier with amplitude regulation in its output.

A LVDT output is usually too low-level to operate ordinary readouts, so it is necessary to amplify the output of the LVDT.Sometimes this is done in two steps, using an ac carrier amplifier prior to demodulation and a dc amplifier after demodulation.

Most readout is dc-operated devices, so the signal is amplified by ac carrier amplifier by 10 times and rectified by half wave sync demodulator. The half wave demodulator is incorporated using a FET switch. The half wave demodulator is synchronized with oscillator output, which is given to primary of LVDT. So the final output of the rectifier will be negative going pulse for negative displacement and positive going pulse for positive side displacement.

This rectified signal is filtered by a RC filter and again amplified by a dc amplifier. The dc amplifier is a simple operational amplifier configured in non-inverting mode to produce output from -2V (for –10mm) to +2V (for +10mm). The final output of dc amplifier is connected to ADC to convert the voltage reading in digital form. The controller reads the digital data and the value is displayed in the LCD.

https://www.divinecirkits.com/projects/Embed/LVDT.DOC

---------- Post added at 12:10 ---------- Previous post was at 12:07 ----------

**broken link removed**
 
  • Like
Reactions: ud23

    ud23

    Points: 2
    Helpful Answer Positive Rating
@alexan :sir yes you r right i checked that on hardware and its doing same as you mentioned in your last post.thank you very much
@papunblg: yes i am already using ad698 for Lvdt signal conditioning and thank you for your document on lvdt.

i have another question re guarding this project how can i use other timer interrupt for display characters on first seven segment according different switch input???
I am using already timer zero i want to use timer 1 for switch and display character
 

You mean which mode of the timer to use?
You can use the CTC mode and set OCR1A to the value you want to set the desired refresh rate, then use an interrupt on compare match and do the refresh from there.

You can also use the overflow interrupt, in each interrupt preload the timer to a desired value (for example decimal 60000) so that the overflow occurs faster.

Or you can use interrupt on compare match and in each interrupt increase the match value by a predefined number so that it gives interrupt at 10000,20000,30000...
 

yea sir i want to Use that in CTC mode for just to display one character when desire key is pressed
 

hi alexan sir sorry i am newbi in programming how can i use timer1 as over flow interrupt i already write isr logic for it but its not enabling interrupt
Code:
void init_Ex2(void)
{

TIMSK|=(1<<TOIE1); // enabled global and timer overflow interrupt;
TCCR1A = 0x00; // normal operation page 148 (mode0);
TCNT1=0x0000; // 16bit counter register
TCCR1B = 0x04; // start timer/ set clock

}

Code:
ISR(TIMER1_OVF_vect) {


 isr  for display different character when switch pressed

	if(!(PINC&(1<<PINC1))&&(PINC&(1<<PINC2)))
   	 
{       
 
  	 PORTB=(1<<PB0);SEVEN_SEGMENT_PORT=values[10];
	 

}

  else if(!(PINC&(1<<PINC2))&&(PINC&(1<<PINC1)))
        

	
{ 
	
      PORTB=(1<<PB0);SEVEN_SEGMENT_PORT=values[11];	 

}





}

its not working
 

Did you use

Code:
// Global enable interrupts
sei();
 

no i did not use that is it necessary for every time for interrupt i initialize it for timer0
 

sei();sets the global interrupt flag and cli(); clears it.

You apply sei(); once in your code after all your initializations and the interrupts will be enabled after that point.
If you want to disable interrupts at some point in your code then you apply cli();
https://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html


sei(); can also be used inside an interrupt to enable recursive interrupts but I don't think you should bother with this now.
 
  • Like
Reactions: ud23

    ud23

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top