16F59 scrolling message, I2C thermometer

Works done? Proud of it? Show off here! Let's see what you've built can help inspire others.

16F59 scrolling message, I2C thermometer

Postby takao21203 » Mon Jul 30, 2012 1:18 pm

I had this in mind for quite a long while- to implement scrolling message on baseline PIC.

The 16f57/16f59 are the same as 16f54, but have 2K FLASH, as well larger RAM.
There are no pheripherals to configure.

However, using assembler, this is too difficult, since the RAM is banked into 16 byte pieces,
as well there are only 2 stack levels. I wrote one text scroller for the 16f1824 in assembler.

I tried to use Hitech C for the 16f59 however it can not use string pointers at all.
XC8 can do it, but it can not dereference 2-level string tables.

So a construct like the following is neccessary:

CODE: SELECT_ALL_CODE
char* get_font_ptr(char* font)
{unsigned int addr;
 addr=*(font+1);addr<<=8;addr|=*(font);
 return(((const char*)(addr)));
}


The LED matrix is 10x5 LEDs connected directly to the PIC I/O with no resistors whatshowever.
It can work at 3 volts easily. Frequency is 560 KHz.

To simplify the scrolling algorithm, a 2K SRAM chip is used (one 256 bytes bank is addressable).
Since proportional fonts are used, it is very complicated to fetch bitmap data by scroll position.
So it is precomputed and stored into RAM.

I made the scrolling message working within a few days. There was some program space left,
so I added I2C code, and removed some unneccessary code. It can read data from a temperature sensor,
and insert it into the scrolling text!

After this program memory was used up 92%. Doing some optimizations, I was able to reduce it to 81%.
So there is still a little room for instance to change the 2K parallel RAM to serial RAM.
Anyway, I have some of these 2K RAM chips around here, and there is little opportunity to use them ever.

If anyone is seriously interested in the source code, I can publish it here.
The schematic does not exist but it is not much to documentate.
It should be possible to rebuild it, simply using the information inside the source code
for pin assignments.

1. The I2C code does not contain any delays, it simply relies on the low clock frequency (instruction cycle is 141.6 KHz).
2. The program is not using all of the RAM, only 44%, so it might even be possible to run it on the 16F57.
3. Not all of the ASCII subset is implemented, only capitalized letters, numbers, and a few symbols. However,
each additional character only needs 5 program words.
4. There are various flickering effects due to the low frequency. Eventually, this could be changed to 1Mhz or 2 MHz.
If 4 MHz are used (or 3.58 MHz colorburst), it might be neccessary to add delays to the I2C code.

If anyone is interested to rebuild this, maybe a PRO compiler can be used, and a serial RAM. How much codespace can be saved using a PRO compiler? I don't think so much but certainly some 100 words.

The bill of materials is about 5 dollars, depends what LEDs you use, what kind of PCB, etc., so it could be $10 if you use expensive LEDs. Any kind of LEDs can be used. They are simply connected in X/Y fashion with common cathode. On the proto PCB two anodes are connected to each other this is the only way to get a dense layout.

The I2C temp. sensor is a MCP9802 I think. But having temp. display is optional. It would also be easy to use a pushbutton to skip between different messages.

http://www.youtube.com/watch?v=VC9MHTGvSWo

Some source code pieces are here on my blog: http://forum.allaboutcircuits.com/blog.php?u=164830
However the complete source code was not yet made available to the general public.
Observing various projects here, including larger source codes as well, I don't see a problem making it available.
I will do it if it is requested.
Attachments
thermometer.jpg
User avatar
takao21203
Discoverer
 
Posts: 111
Joined: Mon Mar 19, 2012 7:52 pm
Location: Ireland, Europe

Re: 16F59 scrolling message, I2C thermometer

Postby Brian Griffin » Mon Jul 30, 2012 4:44 pm

I like the project - it's very 80/90-ish and very retro style. I would imagine putting it in an old yellowed enclosure. 8-)
PIC - UIC00B from Cytron (replacement for my broken PICKit 2), Pickit 3, MikroC for PIC
dsPIC - MikroC for dsPIC, mikromedia board (dsPIC33)
AVR - AVR Dragon
Parallax - Prop tool
User avatar
Brian Griffin
Enthusiast
 
Posts: 403
Joined: Mon Jan 17, 2011 9:36 am

Re: 16F59 scrolling message, I2C thermometer

Postby takao21203 » Mon Jul 30, 2012 4:50 pm

Using a round adapter PCB, two carrier PCBs stacked on each other + serial RAM,
it could be much smaller.

This is more kind of a study if it is possible to use 16F59 together with C language.
Using a more powerful PIC would be cheaper, for instance even 16f1503 has 128 bytes RAM.
16f1824 has 256 bytes!

But, using a midrange PIC with 44 pins, extended midrange, 18F etc.,
and cost goes up considerably.
I got these RAM chips at low cost...

Not that I would really have to bother about $1 or $2.

I have around two circuits with 5x5 LED matrix, for 16f1824 (removed them for other projects),
and one larger 144 LEDs matrix. I am happy this project is now finalized!
And I resumed work at the infrared interface software.

5x10 LEDs using 3mm diameter LEDs looks like this:
P7300308.jpg


Any kind of LEDs can be used, and display size can be changed upto 5x16 LEDs.
The software only needs to have one constant value changed for different display window.
User avatar
takao21203
Discoverer
 
Posts: 111
Joined: Mon Mar 19, 2012 7:52 pm
Location: Ireland, Europe


Return to Project Showcase

Who is online

Users browsing this forum: No registered users and 5 guests