First post, by Karmeck
So my idea is to use the orginal lcd, in my case, from a Roland sc-50 (rcm2024t) with either Nuked-SC55 or 88emu.
A while ago I saw that Nuked-SC55 was downsized to work on raspberry pi 4.
My plan right now, befor I buy a pi, I'd to use a Arduino Nano with pins (one of then 5v, I'm told that is needed) and connect the orginal lcd, named rcm2024t, to the Arduino. Once that is up and running, my hope is, using the working code with an actual raspberry pi should be easy.
Now, I see that the code for the lcd is different, in realty I'm unsure what file needs to be modified to have the code ment for the emulated lcd, to be sent to the Arduino Nano and from there sent to the orginal lcd.
Currently only guessing with help of Gemini.
If anyone wanna chip in, this is the thread to do it.
Here is the current edits to this file https://github.com/dsp56300/gearmulator/blob/ … ds/sc880Lcd.cpp
I don't even know if it's the right file to edit. Did not have time to test it befor leaving for work.
Also, Nuked-SC55 seem to emulate the screen in a difrent way. Don't know what file to edit there.
I'm yet to receive my Roland sc-50.
#include "88lib/boards/sc880Lcd.h" #include <windows.h> #include <iostream> […]
#include "88lib/boards/sc880Lcd.h"
#include <windows.h>
#include <iostream>namespace emu88Lib {
namespace
{
// Where each segment of a digit sits in a nibble: {line, bit} for a digit in the high nibble
// of its byte; a digit in the low nibble uses the bits four lower. Taken from the firmware's
// digit tables at 11:0EBC and 11:0EE4, and the only wiring that gives the standard shape for
// all ten digits. The eighth bit, line 1 bit 4, is cleared by every digit write; it is
// taken as the decimal point.
struct SegmentBit { uint8_t line; uint8_t bit; };
constexpr SegmentBit g_segmentBits[8] = {
{0, 7}, // a
{0, 4}, // b
{0, 5}, // c
{1, 5}, // d
{1, 6}, // e
{1, 7}, // f
{0, 6}, // g
{1, 4}, // point
};
// The 25 digits, left to right, as the byte column and nibble that drives them (shift 0 = high
// nibble, 4 = low, 0xff = never driven by the firmware). The part display A, 0, 1 is slots 2-4
// with two dark digits before it. The seven mode "o" digits are the nibbles the firmware lights
// for the lamps, one under each printed label, three digits apart and ending on the 25th; the
// slots in between are not known to carry anything. Checked against a photograph with every
// digit's segment marked.
struct DigitNibble { uint8_t column; uint8_t shift; };
constexpr DigitNibble g_digits[Sc880Lcd::StripDigits] = {
{1, 0}, {1, 4},
{2, 0}, {2, 4}, {3, 0}, // part: group letter, tens, ones
{4, 4}, {5, 0}, {5, 4}, // PERF
{6, 0}, {6, 4}, {7, 0}, // PATCH
{8, 4}, {9, 0}, {8, 0}, // TONE
{10, 0}, {10, 4}, {11, 0}, // RHY
{12, 4}, {13, 0}, {13, 4}, // M-FX
{14, 0}, {14, 4}, {15, 0}, // SYS
{15, 4}, {16, 0}, // UTIL
};// ---------------------------------------------------------
// ARDUINO SERIAL BRIDGE GLOBALS
// ---------------------------------------------------------
HANDLE hComm = INVALID_HANDLE_VALUE;
bool serial_initialized = false;void init_arduino_serial() {
if (serial_initialized) return;
// VIKTIGT: Kontrollera att COM3 är rätt port för din Arduino!
hComm = CreateFileA("\\\\.\\COM3", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hComm != INVALID_HANDLE_VALUE) {
DCB dcbSerialParams = {0};
dcbSerialParams.DCBlength = sizeof(dcbSerialParams);
GetCommState(hComm, &dcbSerialParams);
dcbSerialParams.BaudRate = CBR_115200;
dcbSerialParams.ByteSize = 8;
dcbSerialParams.StopBits = ONESTOPBIT;
dcbSerialParams.Parity = NOPARITY;
SetCommState(hComm, &dcbSerialParams);
std::cout << "Arduino Bridge: Ansluten på COM-porten." << std::endl;
serial_initialized = true;
} else {
std::cerr << "Arduino Bridge VARNING: Kunde inte ansluta till Arduinon." << std::endl;
}
}void send_to_arduino(uint8_t rs, uint8_t lcd_data) {
if (hComm != INVALID_HANDLE_VALUE) {
uint8_t buffer[2];
buffer[0] = rs;
buffer[1] = lcd_data;
DWORD bytesWritten;
WriteFile(hComm, buffer, 2, &bytesWritten, NULL);
}
}
// ---------------------------------------------------------
}void Sc880Lcd::reset()
{
// Starta upp COM-porten när LCD:n initieras
init_arduino_serial();m_ram.fill(0);
m_column = 0;
m_line = 0;
m_contrast = 0;
m_initialised = false;
}void Sc880Lcd::writeInstruction(const uint8_t _instr)
{
m_initialised = true;
if(_instr >= 0xe0)
m_contrast = _instr & 0x1f;
else if(_instr >= 0x80)
m_line = _instr & 0x3f;
else if(_instr >= 0x20 && _instr < 0x40)
m_column = _instr & 0x1f;// Skicka instruktionen (Kommando, RS = 0) till Arduinon
send_to_arduino(0, _instr);
}void Sc880Lcd::writeData(const uint8_t _data)
{
m_ram[m_line * Columns + m_column] = _data;
m_line = (m_line + 1) & (Lines - 1);// Skicka datan (Data, RS = 1) till Arduinon
send_to_arduino(1, _data);
}void Sc880Lcd::renderMono(std::vector<uint8_t>& _output, std::array<uint8_t, 25>& _dseg) const
{
_output.assign(Width * Height, 0);
for(uint32_t y = 0; y < Height; ++y)
{
for(uint32_t x = 0; x < Width; ++x)
_output[y * Width + x] = (m_ram[(y + 2) * Columns + x / 8] >> (7 - x % 😎) & 1;
}
for(uint32_t i = 0; i < Sc880Lcd::StripDigits; ++i)
{
const auto& digit = g_digits;
if(digit.shift == 0xff)
continue;
uint8_t segments = 0;
for(uint32_t s = 0; s < 8; ++s)
{
const auto [line, bit] = g_segmentBits;
if(stripBit(line, digit.column, bit - digit.shift))
segments |= static_cast<uint8_t>(1u << s);
}
_dseg = segments;
}
}
}
After this is done, I think it could be possible to do this all in reverse, to use original hardware with an oled display. To have a raspberry pi zero just emulate the lcd with data sent from original hardware. That would need even more coding though.