Best way to store 10 digits telephone number ?

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

May I ask the following, please ? I try to write a program in C language for a telephone project that must store a 10 digit of CLIP,and two more others (10 digits also). The requirement is to use tiny2313, because the hardware and PCB is already finished.
I used an array but I noticed that this way uses a lot of available flash. I tried tiny4313 which is actually a 2313 with bigger flash, and noticed that the available flash is again not enough to store the volume of code (IIC, LCD e.t.c). Has any of You an idea who to do this. I prefer not to use EEPROM because is slow.
Probably the best approach is to store every digit of the telephone numbers to a byte...

Thank You,

Alex

Last Edited: Mon. Mar 31, 2014 - 09:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, flash is even slower. Why does it have to be fast?

I would store as 10 ASCII characters, just to make it easy. You could also store as 10 integers (uint8_t). Or, as 5 hex bytes, each nibble containing one digit.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Jim,

In fact data come using interrupt from the integrated hardware UART. I do not want to use hex because it will be not so simple to change the other 2, 10-digit telephone numbers.
The project has more that one functions.Basically consider the following two.
1. When somebody call the unit, then it call back.
2. There are two inputs that unit has to call telephone number 1 when for instance port B1 is triggered or telephone number 2 for port B2 respectively.
I do not now how to store the clip number digit by digit and send it again digit by digit, without using arrays...

Thank You,

Alex

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nothing wrong with arrays. Your array can be a char array or a uint8_t array.

And, phone dialing is REALLY slow compared to EEPROM access time, write or read.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
integrated hardware UART

Does this feed an interrupt driven, ring buffer?
If so, then the processing time to pack and unpack a 10 digit phone number into 5 bytes doesn't matter.

Doing this only takes a microsecond or two, anyway, so I'm not sure that your concern over time will really matter.

Clearly there is a basic tradeoff. Uncompressed data takes up more memory. Compressed data, (50 % compression in this case), saves memory, but takes a few clock cycles to pack and unpack.

It is always easier to start a new project with a large micro, with lots of memory and peripherals, and then port it to a smaller micro as the project nears completion. This last step really only matters when one is making lots of them, otherwise the small price difference just isn't worth worrying about for the time, effort, and debugging to shrink and optimize everything.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh, and EEPROM read is almost as quick as SRAM or Flash read.

You only update the EEPROM when your girlfriend's phone number changes. (or you change girlfriends)

Be realistic, the area code probably stays the same. Even if each digit changes, you are only talking about 50ms to write 10 digits to EEPROM. 25ms if you store in BCD.

David.