Go Down

Topic: Fastest single 7 segment display driver (Read 486 times) previous topic - next topic

MarXoft

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.
 
}

Gericom

Good work.

Ps. I am dutch too. But when programming I always use english. Dunno why ;)
Subscribe my youtube channel: http://www.youtube.com/user/MKDS3

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy