[AVR] Display 7 digit decimal value on 16x2 lcd

Status
Not open for further replies.

BHARGAVSHANKHALPARA

Junior Member level 3
Joined
May 6, 2010
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
GUJARAT INDIA
Visit site
Activity points
1,592
hello...

i am working on flow meter project. in which i want to display total liter of water. i am just increment variable value on each pulse. i define variable for it "unsigned int TOTALIZATOR", my microcontroller is ATMEGA32A.

My problem is that when i am trying to display this variable value in 16x2 LCD display, its shows 'V' Character at position of second digit, which is not require or don't know why it was appear in that...?



please suggest some solution...!!
 

unsigned int TOTALIZATOR

with unsigned int you can store maximum 65535 ltr and you are trying to display more than that.

And for flow meter 65535 ltr totalizer is less because I think it stores the total ltr usage so it should be unsigned int long
 

    V

    Points: 2
    Helpful Answer Positive Rating
Is your system battery or solar powered ? What happens if mains power fail ? How does the flow meter function during that time ? If it is used for digitalizing water meters for houses then you may use small solar panel which provides say 5V 5000mAh to power the system.

How many pulses is equal to 1 liter ?

If your flow sensor gives 300 pulses per liter and 40 liter/min then 40 * 300 = 12000 pulses in one minute. You can use two counters. When 1st counter reaches 12000 then you can increment the second counter by 1 and clear the first counter. If the flow is 40 liter/min then the second counter will increment once every minute and if 2nd counter has a value of 4 and first counter 0 then total liters = 40 * 4 = 160 liters.


Edit: It seems your flow sensor is slow. It is arounf 12.72 liters/min.

Use a 40 liter/min sensor from Futerlec

I have made a digital flowmeter powered from small solar panel. I have given the design and firmware to Chinese for manufacturing.


I used waterproof solar panels like this. **broken link removed**

It also had 2 AA rechargeble batteries. I use 3.3V PIC18LF device and customized LCD. Not 16X2 5V LCD.

I had used FLOW40L0

https://www.futurlec.com/Flow_Sensor.shtml

works from 3.3V

- - - Updated - - -

Also try to display no. of gallons.
 
Last edited:

    V

    Points: 2
    Helpful Answer Positive Rating

Code C - [expand]
1
unsigned long int x;



Mention how LCD is connected to ATMEGA32A.
 
Last edited:

Why do you want to use unsigned long int.

Just use unsigned int for variables used for counting the pulses and for liter/hour. Use one unsigned long int var for no. of gallons flowed.

If your flow sensor gives 300 pulses per liter. Then increment counterA in ISR on every INT0 interrupt and when it reaches 300 just increment counterB and clear counterA. So, counterB holds no. of liters flowed. You can use another 2 unsigned int type to hold liters/min and ltrs/hr. Use one unsigned long int to hold no. of gallons flowed. Then your counters will never reach their max values and there will be no problem.
 


i am using library file from extreme electronics...

hear is link for LCD interfacing with microcontroller which i used...!!

try this updated file and try with unsigned long you can store 0 to 4,294,967,295 value
 

Attachments

  • lcdlibv20.zip
    5.5 KB · Views: 127

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…