[Just fun] I found a 5x7 display this morning.

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I had bought these 5x7 LED displays from a surplus store at pennies each but had never done anything with them.

This morning I realized they could look like 1960's futuristic computer display panels if I coded it using stroboscopic effects. Should be easy on a Teensy.

This is the result experiment video, trying to find values that look cool:

http://www.youtube.com/watch?v=BP6m3avqpkU

I'm having entirely too much fun with these doodads. :)

Code isn't very interesting, but if you're curious:

#include 
#include 
#include 
#include 
#include "analog.h"

#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))

static uint8_t aref = (1<<REFS0); // default to AREF = Vcc

ISR(TIMER1_COMPA_vect) {
  PORTB=(PINB<<1)|((PINB&64)>>6);
}

int16_t adc_read(uint8_t mux) {
    uint8_t low;
    ADCSRA = (1<<ADEN) | ADC_PRESCALER;
    ADCSRB = (1<<ADHSM) | (mux & 0x20);
    ADMUX = aref | (mux & 0x1F);
    ADCSRA = (1<<ADEN) | ADC_PRESCALER | (1<<ADSC);
    while (ADCSRA & (1<<ADSC)) ;
    low = ADCL;
    return (ADCH << 8) | low;
}

int main(void) {
  uint16_t tim;
  cli();
  CPU_PRESCALE(1);    // 8Mhz.
  DDRB|=127;          // We use 7 pins from PB.
  DDRD|=255;          // PD all out.
  PORTB=254;          // One zero and...
  PORTD=1;            // One one makes a single LED light up.
  TCCR1A=0;           // Timer 1 normal mode.
  TCCR1B|=((1<<WGM12)|(1 << CS10) | (1 << CS11)); // fcpu/64, CTC.
  OCR1A=510;          // Some stroboscopic value.
  TIMSK1|=(1<<OCIE1A);// Enable compare interrupt channel A timer1.
  sei();              //  Enable interrupts.
  while (1) {
    if(PIND&128) {
      PORTD=1;  // 128= Last bit, so we cycle back to first.
    } else {
      PORTD=((PIND&1)<<1)|((PIND&2)<<1)|((PIND&4)<<1)|((PIND&8)<<4);
    }
    tim=adc_read(0)<<1;
    _delay_us(tim+64);
  }
}

odokemono. I try to entice electrons to do my bidding.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Cool! Looks like my first embedded project ever, a college project on an 8x8 matrix using one of the 6800's. Mine wasn't quite as fancy-flashy, though! Do you do Blinkenlights displays as well?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Very cute. Now you can get yourself some of the 8x32 grids from Sure Electronics (eBay, $10 & free shipping if you're careful - search for 0832) and go whole hog. They can be stacked in any arrangement to any size.

Chuck Baird

"I wish I were dumber so I could be more certain about my opinions. It looks fun." -- Scott Adams

http://www.cbaird.org