Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Very large LCD counter (Teracounter?)

Status
Not open for further replies.

Mr RB

Well-Known Member
Hi, I did this dual independant 16digit text LCD counter a while back but only got around to putting it up on my web page today.

It uses a tiny PIC 12F675 (on my Shift1-LCD PCB) and the code system is essentially an unlimited-digit counter that stores and increments the "count" as a text string. So it works with very simple PIC code and only needs char variables (no longs/doubles etc).

**broken link removed**

The size of the counted number is limited only by the number of characters in the text string. No numeric vars are needed.

The basic text counter C procedure looks like this;
Code:
//=============================================================================
//   INC COUNTER
//=============================================================================
void inc_counter(unsigned char *icount)
{
  //-----------------------------------------------------
  // the counter values are stored as text.
  // so inc them using a special procedure starting
  // at the final (right) character then working back.
  //-----------------------------------------------------
  // loop and inc the counter
  i = 15;
  while(i < 16)
  {
    if(icount[i] < '0') icount[i] = '0'; // change digit to '0' before inc it
    icount[i]++;                         // inc the digit

    if(icount[i] <= '9') break;          // if no digit roll, inc is done
    icount[i] = '0';                     // digit roll, so clr it, and inc next
    i--;
  }
  // check for final roll and do a counter reset, to put blanks back in
  if(icount[0] == '0') clear_counter(icount);
}
//-----------------------------------------------------------------------------

It handles leading blanks too, which is kinda necessary with very large numbers. :)

The full project which has 2 independant 16 digit up-counters can be seen here;
Shift1-LCD 16digit dual counter project
 
Thank you. :)

And I assume you are THE Dick Cappels? :eek: At least based on your profile link to Dick Cappels entry page I've bumped into your work a few times over the years but can't remember seeing you on this forum before... I've only been regular here for some months.

So make that "Thank you... and HI!" :)
 
Yes, it is I. And I appreciate the exceptional creativity you have brought to this topic. I hope to work it into a future project. Its shows excellent "out of box" thinking about ways of dealing with exceptionally large numbers!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top