Hello, I managed to add a 7 segment display to MMC2IEC, with minimal hardware modification and a little bit of code. Its purpose is to show the currently mounted disk image when a swaplist is active (in HEX). I used the following part (common anode type):
http://www.digchip.com/datasheets/parts/…/ELS-432EWA.php
I modified the hardware variant nr. 2 this way:
- Busy & Dirty LEDs moved to PD4/PD3
- No Debug LED
- Next & Prev buttons moved to PB0/PB1
Then I connected the display:
- Pin 3 to +5V
- Pin 10 (segment A) to PC0 through a 560 Ohm resistor
- Pin 9 (segment B) to PC1 through a 560 Ohm resistor
- Pin 7 (segment C) to PC2 through a 560 Ohm resistor
- Pin 5 (segment D) to PC3 through a 560 Ohm resistor
- Pin 4 (segment E) to PC4 through a 560 Ohm resistor
- Pin 2 (segment F) to PC5 through a 560 Ohm resistor
- Pin 1 (segment G) to PC6 through a 560 Ohm resistor
I took the source version 0.6.6.
This is the code I added to main.c (I put it before "BUSY_LED_SETDDR();"):
|
Source code
|
1
2
3
4
|
// Set all PORTC pins as outputs
DDRC = 0xFF;
// Turn off all the segments
PORTC = 0xFF;
|
All the remaining code changes were made to diskchange.h.
I put this declaration at the beginning:
|
Source code
|
1
2
3
4
5
|
// the code for the digit '0' was put at the end, to show
// the number '1' when the first disk is mounted
const unsigned char c[] = {0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,
0x10,0x08,0x03,0x46,0x21,0x06,0x0E,0x40};
|
Then, everywhere I found something like this:
|
Source code
|
1
2
|
if (mount_line())
confirm_blink(BLINK_something);
|
i changed it this way:
|
Source code
|
1
2
3
4
|
if (mount_line()) {
confirm_blink(BLINK_something);
PORTC = c[linenum%16];
}
|
That code appears 4 times. The reason why I used the modulus is to simulate the presence of another display for a virtual extra HEX digit and most of all, to avoid the risk of going outside the array boundaries.
Important: remember to disable JTAG in the fuse settings if you're going to do this modification.
That's it. It seems to work quite well, although I haven't extensively tested it yet. If you find it of any use, you may want to add it to the official sources (Unseen?).
I take no responsibility whatsoever if someone tries doing it and destroys hardware or data!!