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 CCS Technical Support

Font for 14seg LED display (binary notation?)

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



Joined: 28 May 2006
Posts: 56

View user's profile Send private message

Font for 14seg LED display (binary notation?)
PostPosted: Mon Apr 14, 2008 10:31 am     Reply with quote

Hello,
I just recieved a part from allelectronics (CAT# DSY-1) that includes a 7 char 14seg display. I need to create a font for this device. I plan on storing the bit pattern array in rom via the CONST statement. The elements of this array are to be 'long'. I would like to use binary notation, but I have at few questions:
1. I've never used binary notation before, would it be acceptible in this situation? Or is there a better option?

2. Does CCS support binary notation? I can't find any mention of it in the help file. Can I even use binary notation for a long?

3. Can someone give me an example of binary notation?

Here is my code so far. Display.A[] is what the program will modify to change the display, BA[] holds the bit pattern that is to be sent to the display. SetupDisplay() will be called to perform the conversion from the char Display.A[] to the bit pattern in Display.BA[]. The bit pattern will be pulled from the ALPHAFont. Same goes for Display.N[] except its a 7seg display. The display will be updated 100 times a second, and the contents of the display will be updated 8 times a second.

Any suggestions are welcome. I've never done this type of program before.

I should mention that

Code:

#include <16F877a.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)             //clock speed
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,ERRORS)


#define TIMER2PERIOD 250

#define MAIL   0
#define PHONE  1
#define STORAGE   2
#define NETWORK   3
#define AC1 4
#define AC2 5
#define NC1 6
#define NC2 7

int DoDSYSetup,QuarterSecondPassed,HalfSecondPassed,SecondPassed,Timer2Count;

LONG CONST ALPHAFont[90] = {};
INT CONST NUMERICFont[10] = {};
struct typeserialpacket {
   char A[7];
   char N[4];
   
   long BA[7];
   int BN[4];
   
   int Icons;
} Display;

#int_TIMER2
void TIMER2_ISR(){
   //this function should be called X times a second
   static int TIMER2Counter;
   static int DSYSetup;
   int i;

   TIMER2Counter++;
   DSYSetup++;
   if (DSYSetup == TIMER2PERIOD/8){
      DoDSYSetup = TRUE;
      DSYSetup = 0;
   }
   if ((Timer2Counter == TIMER2PERIOD/4) || (Timer2Counter == TIMER2PERIOD/4*2) || (Timer2Counter == TIMER2PERIOD/4*3) || (Timer2Counter == TIMER2PERIOD/4*4)){
      QuarterSecondPassed = TRUE;
   }
   if ((Timer2Counter == TIMER2PERIOD/2) || (Timer2Counter == TIMER2PERIOD/2*2)){
      HalfSecondPassed = TRUE;
   }

   if (Timer2Counter == TIMER2PERIOD){
      SecondPassed = TRUE;
      Timer2Counter = 0;
   }
}

void SetupDisplay(){
   int i;
   for (i=0;i<=6;++i){   
   }     
}
void main(){
   printf("DSY-1 from All Electronics Test");
   enable_interrupts(INT_TIMER2);
   enable_interrupts(GLOBAL);
   setup_timer_2(T2_DIV_BY_16,250,5);

   while(TRUE){
      if (DoDSYSetup == TRUE){
         DoDSYSetup = !DoDSYSetup;
         SetupDisplay();
      }
   }   
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Apr 14, 2008 11:01 am     Reply with quote

This thread shows how to do a numeric font for a 14-segment LCD.
http://www.ccsinfo.com/forum/viewtopic.php?t=33377&start=11
kd5uzz



Joined: 28 May 2006
Posts: 56

View user's profile Send private message

PostPosted: Mon Apr 14, 2008 12:02 pm     Reply with quote

That is great, thanks!
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