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

LED dot matrix is working, now what?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ernest



Joined: 11 Feb 2004
Posts: 51

View user's profile Send private message

LED dot matrix is working, now what?
PostPosted: Thu Nov 18, 2004 4:11 am     Reply with quote

Hi,

I've built a prototype of 5x7 dot matrix scrolling message display capable of displaying 50 characters. New message can be created by changing it using RS-232. The prototype is working perfectly but... I don't really like the way it display certain characters such a 'e', 'i', 'l', '!' and etc.

So for a message containing such characters for example, "Welcome! Hi!" would be displayed as
"Wel come! Hi !"

This is because the columns are driven by 74HC595 and for small characters like '!' would have 4 column spacing, while ',' would have 3 column spacing, '1' would have 2column spacings.

How can I overcome this problem if I maintain the hardware design?

Any suggestions are welcome.


Thank You.
ernest

P/S. I am using PIC16F877A and the partial program is as follow:

Code:

char  const ascii1[32][6] = {     // ASCII from 'Space' to '?'
  {0,0,0,0,0,0}                  //   0   Space
  {0,95,0,0,0,0}                 //   1   !
  {0, 7,0,7,0,0}                 //   2   "
  {0, 20,127,20,127,20}          //   3   #
  {0, 36, 42, 127, 42, 18}       //   4   $
  {0, 39, 21, 107, 84, 114}      //   5   %
   :
   :
   : (others not included)
 }

char  const ascii2[32][6] = {     // ASCII from '@' to '_'
{0, 50, 73, 121, 65, 62}          //      0   
{0, 124, 18, 17, 18, 124}         //      1
{0, 65, 127, 73, 73, 54}          //      2
{0, 62, 65, 65, 65, 34}           //      3
{0, 65, 127, 65, 65, 62}          //      4
   :
   : (others not included)
 }

char  const ascii3[31][6] = {  // ASCII from '`' to '~'
   {0, 7, 11,0,0,0}            //   0
   {0, 32, 84, 84, 84, 56}     //   1
   {0, 127, 40, 68, 68, 56}    //   2
   {0, 56, 68, 68, 68,0}       //   3
   {0, 56, 68, 68, 40, 127}    //   4
   :
   : (others not included)
 }



The main program for the message display comprises of below. However, it can only work for char. with constant column size ie.6columns.
Code:

      do
         {
         if(!input(PIN_E1))      // if RE1 == LOW (pressed)
            { printf("\r\n\n  Enter the char.: ");
              get_line1();      // acquire char.
            } 

            delaycount=5;
            while (delaycount)
               {
                  index = startposition;

               for (i=0;i<32;i++)
                  {
                  // store our mask in an array. we need to do this because
                  // the call to write_expanded_outputs will destroy the value
                  // passed in.
                  data[0] = mask[0]; // store which column we are driving
                  data[1] = mask[1]; // in an array
                  data[2] = mask[2];
                  data[3] = mask[3];

                  index = i + startposition; // point to the next pattern to display
                  if (index >= (6*sizeof(s1)))  // ensure that we don't exceed the array
                     index -= (6*sizeof(s1));   // index = index - sizeof(pat)

                  port_d=0;
                  write_expanded_outputs(data); // enable our column driver


      x = s1[index/6];

      if( x < 64)      // check if s1[] is inside ascii1[] array (ASCII 20H--3fH)
         port_d = ascii1[x-32][index%6];


      if( x > 95)     // check if s1[] is inside ascii3[] array (ASCII 60H--7eH)
         port_d = ascii3[x-96][index%6];


      if( x>63 && x<96 )      // check if s1[] is inside ascii2[] array
         port_d = ascii2[x-64][index%6];
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Nov 18, 2004 7:10 am     Reply with quote

I think you already know the solution. Currently you use 6 columns for every char. Make this a variable pitch font. This is where pointers to const would come in handy.

The solution:
Create an array for each char. Include the size of the array as the first member.

Other solution would be to use 0xFF as a terminator in your current design. So you would continue to print unless you get an 0xFF. This of course only works if 0xFF is invalid which should be if they are 5x7.

Don't like those suggestions, then just trap on the offending characters and print them differently.

Also note that all you chars start with 0 for some inner char spacing. Why not save some code space and just print the space after you print the char (or before).
ernest



Joined: 11 Feb 2004
Posts: 51

View user's profile Send private message

PostPosted: Fri Nov 19, 2004 2:14 am     Reply with quote

Thanks Mark for the invaluable guide.

But I've never dealt with pointers before so it's going to take me some time to learn this. Could you recommend how I can understand about pointers much better?

In the mean time, I'm trying to solve the problem with the fixed column display. I'm also trying to understand how each of your suggestions can be implemented.

In your suggestion to include the size of array as the first member, how can I make use of the first member of the array (containing size of array) to determine when to switch character without affecting the 'index' and 'mask' array? It's very difficult t visualize these variables especially with the 'startposition' changing.
Please guide.


I have tried with the following codes but they don't work. Why?
I've been trying to figure out why.

Thank You.
ernest


Code:

char  const ascii1[32][6] = { // all trailing 0 terminated with 255
   {0,0,255,255,255,255}      // space   
   {0,95,255,255,255,255}    // '!'
                 :
                 :
  };   

// In main program...

      index = i + startposition; // point to the next pattern to display
      if (index >= (6*sizeof(s1)))  // ensure that we don't exceed the array
                     index -= (6*sizeof(s1));   // index = index - sizeof(pat)

      port_d=0;
      write_expanded_outputs(data); // enable our column driver
      x = s1[index/6];
                   
      if( (x<64) && (ascii1[x-32][index%6] != 255)) //is s1[] is inside ascii1[] array
         {
            if(ascii1[x-32][index%6] != 255)
               {
               port_d = ascii1[x-32][index%6];
               if (shift_left(mask,4,0))     //(mask,4,0))
                  mask[0] = 0x01;
               delay_us(650); // adjust this value to control the drive time
                              //for the leds
               }
         }

      if( (x>95) && (x<127) && (ascii3[x-96][index%6] != 255))      // check if s1[] is inside ascii1[] array
         {
            if(ascii3[x-96][index%6] != 255)
               {
               port_d = ascii3[x-96][index%6];
               if (shift_left(mask,4,0))     //(mask,4,0))
                  mask[0] = 0x01;
               delay_us(650); // adjust this value to control the drive time
                              //for the leds
               }
         }

      if( (x>63) && (x<96) && (ascii2[x-64][index%6] != 255))      // check if s1[] is inside ascii1[] array
         {
            if(ascii2[x-64][index%6] != 255)
               {
               port_d = ascii2[x-64][index%6];
               if (shift_left(mask,4,0))     //(mask,4,0))
                  mask[0] = 0x01;
               delay_us(650); // adjust this value to control the drive time
                              //for the leds
               }
         }





Mark wrote:
I think you already know the solution. Currently you use 6 columns for every char. Make this a variable pitch font. This is where pointers to const would come in handy.

The solution:
Create an array for each char. Include the size of the array as the first member.

Other solution would be to use 0xFF as a terminator in your current design. So you would continue to print unless you get an 0xFF. This of course only works if 0xFF is invalid which should be if they are 5x7.

Don't like those suggestions, then just trap on the offending characters and print them differently.

Also note that all you chars start with 0 for some inner char spacing. Why not save some code space and just print the space after you print the char (or before).
ernest



Joined: 11 Feb 2004
Posts: 51

View user's profile Send private message

PostPosted: Mon Nov 22, 2004 2:28 am     Reply with quote

Hi Mark,

I been trying very hard to solve the problem with my display but still couln't really come up with the proper solution.

Could you give me some pointers and guidance as to how I can solve the problem?


Thanks in advance.
Ernest


I've tried with the codes below but they don't work.

Code:

         if(!input(PIN_E1))      // if RE1 == LOW(pressed)
            { delay_us(2);
               printf("\r\n\n  Enter the char.: ");
               get_line1();      // acquire 20 char.

               for(i=0; i<20; i++)
                  { index_size += ascii_size[(s1[i]-32)]; }
               delay_us(2);
               printf("\r\n Size of msg.: %d columns",index_size);

            }  // END of INPUT(PIN_E1)

            delaycount=5;
            while (delaycount)
               {
                  index = startposition;
                  index_valid = startposition;
     
               printf("\r\n Index=%u,  Index_valid=%u",index, index_valid);

               for (i=0;i<32;i++) // we have 32 columns to drive  //for (i=0;i<32;i++) //
                  {
                  // store our mask in an array. we need to do this because
                  // the call to write_expanded_outputs will destroy the value
                  // passed in.
                  data[0] = mask[0]; // store which column we are driving
                  data[1] = mask[1]; // in an array
                  data[2] = mask[2];
                  data[3] = mask[3];

                  if(!input(PIN_E2))      // to allow user to FREEZE DISPLAY/SCROLLING when RE2==LOW
                     delaycount = 4;

                 port_d=0;
                  write_expanded_outputs(data); // enable our column driver


      x = s1[index/6];

      if(x<64)             // check if s1[] is inside ascii1[] array
         {
            if(ascii1[x-32][index%6] != 255)
               {
                  index_valid = i + startposition; // point to the next pattern to display
                  if (index_valid >= index_size)   //(6*sizeof(s1)))  // ensure that we don't exceed the array
                     index_valid -= index_size;    //(6*sizeof(s1));   // index = index - sizeof(pat)
               port_d = ascii1[x-32][index%6];
               if (shift_left(mask,4,0))     //(mask,4,0))
                  mask[0] = 0x01;
               delay_us(600); // adjust this value to control the drive time
                              //for the leds
               printf("\r\nIndex=%u, Valid_i=%u, data=%lx, i=%u,   VALID",index,index_valid,data,i);
               }
            else
               {i=i-1;
               printf("\r\nIndex=%u, Valid_i=%u, data=%lx, i=%u,   INVALID",index,index_valid,data,i);
                 }
         }


      if( (x>95) && (x<127))      // check if s1[] is inside ascii1[] array
         {
            if(ascii3[x-96][index%6] != 255)
               {
                  index_valid = i + startposition; // point to the next pattern to display
                  if (index_valid >= index_size)   //(6*sizeof(s1)))  // ensure that we don't exceed the array
                     index_valid -= index_size;    //(6*sizeof(s1));   // index = index - sizeof(pat)
               port_d = ascii3[x-96][index%6];
               if (shift_left(mask,4,0))     //(mask,4,0))
                  mask[0] = 0x01;
               delay_us(600); // adjust this value to control the drive time
                              //for the leds
               printf("\r\nIndex=%u, Valid_i=%u, data=%lx, i=%u,   VALID",index,index_valid,data,i);                             
               }
            else
               {i=i-1;
                printf("\r\nIndex=%u, Valid_i=%u, data=%lx, i=%u,   INVALID",index,index_valid,data,i);
                               }
         }

      if( (x>63) && (x<96))      // check if s1[] is inside ascii1[] array
         {
            if(ascii2[x-64][index%6] != 255)
              {

                  index_valid = i + startposition; // point to the next pattern to display
                  if (index_valid >= index_size)   //(6*sizeof(s1)))  // ensure that we don't exceed the array
                     index_valid -= index_size;    //(6*sizeof(s1));   // index = index - sizeof(pat)               port_d = ascii2[x-64][index%6];
               if (shift_left(mask,4,0))     //(mask,4,0))
                  mask[0] = 0x01;
               delay_us(600); // adjust this value to control the drive time
                              //for the leds
               printf("\r\nIndex=%u, Valid_i=%u, data=%lx, i=%u,   VALID",index,index_valid,data,i);                             
               }
            else
               {i=i-1;
               printf("\r\nIndex=%u, Valid_i=%u, data=%lx, i=%u,   INVALID",index,index_valid,data,i);
                 }
         }

                  index += 1;
        } //end of for-loop         
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Nov 22, 2004 7:12 am     Reply with quote

Quote:
This is where pointers to const would come in handy.


I was "poking" at the compiler. The compiler does not allow pointers to consts.


It looks like you have decided to try the 0xFF approach. Now this is how I would do it. Lets say I have a 50 column display. If I wanted to store all the data, it would take an array 50 bytes long. Just copy each characters data into the array until I read a 255, then move on to the next char. Once all the data is read, then write the data out. Does that make sense? How many columns do you have?
ernest



Joined: 11 Feb 2004
Posts: 51

View user's profile Send private message

PostPosted: Mon Nov 22, 2004 9:32 pm     Reply with quote

Quote:
Quote:
This is where pointers to const would come in handy.


I was "poking" at the compiler. The compiler does not allow pointers to consts.

It looks like you have decided to try the 0xFF approach. Now this is how I would do it. Lets say I have a 50 column display. If I wanted to store all the data, it would take an array 50 bytes long. Just copy each characters data into the array until I read a 255, then move on to the next char. Once all the data is read, then write the data out. Does that make sense? How many columns do you have?


I have tried copying each characters to an array but the maximum size allowable is 50 bytes. If the array exceeds 50 elements, the prototype doesn't work. In fact, I'm planning to have 50 characters for display, so there will be about 50x5=250 columns data to be stored.

Hence, some sort of algorithms that could make use of the const ascii arrays (stored in the ROm) would be good without overloading the RAM. But the question is, how can I do that while keeping track of the 'index' and the timing of the columns being driven by HC595.

I have tried to define the first element/member of each ascii array as the column size but I can't really figure out what will happen and how to keep track of the column shifting if 'startposition' is NOT ZERO. Since this is a scrolling message display, the 'startposition' will keep on incrementing.

Code:
index_valid = i + startposition; // point to the next pattern to display


So, how would I know which ORDER of character when startposition is not zero. For example, startposition=25. How would I know how many characters before this since the characters do not have fixed column size and can have 6, 5, 4, 3 or 2 columns size?

So, the question is, how can I really identify and keep of track of which char.for display everytime?

ernest
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Nov 22, 2004 11:02 pm     Reply with quote

Quote:
So, how would I know which ORDER of character when startposition is not zero. For example, startposition=25. How would I know how many characters before this since the characters do not have fixed column size and can have 6, 5, 4, 3 or 2 columns size?


The simplest approach would be to always start at the begining. Start counting until you get to 25 and then start outputing the data.

If the text just completely scrolls off the display, then all you need to do is write the data to the shift registers and then just shift in 0's. The # of 0's equates to you starting position.
Jerry I



Joined: 14 Sep 2003
Posts: 96
Location: Toronto, Ontario, Canada

View user's profile Send private message

PostPosted: Tue Nov 23, 2004 5:46 pm     Reply with quote

Why do you have different column sizes for the characters.

I have designed and programmed scrolling LED displays and never changed the number of columns for different characters.

If you have a 5x7 font you would need a field of 6 pixels columns, the 6th column would be the off pixel between each character. I know that a character '1', 'I' will not take the full 5 pixel columns but just center the character in the 5x7 font spacing. Then all would have to do is get the data from character generator table which includes the 6th off pixel then shift it out to the hc595. This will always shift 6 bits for all characters.
All characters will look proportional on the display.

If you are going to display 50 characters that would mean that 6 bits are needed for each character.

6 x 50 = 300 bits/pixels across = 37.5 hc595 horizontally.

I have always designed led boards that are a multiple of 8 or 16.

Therefore the actual display would have at 304 pixels across = 38 hc595s and 7 or 8 rows.


good Luck

Jerry 'Wink'




ernest wrote:
Quote:
Quote:
This is where pointers to const would come in handy. :wink

Good luck.




I was "poking" at the compiler. The compiler does not allow pointers to consts.

It looks like you have decided to try the 0xFF approach. Now this is how I would do it. Lets say I have a 50 column display. If I wanted to store all the data, it would take an array 50 bytes long. Just copy each characters data into the array until I read a 255, then move on to the next char. Once all the data is read, then write the data out. Does that make sense? How many columns do you have?


I have tried copying each characters to an array but the maximum size allowable is 50 bytes. If the array exceeds 50 elements, the prototype doesn't work. In fact, I'm planning to have 50 characters for display, so there will be about 50x5=250 columns data to be stored.

Hence, some sort of algorithms that could make use of the const ascii arrays (stored in the ROm) would be good without overloading the RAM. But the question is, how can I do that while keeping track of the 'index' and the timing of the columns being driven by HC595.

I have tried to define the first element/member of each ascii array as the column size but I can't really figure out what will happen and how to keep track of the column shifting if 'startposition' is NOT ZERO. Since this is a scrolling message display, the 'startposition' will keep on incrementing.

Code:
index_valid = i + startposition; // point to the next pattern to display


So, how would I know which ORDER of character when startposition is not zero. For example, startposition=25. How would I know how many characters before this since the characters do not have fixed column size and can have 6, 5, 4, 3 or 2 columns size?

So, the question is, how can I really identify and keep of track of which char.for display everytime?

ernest
Wink
ernest



Joined: 11 Feb 2004
Posts: 51

View user's profile Send private message

PostPosted: Tue Nov 23, 2004 11:06 pm     Reply with quote

Thanks a lot Mark & Jerry for your invaluable suggestions. Centering and fixing all the char. to 6 columns help a lot indeed. With this, I can now proceed to try entering all the 50 char. or more messages for display. (Will try the variable column size method later.)

I realized I can only enter a maximum of 42 characters for display.
I have changed the 'index' and 'startposition' variables to int16 but any message more than 42 characters does not work. Why? Is it because of the limitation of array size in the RAM?

I tried to overcome this by creating two more arrays to store my message char. Or is there a better way to do this?
The codes are as below:

ernest

Code:

char s1[42];   char s2[42];   char s3[40]; // max.allowable by RAM

void get_line1()   {
   for(i=0; i<s1_char_size; i++)  //s1_char_size contain size of array s1[]
      { s1[i]=getc();
         delay_cycles(2);
         printf("%C",s1[i]);
         delay_us(1);     }
                                             
   if(s1_char_size==42 && s2_char_size != 0)
      {  for(i=0; i<s2_char_size; i++) //s2_char_size contain size of array s2[]
            {  s2[i]=getc();
               delay_cycles(2);
               printf("%C",s2[i]);
               delay_us(1);   }
      }

   if(s2_char_size==42 && s3_char_size != 0)
      { for(i=0; i<s3_char_size; i++) //s3_char_size contain size of array s3[]
            { s3[i]=getc();
               delay_cycles(2);
               printf("%C",s3[i]);
               delay_us(1);    }
      }
  }  // END of void get_line1()

// In the main program
   while (delaycount)
        {  index = startposition;

               for (i=0;i<32;i++) // we have 32 columns to drive  //for (i=0;i<32;i++) //
                  {
                  // store our mask in an array. we need to do this because
                  // the call to write_expanded_outputs will destroy the value
                  // passed in.
                  data[0] = mask[0]; // store which column we are driving
                  data[1] = mask[1]; // in an array
                  data[2] = mask[2];
                  data[3] = mask[3];

 (int16)index = i + startposition; // point to the next pattern to display

      if (index >= (6*(s1_char_size + s2_char_size + s3_char_size)))   //(6*sizeof(s1)))  // ensure that we don't exceed the array
         (int16)index -= (6*(s1_char_size + s2_char_size + s3_char_size));    //(6*sizeof(s1));   // index = index - sizeof(pat)

                  port_d=0;
                  write_expanded_outputs(data); // enable our column driver

   if(index < 252)
      x = s1[index/6];
   else if((index >= 252) && (index<504))
      x = s2[(index-252)/6];
   else if(index >= (84*6))
      x = s3[(index-504)/6];

      if( x < 64)      // check if s1[] is inside ascii1[] array
         port_d = ascii1[x-32][index%6];
         
      if( x > 95)      // check if s1[] is inside ascii3[] array
         port_d = ascii3[x-96][index%6];

      if( x>63 && x<96 )      // check if s1[] is inside ascii2[] array
         port_d = ascii2[x-64][index%6];

                  if (shift_left(mask,4,0))     //(mask,4,0))
                  mask[0] = 0x01;
                  delay_us(550); // adjust this value to control the drive time
                                         //for the leds
                  }     // END for-loop

            --delaycount; // decrement our delay loop counter
            }
      ++startposition; // Point to the next data pattern

      if (startposition >= (6*(s1_char_size + s2_char_size + s3_char_size)))  //(6*sizeof(s1))) // make sure that we don't exceed the array
         startposition = 0;
   } while(1);







Jerry I wrote:
Why do you have different column sizes for the characters.

I have designed and programmed scrolling LED displays and never changed the number of columns for different characters.

If you have a 5x7 font you would need a field of 6 pixels columns, the 6th column would be the off pixel between each character. I know that a character '1', 'I' will not take the full 5 pixel columns but just center the character in the 5x7 font spacing. Then all would have to do is get the data from character generator table which includes the 6th off pixel then shift it out to the hc595. This will always shift 6 bits for all characters.
All characters will look proportional on the display.

If you are going to display 50 characters that would mean that 6 bits are needed for each character.

6 x 50 = 300 bits/pixels across = 37.5 hc595 horizontally.

I have always designed led boards that are a multiple of 8 or 16.

Therefore the actual display would have at 304 pixels across = 38 hc595s and 7 or 8 rows.


good Luck

Jerry 'Wink'




ernest wrote:
Quote:
Quote:
This is where pointers to const would come in handy. :wink

Good luck.




I was "poking" at the compiler. The compiler does not allow pointers to consts.

It looks like you have decided to try the 0xFF approach. Now this is how I would do it. Lets say I have a 50 column display. If I wanted to store all the data, it would take an array 50 bytes long. Just copy each characters data into the array until I read a 255, then move on to the next char. Once all the data is read, then write the data out. Does that make sense? How many columns do you have?


I have tried copying each characters to an array but the maximum size allowable is 50 bytes. If the array exceeds 50 elements, the prototype doesn't work. In fact, I'm planning to have 50 characters for display, so there will be about 50x5=250 columns data to be stored.

Hence, some sort of algorithms that could make use of the const ascii arrays (stored in the ROm) would be good without overloading the RAM. But the question is, how can I do that while keeping track of the 'index' and the timing of the columns being driven by HC595.

I have tried to define the first element/member of each ascii array as the column size but I can't really figure out what will happen and how to keep track of the column shifting if 'startposition' is NOT ZERO. Since this is a scrolling message display, the 'startposition' will keep on incrementing.

Code:
index_valid = i + startposition; // point to the next pattern to display


So, how would I know which ORDER of character when startposition is not zero. For example, startposition=25. How would I know how many characters before this since the characters do not have fixed column size and can have 6, 5, 4, 3 or 2 columns size?

So, the question is, how can I really identify and keep of track of which char.for display everytime?

ernest
Wink
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Nov 24, 2004 5:39 am     Reply with quote

Which PIC?
Jerry I



Joined: 14 Sep 2003
Posts: 96
Location: Toronto, Ontario, Canada

View user's profile Send private message

PostPosted: Wed Nov 24, 2004 8:27 am     Reply with quote

18F252

What method are you driving the leds.

Refresh, where you have one row of 74hc595s and then having a transistor/fet per row to turn on the row to display. This requires a high refresh rate.

Or direct drive where each output of the hc595 drives an LED example a board that is 8x8 matrix would have 8 hc595s.

This is much easier to drive but more costly.

Wink

Mark wrote:
Which PIC?
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Nov 24, 2004 8:39 am     Reply with quote

My question was for ernest about which PIC he was using.

As for the debate on fixed pitch or variable pitch, I'd use variable. Why?
1. Cause I'd get more chars visible
2. Cause it would be more fun to program
3. Cause it would look better
ernest



Joined: 11 Feb 2004
Posts: 51

View user's profile Send private message

PostPosted: Wed Nov 24, 2004 6:39 pm     Reply with quote

I agree to Mark's reasons to use variable instead of fixed column size especially the 1st point of allowing more chars. to be displayed. As for the 2nd point, I believe it would be much more challenging for a novice like me to program. But i'm sure i'd be able to learn a lot from this. Initially, the main reason why I choose to use variable column size method is obviously because of the better look and arrangement but it sure is testing my C programming skill.

But Jerry's method allows a simple, fast and quick way to get the application to work. It's certainly a fun, quick and workable way to let the user to see the result without caring much about the column arrangement.

My question here is, would I have enough RAM left for me to use after putting in all the codes necessary for variable column display. I'm using PIC16F877A.

I'll try to adopt the fixed column size method first to allow me to concentrate on other things that need to be done to get the whole thing up.
At the moment, I'm facing problem with sending and displaying more than 42 chars. Why is that so?
I'm using PIC16F877A and can only try it out on 4 units of 74HC595 ie.32columns of dot matrix only due to lack of components.

I have set the 'index', 'startposition', 'i' and 's1_char_size' variables to long to allow it to increment to more than 256 (42 char.x 6 fixed column per char. = 252). But the RS-232 Hyperterminal interface hang when i try to key-in more than 42 char.

Code:

    index = i + startposition; // point to the next pattern to display
    if (index >= (6*s1_char_size)) // ensure that we don't exceed the array
         index -= (6*s1_char_size); 


ernest



Mark wrote:
My question was for ernest about which PIC he was using.

As for the debate on fixed pitch or variable pitch, I'd use variable. Why?
1. Cause I'd get more chars visible
2. Cause it would be more fun to program
3. Cause it would look better
ernest



Joined: 11 Feb 2004
Posts: 51

View user's profile Send private message

PostPosted: Sun Nov 28, 2004 8:10 pm     Reply with quote

Mark wrote:
Which PIC?


I'm using PIC16F877A.


If I enter more than 42 characters, the Hyperterminal program for RS-232 hang.

What is the maximum char.that can actually be supported by PIC16F877A? How do I optimize this?

ernest
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Sun Nov 28, 2004 8:34 pm     Reply with quote

That PIC has 368 bytes of RAM. The compiler uses some for scratch variables so you can't use all 368 bytes but certainly can use more than 42 if you buffer is big enough.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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