Ampere-Hour Meter - reply

This forum is a continuation of the printed column "Q&A", where I answer questions about all aspects of electronics, including computer hardware, software, circuits, electronic theory, troubleshooting, and anything else of interest to the hobbyist. Feel free to participate with your questions, comments or suggestions on answers printed in the magazine. Send all NEW questions to: [email protected]
Post Reply
Andy E
Posts: 4
Joined: Fri Jul 04, 2008 9:56 pm
Location: Cape Cod, MA, USA
Contact:

Ampere-Hour Meter - reply

Post by Andy E » Sat Jul 27, 2013 7:33 pm

In response to the Ampere-Hour Meter answer in the August 2013 issue:
I notice that variable HOUR, in routine TEST, is not being accumulated. I believe it should be, HOUR = HOUR + ((1/3600)*5)
The parentheses are for clarity. As published, the value of HOUR will never increase.

PWDawgy
Posts: 1
Joined: Wed Jul 31, 2013 12:56 pm
Contact:

Re: Ampere-Hour Meter - reply

Post by PWDawgy » Wed Jul 31, 2013 1:07 pm

Just one observation: generally the R/W pin is an input to the display R-read, W-write. the logic is usually high for read and low for write. Most designs usually tie r/w low and insert a fixed delay between write instructions. if you want a more dynamic driver then you would read the lcd status register continuously after every write instruction to see when the busy flag clears.

Your driver is too basic, and the connections R/W, RS and EN are all LCD control lines driven by the PIC; you really need to read about the LCD controller!

'http://en.wikipedia.org/wiki/Hitachi_HD ... controller' - General write-up for the LCD controller
'http://fab.cba.mit.edu/classes/MIT/863. ... /44780.pdf' - Hitachi Data sheet for the LCD controller

Unless you plan to use the spare I/O on the PIC, why not use the LCD in 8-bit mode rather than 4-bit it makes the software driver a little less complex.

'http://www.nongnu.org/avr-libc/examples/stdiodemo/' - a c demo written for the AVR, but hd44780.c/h will give you the idea
'http://www.edaboard.com/entry1817.html' - an open source PIC LCD driver
'http://www.blitzlogic.com/lcd_C.HTM' - another LCD driver example

Not sure about the analogue, a little outside my expertise but I'm interested in trying it as it would make an excellent workbench tool for me.
:D

raym
Posts: 9
Joined: Thu Jan 17, 2002 1:01 am
Location: FL
Contact:

Re: Ampere-Hour Meter - reply

Post by raym » Mon Aug 05, 2013 8:33 am

Hi
for anyone that is interested there is an article posted in the ARRL QST Ham radio mag.
in the May 2010 page 44 & 45 on this subject it looks much simpler than the one posted here
so if you are a ham or can get a copy of the article from QST.
The software program is listed on the ARRL website.
I don't know the legal end of copying and posting the article so i'm staying away from that
I have not seen a reply of a problem listed with this unit .
Ray

ericserdahl
Posts: 1
Joined: Wed Jan 12, 2005 1:01 am
Location: Sunnyvale, CA
Contact:

Re: Ampere-Hour Meter - reply

Post by ericserdahl » Mon Aug 05, 2013 9:47 pm

Your circuit looks OK, so it's probably how the software runs the interface pins for the sequence and timing of signals for reads and writes. The 44780 protocol also has an interesting initialization process. I found the data sheet for the MIKROE-55 (Winstar 16 characters x 2 Lines LCD Display) at:
http://www.mikroe.com/downloads/get/166 ... 6_spec.pdf
(Some of the important relationships)
Section 7. Interface Pin Function lists descriptions.
NOTE: Pin 4 = Register Select RS H/L H: DATA, L: Instruction code
Pin 5 = Read/Write Select R/W H/L H: Read(MPU<--Module) L: Write(MPU-->Module)
Pin 6 = Chip Select E H,H-->L Chip enable signal
...
Pin 11 = DB4 H/L Data bus line
Pin 12 = DB5 H/L Data bus line
Pin 13 = DB6 H/L Data bus line
Pin 14 = DB7 H/L Data bus line
NOTE: Busy Flag (BF) is read from Pin 14(DB7). (See Sections 9, 11 & 12)
When the busy flag is 1, the controller LSI is in the internal operation mode,
and the next instruction will not be accepted. When RS=0 and R/W=1, the busy
flag is output to DB7. The next instruction must be written after ensuring
that the busy flag is 0.

Section 13. Initializing of LCM is detailed. (Using 4-Bit Interface)

Additional information at: http://en.wikipedia.org/wiki/Hitachi_HD ... controller

Keep working at it, it will be worth it to your project.

Best Regards, Eric

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest