sda5708: NEW DEVICE Siemens SDA5708 8 character 7x5 dot matrix LED display (nw)

This commit is contained in:
Joakim Larsson Edstrom 2017-07-17 13:45:16 +02:00
parent f99b7a0e14
commit 4ae48e9865
5 changed files with 313 additions and 0 deletions

View File

@ -706,6 +706,17 @@ if (VIDEOS["SCN2674"]~=null) then
} }
end end
--------------------------------------------------
--
--@src/devices/video/sda5708.h,VIDEOS["SDA5708"] = true
--------------------------------------------------
if (VIDEOS["SDA5708"]~=null) then
files {
MAME_DIR .. "src/devices/video/sda5708.cpp",
MAME_DIR .. "src/devices/video/sda5708.h",
}
end
-------------------------------------------------- --------------------------------------------------
-- --
--@src/devices/video/snes_ppu.h,VIDEOS["SNES_PPU"] = true --@src/devices/video/snes_ppu.h,VIDEOS["SNES_PPU"] = true

View File

@ -323,6 +323,7 @@ VIDEOS["PSX"] = true
VIDEOS["RAMDAC"] = true VIDEOS["RAMDAC"] = true
--VIDEOS["S2636"] = true --VIDEOS["S2636"] = true
VIDEOS["SAA5050"] = true VIDEOS["SAA5050"] = true
--VIDEOS["SDA5708"] = true
VIDEOS["SCN2674"] = true VIDEOS["SCN2674"] = true
--VIDEOS["SED1200"] = true --VIDEOS["SED1200"] = true
--VIDEOS["SED1330"] = true --VIDEOS["SED1330"] = true

View File

@ -327,6 +327,7 @@ VIDEOS["PSX"] = true
VIDEOS["RAMDAC"] = true VIDEOS["RAMDAC"] = true
VIDEOS["S2636"] = true VIDEOS["S2636"] = true
VIDEOS["SAA5050"] = true VIDEOS["SAA5050"] = true
VIDEOS["SDA5708"] = true
VIDEOS["SED1200"] = true VIDEOS["SED1200"] = true
VIDEOS["SED1330"] = true VIDEOS["SED1330"] = true
VIDEOS["SED1520"] = true VIDEOS["SED1520"] = true

View File

@ -0,0 +1,180 @@
// license:BSD-3-Clause
// copyright-holders:Joakim Larsson Edstrom
/**********************************************************************
Siemens SDA5708 8 character 7x5 dot matrix LED display
**********************************************************************/
#include "emu.h"
#include "sda5708.h"
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
//#define LOG_GENERAL (1U << 0) // Already defined in logmacro.h
#define LOG_SETUP (1U << 1)
#define LOG_CMD (1U << 2)
#define LOG_DATA (1U << 3)
//#define VERBOSE (LOG_DATA|LOG_SETUP|LOG_CMD|LOG_GENERAL)
//#define LOG_OUTPUT_FUNC printf
#include "logmacro.h"
//#define LOG(...) LOGMASKED(LOG_GENERAL, __VA_ARGS__) // Already defined in logmacro.h
#define LOGSETUP(...) LOGMASKED(LOG_SETUP, __VA_ARGS__)
#define LOGCMD(...) LOGMASKED(LOG_CMD, __VA_ARGS__)
#define LOGDATA(...) LOGMASKED(LOG_DATA, __VA_ARGS__)
#ifdef _MSC_VER
#define FUNCNAME __func__
#define LLFORMAT "%I64d"
#else
#define FUNCNAME __PRETTY_FUNCTION__
#define LLFORMAT "%lld"
#endif
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
// device type definition
//const device_type SDA5708 = &device_creator<sda5708_device>;
DEFINE_DEVICE_TYPE(SDA5708, sda5708_device, "sda5708", "SDA5708")
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// sda5708_device - constructor
//-------------------------------------------------
sda5708_device::sda5708_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, SDA5708, tag, owner, clock)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void sda5708_device::device_start()
{
LOG("%s\n", FUNCNAME);
// register for state saving
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void sda5708_device::device_reset()
{
LOG("%s\n", FUNCNAME);
}
//-------------------------------------------------
// load_w - load signal
//
// The Load pin is an active low input used to enable data transfer into the display.
// When Load is low, data is clocked into the 8 bit serial data register. When Load goes
// high, the contents of the 8 bit serial data register are evaluated by the display controller.
// While Load remains high the Data and SDCLK pins may be used to control other serial devices
// on the same bus.
//-------------------------------------------------
WRITE_LINE_MEMBER( sda5708_device::load_w )
{
LOG("%s - line %s\n", FUNCNAME, state == ASSERT_LINE ? "asserted" : "cleared");
if (m_load != state && m_reset == CLEAR_LINE && state == CLEAR_LINE)
{
switch (m_serial & SDA5708_REG_MASK)
{
case SDA5708_CNTR_COMMAND:
LOGCMD("- Control command: %0x02\n", m_serial & 0x1f);
break;
case SDA5708_CLEAR_COMMAND:
LOGCMD("- Display cleared\n");
memset(m_dispmem, 0x00, sizeof(m_dispmem));
break;
case SDA5708_ADDR_COMMAND:
LOGCMD("- Address command: %02x\n", m_serial & 0x1f);
m_digit = m_serial & 7;
m_cdp = 0;
break;
case SDA5708_DATA_COMMAND:
LOGCMD("- Data command: %02x\n", m_serial & 0x1f);
LOGDATA("- SDA5708 data: %c%c%c%c%c\n",
(m_serial & 0x10) ? 'x' : ' ',
(m_serial & 0x08) ? 'x' : ' ',
(m_serial & 0x04) ? 'x' : ' ',
(m_serial & 0x02) ? 'x' : ' ',
(m_serial & 0x01) ? 'x' : ' ' );
m_dispmem[m_digit * 7 + m_cdp] = m_serial;
m_cdp = (m_cdp + 1) % 7;
break;
default:
LOGCMD("- Unknown command:%02x\n", m_serial);
break;
}
}
m_load = state;
}
//-------------------------------------------------
// data_w - data line
//
// The Data pin holds the bits to be clocked into the serial data register whenever the SDCLK
// line goes high. The least significant bit D0 is loaded first.
//-------------------------------------------------
WRITE_LINE_MEMBER( sda5708_device::data_w )
{
LOG("%s - line %s\n", FUNCNAME, state == ASSERT_LINE ? "asserted" : "cleared");
m_data = state;
}
//-------------------------------------------------
// sdclk_w - serial data clock
//
// SDCLK is the serial clock line. Data is accepted by the display's serial data register when the SDCLK line
// goes high. The Load pin must be low for the serial data register to accept any data. The minimum clock period is
// 200ns. Setup time, the time between a stable Data line and a rising SDCLK signal, should be a minimum of 50ns.
//-------------------------------------------------
WRITE_LINE_MEMBER( sda5708_device::sdclk_w )
{
LOG("%s - line %s\n", FUNCNAME, state == ASSERT_LINE ? "asserted" : "cleared");
if ( m_sdclk != state && m_reset == CLEAR_LINE && m_load == ASSERT_LINE && state == ASSERT_LINE)
{
m_serial = (((m_serial >> 1) & 0x7f) | (m_data == ASSERT_LINE ? 0x80 : 0));
}
m_sdclk = state;
}
//-------------------------------------------------
// reset_w - chip reset
//
// When the Reset pin is held low, the display will be reset. The multiplex counter, the address register,
// the control word and the display bit patterns are all cleared. This means that the display will be
// blank and the display is set to 100% brightness and maximum peak current.
// During normal operation the Reset pin is only made low for a short period when power is applied to
// the circuit and is left at high level from then on.
//-------------------------------------------------
WRITE_LINE_MEMBER( sda5708_device::reset_w )
{
LOG("%s - line %s\n", FUNCNAME, state == ASSERT_LINE ? "asserted" : "cleared");
m_reset = state;
}

120
src/devices/video/sda5708.h Normal file
View File

@ -0,0 +1,120 @@
// license:BSD-3-Clause
// copyright-holders:Joakim Larsson Edstrom
/**********************************************************************
Siemens SDA5708 8 character 7x5 dot matrix LED display
**********************************************************************/
#ifndef MAME_VIDEO_SDA5708_H
#define MAME_VIDEO_SDA5708_H
#pragma once
/* Misc info
* ---------
* http://www.sbprojects.com/knowledge/footprints/sda5708/index.php
* http://arduinotehniq.blogspot.se/2015/07/sda5708-display-8-character-7x5-dot.html
*
* Display front - LEDs
* --------------------
* xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx
* xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx
* xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx
* xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx
* xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx
* xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx
* xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx
* Dig0 Dig1 Dig2 Dig3 Dig4 Dig5 Dig6 Dig7
*
* Display rear - Pinout
* ---------------------
* +--------------------------------------------------------+
* | O O |
* | +----------------------------------------------+ |
* | | o o o o o o | |
* | | Pin:6 5 4 3 2 1 | |
* | | | |
* | +----------------------------------------------+ |
* +--------------------------------------------------------+
* 6:GND 5:_RESET 4:SDCLK 3:Data 2:_Load 1:Vcc
*
*/
///*************************************************************************
// INTERFACE CONFIGURATION MACROS
///*************************************************************************
#define MCFG_SDA5708_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, SDA5708, 0)
///*************************************************************************
// TYPE DEFINITIONS
///*************************************************************************
// ======================> sda5708_device
class sda5708_device : public device_t
{
public:
// construction/destruction
sda5708_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_WRITE_LINE_MEMBER( load_w );
DECLARE_WRITE_LINE_MEMBER( data_w );
DECLARE_WRITE_LINE_MEMBER( sdclk_w );
DECLARE_WRITE_LINE_MEMBER( reset_w );
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
private:
enum {
SDA5708_REG_MASK = 0xE0,
SDA5708_CNTR_COMMAND = 0xE0,
SDA5708_CNTR_BRIGHT_MAS= 0x1F,
SDA5708_CNTR_BRIGHT_100= 0x00,
SDA5708_CNTR_BRIGHT_53 = 0x01,
SDA5708_CNTR_BRIGHT_40 = 0x02,
SDA5708_CNTR_BRIGHT_27 = 0x03,
SDA5708_CNTR_BRIGHT_20 = 0x04,
SDA5708_CNTR_BRIGHT_13 = 0x05,
SDA5708_CNTR_BRIGHT_6_6= 0x06,
SDA5708_CNTR_BRIGHT_0 = 0x07,
SDA5708_CNTR_PKCUR_12_5= 0x08,
SDA5708_CLEAR_COMMAND = 0xC0,
SDA5708_ADDR_COMMAND = 0xA0,
SDA5708_ADDR_LED_MASK = 0x07,
SDA5708_ADDR_LED0 = 0x00,
SDA5708_ADDR_LED1 = 0x01,
SDA5708_ADDR_LED2 = 0x02,
SDA5708_ADDR_LED3 = 0x03,
SDA5708_ADDR_LED4 = 0x04,
SDA5708_ADDR_LED5 = 0x05,
SDA5708_ADDR_LED6 = 0x06,
SDA5708_ADDR_LED7 = 0x07,
SDA5708_DATA_COMMAND = 0x00
};
uint8_t m_serial;
uint8_t m_load;
uint8_t m_reset;
uint8_t m_data;
uint8_t m_sdclk;
uint8_t m_dispmem[7 * 8];
uint8_t m_cdp;
uint8_t m_digit;
};
// device type definition
extern const device_type SDA5708;
#endif // MAME_VIDEO_SDA5708_H