Sure Electronics AVRDEM2 board code

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

I've posted a project giving example code for all the goodies on a Sure Electronics AVRDEM 2 board (about $26, shipping paid, if you watch eBay).

That includes a USART, switches, LEDs, speaker, 7 segment LED display, LCD, and interrupt driven TWI interface to an LM75 temperature sensor and external EEPROM. I also threw in some virtual timer support (up to 10, 0.01 second resolution, more or less) for good measure. The board uses USB and has a 12 MHz ATmega 16 and seems to be well made even with a couple of design shortcomings.

There's a 12 page pdf which has a discussion of the board and code, plus all the source code. The code is split out into separate source files by peripheral and is well commented. It's ImageCraft C but should be easy to port.

Any comments or suggestions are welcome and appreciated - this is the place to deposit them. Since it's demo code I realize there are better ways to do some of the things, but I'm always up for learning new tricks.

[Chuck - hope you don't mind - I added a picture as I thought others, like me, would like to know what this board looks like - Cliff]

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

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

Thanks, Cliff - I appreciate that. I've been looking at the thing so long I have nightmares about it, so I didn't think of anyone else not knowing what it looked like.

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

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

I was having issues driving the 7 segment led before looking at your code i just assumed that you select the LED you want to control and send the data but doing this the bottom cathode (D) doesnt come on. so i loaded your code on my board and it worked so opened an old micro book it seems you muat select the LED position you want to keep first by latching them, then sending the display data last selecting with LEDs so upload the change to is this correct?

if the above is correct these seems to be a commenting issue in your code else i dont understand how are you controlling 4 segments independently if you are clearing all segments on every interrupt?

      PORTA &= 0x0f;                    // turn all segs off
      PORTB = oval;                     // set up the output bits
      PORTA |= msk;                     // select our digit
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have no opinion on what gets done first - are you sure your book doesn't have another IC (selector/multiplexer/whatever) between the display and the MCU?

Anyway, as I recall one portb bit is common to all the segments for a single display, and one porta bit is common to the same segment across all 4 displays. I turn all the porta bits off first because I don't want the bleed through as I switch digits. If I don't blank the digit, it will show up (very briefly) in the new position I'm switching to. I then OR the segments back on for the newly selected digit.

I don't know if this answers your question or not. Please ask more if it doesn't.

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

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

where did you get the datasheet for the 7 segment display that are on this board?

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

I don't remember that I did get one. I think I just looked at how their (Sure) sample code used it, and how it was wired (the schematic). Although I doubt there's much difference (other than the obvious one of what's common) in 7 segment displays.

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