Datasheet

Memory LCD Programming
6 LCD Application Note
case 1: //Sending a line (other than the first line). At this
//point the DMA transfer for the previous line is done
//and the channel disabled.
linebuf = locbuf; //init pointer to line buffer
*linebuf++ = swap(linenum++); //line number
for(i= 0; i < MLCD_BYTES_LINE; i++) *linebuf++ =
swap(*frmbufptr++); //swap the order of the bits
*linebuf++ = 0; //trailer
//set up DMA control
TransferSetup(locbuf, linebuf - locbuf);
//Start the xfer
TransferStart;
if(linenum > MLCD_YRES) stage = 2; //all lines sent, go to next
//stage
break;
case 2: //All lines sent, send a final null byte trailer. The DMA
//transfer of the last line is finished and the channel
//disabled. All that is left is to write a trailing null
//byte. It’s not worth using DMA to transfer 1 byte, so
//it’s done by directing writing to the SPI port.
//Write the last (null) byte
Write_to_SPI(0);
//Since there is no interrupt on transmit buffer empty, loop
//here until the byte is sent, then drop SCS.
i = 0;
while(SPI_BSY); //wait until done
set_scs(LOW);
stage = 0; //go back to stage 0 - sending out first line
}
}