CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Rotating text with PIC16F877

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
StudentInNeeded
Guest







Rotating text with PIC16F877
PostPosted: Mon Mar 31, 2008 2:04 pm     Reply with quote

I need some help, I'm doing an LED display controlled by a PIC16F877A. All my columns are linked together and all my rows too, so I can control independently each LED. Now, I have 28 columns by 7 rows, and I can send 1 letter, that mean 6 columns by 7 rows. But when I upgrade my two-dimensional table variable to 28(columns) and that I compile, CCS me returns an error "Data item too big".

1 Letter declaration: (Working)
Code:

int Table[7][6]={0,1,1,1,0,0,
                 1,0,0,0,1,0,
                 1,0,0,0,0,0,
                 1,0,1,1,1,0,
                 1,0,0,0,1,0,
                 1,0,0,0,1,0,
                 0,1,1,1,1,0};


28 columns declaration: (Error: Data item too big)
Code:

int rom Table[7][28]={
0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0,0,1,0,0,
                    1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,
                    1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,
                    1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,
                    1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,
                    1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,
                    0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,1,1,1,1,1,0,0,1,0,0};

I have also added the "rom" option because it was too big for the RAM and I use one table because I need to rotate all columns one by one, to create a rotation.

So anyone can help me or have an good idea,
just share it, it would be appreciated.

Alex
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Mar 31, 2008 2:36 pm     Reply with quote

Do you need to use a byte for each led ? Why not use a bit ?
Then you can use 1/8 of the RAM for the table.

For example, look at the character font tables in this file.
They pack each character into 5 bytes.
Quote:
c:\Program Files\picc\Drivers\glcd.c
Spatofy



Joined: 31 Mar 2008
Posts: 1

View user's profile Send private message

PostPosted: Wed Apr 02, 2008 6:51 am     Reply with quote

I can't use that glcd.c because I'm doing my own display with LED. It's a matrix of 7x28 and I'm able to send a entire row of 28 at the same time, so I did a refresh procedure to show every row a little time to display a full letter. I need to use a bit for every LED.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Apr 02, 2008 9:09 am     Reply with quote

Since your entire data consists of 1's and 0's, you can certainly pack
the data into bytes and then unpack it before you display it. Packing
data into bytes is a standard technique used by embedded programmers
to conserve ROM space. The data is compiled in packed format, and
then you need to write a routine to unpack it at runtime.

Look at the many character generators for LCD that are available on
the net. They graphically show how the packing is done:
http://www.keokitrask.com/EDL/LCDCharacterGenerator.htm
More explanation:
http://www.rentron.com/Myke2.htm
kamputty
Guest







PostPosted: Wed Apr 02, 2008 2:30 pm     Reply with quote

Hi all!

Look at the OLED example I have in the software area for PIC...it has the 5x7 fonts (thanks to my daughter's handy work) that does it using bits...might help, might not!

~Kam (^8*
kamputty
Guest







PostPosted: Wed Apr 02, 2008 2:56 pm     Reply with quote

While I was thinking about it...here is the font part of the code...

int8 fonts[80][5]=
{
{ // 0
0b00111110,
0b01010001,
0b01001001,
0b01000101,
0b00111110
},
{ // 1
0b00000000,
0b01000010,
0b01111111,
0b01000000,
0b00000000
},
{ // 2
0b01000010,
0b01100001,
0b01010001,
0b01001001,
0b01000110
},
{ // 3
0b00100010,
0b01000001,
0b01001001,
0b01001001,
0b00110110
},
{ // 4
0b00011000,
0b00010100,
0b00010010,
0b01111111,
0b00010000
},
{ // 5
0b00100111,
0b01000101,
0b01000101,
0b01000101,
0b00111001
},
{ // 6
0b00111100,
0b01001010,
0b01001001,
0b01001001,
0b00110000
},
{ // 7
0b00000001,
0b01110001,
0b00001001,
0b00000101,
0b00000011
},
{ // 8
0b00110110,
0b01001001,
0b01001001,
0b01001001,
0b00110110
},
{ // 9
0b00000110,
0b01001001,
0b01001001,
0b01001001,
0b00111110
},
{ // !
0b00000000,
0b00000000,
0b01011111,
0b00000000,
0b00000000
},


and so on.

Each character is only 5 bytes...

~Kam (^8*
StudentInNeeded
Guest







PostPosted: Sun May 18, 2008 12:00 pm     Reply with quote

Finally, i just change my 16f877 for an 18f452, same pinout but way more memory...
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group