fpga4fun.com - where FPGAs are fun.
Home
Welcome
Information


FPGA projects
Music box
Pong game
R/C servos
Text LCD module
Quadrature decoder
PWM and one-bit DAC
Debouncer
LED displays
Crossing clock domains
External contributions

FPGA interface projects
RS-232
JTAG
I2C
EPP
SPI
CNC steppers

FPGA advanced projects
Graphic LCD panel
Digital oscilloscope
10BASE-T interface
PCI interface
Spoc CPU core

Hands-on
A simple oscilloscope


FPGA introduction
What are FPGAs?
How FPGAs work
FPGA pins
Clocks and global lines
Download cables
Configuration
Learn more

FPGA software
Design software
Pin assignment
Design-entry/HDL
Simulation/HDL
Synthesis and P&R

FPGA electronic
SMD technology
Crystals and oscillators

HDL info
HDL tutorials
Verilog tips
VHDL tips

Quick-start guides
ISE
Quartus

Site
News
FPGA links
HDL tutorials
Forum


SPI - Application

LCD interface

Since we already know how to drive a graphic LCD panel, in particular in text mode, let's try to write text out from the LPC.

From the FPGA point of view, the LCD controller uses a few blockrams to hold the font, characters to display, etc... So we just have to make sure that SPI data gets into the blockrams.
From the ARM point of view, the function that sends data to the LCD blockrams is called "SSP_WriteBlock".

// function used to write in the LCD blockrams
void SSP_WriteBlock(char* ob, int len, int addr);

void LCD_PutString(char* s, int x, int y)
{
  // the blockram that holds the characters starts at address 0, and have 80 characters per line
  SSP_WriteBlock(s, strlen(s), x+y*80);
}

void main(void)
{
  SSP_init();

  LCD_PutString("Hello world!", 0, 0);
  LCD_PutString("FPGA4FUN.COM - where FPGAs are fun.", 4, 3);

  LCD_PutString("Char set:", 0, 7);
  int i; for(i=0; i<128; i++) LCD_PutChar(i, i, 8);

  LCD_Cursor_off();
}

After configuring the FPGA with the LCD controller, and running the ARM code, here's what we get:

More ideas of projects

Your turn to experiment!






This page was last updated on April 12 2007.