void setup()
{
volatile char *dirf, *dirl;
Serial.begin(9600);
volatile char *outf, *outl;
dirf = 0x30; // Port direction register for columns
dirl = 0x10A; // Port direction register for rows
outf = 0x31; // Port output register for columns
outl = 0x10B; // Port output register for rows
*dirf = 0xFF; // Set all column pins as output
*dirl = 0xFF; // Set all row pins as output
// Character bit patterns for scrolling (7 rows, 24 columns of data)
volatile unsigned char arrf[7][24] = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xff, 0xe7, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x3f, 0x60, 0x60, 0x60, 0x60, 0x3f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x7e, 0xc3, 0xdb, 0xdb, 0xc3, 0x7e, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xc3, 0xe7, 0xff, 0xdb, 0xc3, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
};
// Row selection bits
volatile char arrl[8] = {0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe};
// Main loop for scrolling display
while (1)
{
volatile int i, r, colShift;
volatile long j, c;
c = 50; // Delay counter for scrolling
// Loop through each row of character data
for (r = 0; r < 7; r++)
{
// Shift through 24 columns to simulate scrolling
for (colShift = 0; colShift < 16; colShift++) // Adjust scroll length (16 fits well)
{
// Set delay to control speed of scrolling
while (c-- > 0)
{
// Display each row, one row at a time
for (i = 0; i < 8; i++) // Row selection (8 rows total)
{
*outl = arrl[7-i]; // Activate the row
*outf = arrf[r][23 - i - colShift]; // Output shifted column data for scrolling
// Short delay for each refresh cycle
for (j = 0; j < 1000; j++); // Small delay
*outf = 0x00; // Clear output
*outl = 0xFF; // Reset rows
}
}
c = 50; // Reset scroll delay after each full column shift
}
}
}
}
void loop() {}