MODMAX7456

MODMAX7456 is an easy to use library that allows you to create a text overlay system on a PAL or NTSC video display.

Connecting up the MAX7456 chip

The MODMAX7456 library only requires you to connect the SPI signals MOSI, MISO abd SCLK to one of the two SPI interfaces on the MBED. Additionally, you also need to connect CS (chip select), RESET and the Vertical Sync signals from the MAX7456 to Mbed pins. CS and RESET need to connect to Mbed pins that can be DigitalOut types and the Vertical Sync must connect to an Mbed that supports InterruptIn.

Connecting the MAX7456

Using the MODMAX7456 library

First, import the library into the online compiler.

Import libraryMODMAX7456

This module provides a simple API to the Maxim MAX7456 on-screen display chip

Once imported, change your projects main.cpp to:-

#define COMPILE_EXAMPLE_CODE_MODOSD7456
#define PCBAUD 115200
#define MAX7456_MOSI  p5
#define MAX7456_MISO  p6
#define MAX7456_SCLK  p7
#define MAX7456_CS    p8
#define MAX7456_RST   p20
#define MAX7456_VSYNC p15
#include "/MODMAX7456/example1.cpp"

The above uses Mbed pins used in initial testing. If you have connected up your MAX7456 device to different pins ensure you change the #defines to match the pins you used.

Now switch everything on. LED1 should begin slowly flashing. This just tells you that the example program is running. Assuming you have connected up video in and out of your MAX7456 device your display should now be showing some test messages.

Using the MOD7456 library

Before attempting to use the MAX7456 you should become familiar with the device datasheet. But before diving into that the library offers an "easy to use/getting started" class wrapper called OSD7456 (where OSD means On Screen Display). The example1.cpp program uses this as it's test. Here is example1.cpp to show how easy it is to get started:-

#include "mbed.h"
#include "OSD7456.h"

DigitalOut led1(LED1);

OSD7456 *osd;

int main() {
    
    osd = new OSD7456(MAX7456_MOSI, MAX7456_MISO, MAX7456_SCLK, MAX7456_CS, MAX7456_RST, MAX7456_VSYNC);
    
    // Set the character "local background" to 42%
    osd->max7456->backGround(MAX7456::Percent_42);
    
    // Set the blink rate to 133ms with a duty cycle of 3:1
    osd->max7456->blinkRate(MAX7456::ms_133, MAX7456::BT3_BT);
    
    osd->print(1, "        Hello World");
    osd->print(7, 4,  "Positioned text");
    osd->print(7, 6,  "Positioned text", MAX7456::LocalBG);
    osd->print(3, 8,  "Positioned text blinks", MAX7456::Blink | MAX7456::LocalBG);
    osd->print(4, 10, " Blinks and inverse ", MAX7456::Blink | MAX7456::LocalBG | MAX7456::Inverse);
    
    while(1) {
        led1 = 1;
        wait(0.5);        
        led1 = 0;
        wait(0.5);    
    }
}

The OSD7456 API can be found here.

The full MAX7456 API can be found here.