Looks like I found an easier solution: https://cdn-shop.adafruit.com/datasheets/sn74lvc245a.pdf
EDIT: Maybe this is where the problem is -- that people are not understanding the word 'emulator.'
I am writing an emulator for the HARDWARE of a 6502 based machine. This emulator runs 6502 software that talks to the hardware in a very specific way. For matters of this discussion, the 6502 software handles multiplexing the LEDs on its own. I can't change that. My emulator needs to behave as much like the original hardware as possible.
The original machine multiplexed the LEDs via its data ports. Right now, I'm intercepting that and turning it a MAX-compatible output. The MAX doesn't like having its LEDs externally multiplexed so I need to drive the LEDs directly off the Due's pins.
But the Due is a low-current device that can't drive a 7-segment display.
The rest of the original post continues.
(Post edited -- I should not post when I am this tired. A form of dyslexia slipped in and I typed the wrong phrase a couple of times.)
I am trying to connect a six digit, seven segment display up to a project running on the Due. (To be more accurate, I am hooking up a 4 digit and 2 digit display, creating my own six digit -- but I know how to handle that part.)
The parts in question are
- 2 Bit 0.56" Anode
- 4 Bit 0.56" Anode
I am making a KIM-1 emulator -- a heavy expansion of the KIM-1 emulator that already exists but emulating as much of the hardware as possible and not shimming the ROM drivers.
Currently I am using a MAX7219 device as part of my proof of concept. The MAX device in use.
The KIM-1 handles multiplexing the LED by port manipulation. I am creating a virtual software port and sending the correct commands to change the LEDs. However, using SPI is slow enough that there is a visual flicker on the LEDs.
This is NOT the result of my emulation, as even native Arduino code flickers when manually multiplexing the LEDs. (I can provide a demo sketch if needed.)
Driving the LEDs directly seems to be the best solution, but the Due cannot handle as much power through its pins as the Uno can.
According to this URL, the max power I can draw from any pin is 15 milliamps, while the max sink is around 9 mils.
- Does anyone have experience hooking up a 7-segment display?
- What is the current draw of these displays? (Currently using a generic Chinese import.)
- Could I run the pins through a level shifter? For those who inquired what a level shifter is: Adafruit Level Shifter. I couldn't find any specs on how much current the level shifters could carry.
- Should I take this question to the electronics page and ask about switching transistors?
Since everyone keeps recommending I stay with the MAX driver, I am including my demo that shows the SPI transfer rates add unwanted flicker.
Again -- the system that I am coding already multiplexes the LEDs itself. I am looking for information on how to directly drive the LEDs from the Due ports given the very limited current output of the Due.
#include <stdio.h>
#include <SPI.h>
#include "LedControl.h"
#include <SPI.h>
#include "bitBangedSPI.h"
#include "MAX7219.h"
// Changing the displayspeed to zero (or removing the delay) gets even stranger.
#define delayspeed 1
#define LED_CS 15
MAX7219 display(1, LED_CS);
/* This code emulates the behavior of the hardward that I am emulating by manually multiplexing the
* LEDS.
*
* The flicker is VERY visible.
*/
void setup() {
display.begin();
display.setIntensity(15);
#define FF(x) \
{ \
display.sendChar(x, '0' + x); \
delay(delayspeed); \
display.sendChar(x, ' '); \
}
while(true )
{
FF(7);
FF(6);
FF(5);
FF(4);
FF(3);
FF(2);
FF(1);
FF(0);
}
}
void loop() {
}
slowmax.zip (6.62 KB)
