slg 2016 – [protofusion] http://protofusion.org/wordpress Open Hardware and Software Sun, 21 Nov 2010 04:53:07 +0000 en-US hourly 1 https://wordpress.org/?v=5.6.13 11753368 The OSRAM SLG2016 and AVR http://protofusion.org/wordpress/2010/10/the-osram-slg2016-and-avr/ http://protofusion.org/wordpress/2010/10/the-osram-slg2016-and-avr/#comments Sun, 17 Oct 2010 21:33:39 +0000 http://protofusion.org/wordpress/?p=531 ]]>

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--;
  }
}
]]>
http://protofusion.org/wordpress/2010/10/the-osram-slg2016-and-avr/feed/ 2 531