The OSRAM SLG2016 and AVR

I happened to scavenge a couple of SLG2016’s from some old workstation debug displays. After finally locating a datasheet, I realized that they used the standard ASCII charset, so they are extremely easy to drive. Note: The SLG2016 differs from the SLR2016, SLO2016, and SLY2016 only by LED color.

The only downside to these displays is that they use quite a few pins (7 data lines, 2 digit select lines, write line, and optional blanking line). For now, I’m driving the display with all pins in parallel on a tiny88 which has plenty of pins; however I plan on using a shift register to cut down on data bus pin usage in the future. The displays only need the data lines to be held stable during a write cycle, making shift registers well-suited to this task.

To flash the attiny88, I’m using a Bus Pirate (pictured above) flashed with the STK500v2 emulation firmware. This allows me to use avr-gcc with AVR Studio to program the chip.

Here is some code I used to test the displays, using PORTD for data lines, and the 2 LSB’s of PORTC for digit select lines. This is the first time I’ve worked with AVRs outside of the Arduino environment, so pardon any flagrant errors and drop me a comment if you have any suggestions.

#define F_CPU 1000000UL

#include <avr/io.h>
#include <util/delay.h>
#include <string.h>
#include <stdlib.h>

void wr();
void wrChar(char toWrite, int dig);
void wrWord(char *word);
void scrollWord(char *word);
void delay_ms(uint16_t ms);

int main (void){
  DDRC=0xFF;
  DDRD=0xFF;
  PORTD=0x00;
  PORTC=0x00;

  // Loop through a few strings for testing
  while(1){
    wrWord("Helo");
    delay_ms(500);
    wrWord("*?%$");
    delay_ms(500);
  }
}

// Toggle write pin (PC0)
void wr() {
  PORTD &= ~(1<<7);
  delay_ms(1);
  PORTD |= (1<<7);
}

// Write char to position
void wrChar(char toWrite, int pos){
  PORTC = pos;  // Set digit select lines
  PORTD = toWrite;  // Set data lines
  wr();  // Toggle write pin
}

// Write 4-char word
void wrWord(char *word){
  for(int i=3; i>=0; i--){
    wrChar(word[i], 3-i);
  }
}

// Generic delay function
void delay_ms(uint16_t ms) {
  while (ms) {
    _delay_ms(1);
    ms--;
  }
}

Ethan is a computer engineer and open source hardware/software developer from Michigan. He enjoys AVR and linux development, photography, mountain biking, and drinking significant amounts of home-roasted coffee. Find out more at ethanzonca.com.

Tagged with: , , , , ,
Posted in AVR
2 comments on “The OSRAM SLG2016 and AVR
  1. exapod says:

    What a luck you have, i need one of this display but they are not cheap!! On mouser one of this little thing costs: 22 euro..

Leave a Reply to exapod Cancel reply

Your email address will not be published. Required fields are marked *

*