Pages: [1]   Go Down
Author Topic: Fastest single 7 segment display driver  (Read 441 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Right.. just written the fastest LED 7 segment display controller evah.
Good luck understanding...
Works for me, If you got problems, I think it's about libraries etc....


/* This is about Arduino Due. 7 segment LED Display. Common cathode.
   Very basic, but works. And, it's realy fast, so applicable for interrupt stuff !!
 
   Translation:
  Pin = Seg    Hardware
   33 = A      7 Seg pin 1
   34 = B      7 Seg pin 13
   35 = C      7 Seg pin 10
   36 = D      7 Seg pin 8
   37 = E      7 Seg pin 7
   38 = F      7 Seg pin 2
   39 = G      7 Seg pin 11
   40 = DP     7 Seg pin 9
   2  = PLUS   7 Seg pin 3
*/

unsigned int  PLUS  = 150 ;
unsigned int  Tel   ;

unsigned long NUL   = 0b00000000000000000000000110000000 ;   // Or translate to hex.. whatever you like..
unsigned long EEN   = 0b00000000000000000000000111110010 ;
unsigned long TWEE  = 0b00000000000000000000000101001000 ;
unsigned long DRIE  = 0b00000000000000000000000101100000 ;   // Or English... F*ckin Dutch !!
unsigned long VIER  = 0b00000000000000000000000100110010 ;
unsigned long VIJF  = 0b00000000000000000000000100100100 ;
unsigned long ZES   = 0b00000000000000000000000100000100 ;
unsigned long ZEVEN = 0b00000000000000000000000111110000 ;
unsigned long ACHT  = 0b00000000000000000000000100000000 ;
unsigned long NEGEN = 0b00000000000000000000000100100000 ;
unsigned long DP    = 0b00000000000000000000000011111110 ;

unsigned long Getal[11] =
{        NUL,
         EEN,
         TWEE,
         DRIE,
         VIER,
         VIJF,
         ZES,
         ZEVEN,
         ACHT,
         NEGEN,
         DP        };
         
         

void setup()
{
   for( Tel = 33; Tel < 41 ; Tel++ )
      pinMode( Tel, OUTPUT );              // Pff.. Arduino stuff...
   pinMode( 2, OUTPUT );
   REG_PIOC_OWER = 0x000001FE;             // Modify these bits...
   REG_PIOC_OWDR = 0xFFFFFE01;             // Mask it..
   analogWrite( 2, PLUS );
}

void loop()
{
   for( Tel = 0; Tel < 11 ; Tel++ ){
      REG_PIOC_ODSR = Getal[ Tel ];        // 32...Well,8 bits in no time... BAM.. How fast you want it...
      delay( 1000 ); }                     // Not elegant, but once a second. Just basic/ demo.
 
}
Logged

The Netherlands
Offline Offline
Full Member
***
Karma: 1
Posts: 143
MKDS hacker and Programmer
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good work.

Ps. I am dutch too. But when programming I always use english. Dunno why smiley-wink
Logged

Subscribe my youtube channel: http://www.youtube.com/user/MKDS3

Pages: [1]   Go Up
Jump to: