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;
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
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