Shop OBEX P1 Docs P2 Docs Learn Events
AMC0802B LCD — Parallax Forums

AMC0802B LCD

acliffhayacliffhay Posts: 5
edited 2015-02-17 08:57 in Propeller 1
I have a nifty little project I'm working on and thought it would be the perfect time to learn the Propeller. I found a decently priced little LCD that I would like to use instead of the serial lcd from Parallax due to size and cost. The C tutorials are pretty good but I am a little confused with SPI interfaces. I believe I can get the display initialized, but I can't figure out the best way to send the actual data to the display based on the datasheet. Do I send each individual character to the DDRAM address for its position in the display?
/*
Oriental Display - AMC0802B-SPI
*/

#include "simpletools.h"                          // Include simpletools lib

int lcd_csb = 6;                                  // Chip Select
int lcd_sid = 7;                                  // Data
int lcd_sclk = 8;                                 // Clock
int lcd_rs = 9;                                   // Register Select


     
int main()                                        // Main function
{
  pause(42);                                      // Wait at least 40ms
  
  high(lcd_csb);                                  // CS line high
  high(lcd_sclk);                                  // CLK line high
  low(lcd_csb);                                   // CS -> low start SPI
  
  pause(10);
                                                                //Initialize LCD
  shift_out(lcd_sid, lcd_sclk, MSBFIRST, 8, 0b00111000);       // Function Set - 8bit, 2 Line, 5x8
  pause(1);                                                   // Wait at least 100us
  shift_out(lcd_sid, lcd_sclk, MSBFIRST, 8, 0b00001100);       // Display On
  pause(1);                                                   // Wait at least 100us
  shift_out(lcd_sid, lcd_sclk, MSBFIRST, 8, 0b00000001);       // Clear Display
  pause(12);                                                  // Wait at least 10us
  shift_out(lcd_sid, lcd_sclk, MSBFIRST, 8, 0b00000100);       // Entry Mode Set
  pause(1);
    
  high(lcd_csb);                                        // CS -> high stop SPI
  pause(10);
  
                                                                //Send it a Character

  high(lcd_csb);                                  // CS line high
  high(lcd_sclk);                                  // CLK line high
  low(lcd_csb);                                   // CS -> low start SPI
  
  
  shift_out(lcd_sid, lcd_sclk, MSBFIRST, 8, 0b11000000); //Set DDRAM Address
  shift_out(lcd_sid, lcd_sclk, MSBFIRST, 8, 0b00010100); //Generate "A"
  
  
}


I have some experience with Stamps, but am completely new to the Propeller platform. I'm using SimpleIDE. I may have bitten off more than I can chew, but I tend to be a feet first kind of person.

Thanks!

Al

Comments

  • lanternfishlanternfish Posts: 366
    edited 2015-02-15 18:51
    Hi Al
    acliffhay wrote: »
    Do I send each individual character to the DDRAM address for its position in the display?

    Hi

    In answer to your question about character placement - Yes.

    The AMC0802B is HD44780 compatible and so any tutorials for the HD44780 will be very helpful. Unfortunately it has been a while since I needed to use an LCD so a bit rusty on the details.

    Putting your code inside
    ...
    
    formats it better (sometimes)
    I tend to be a feet first kind of person

    You are in good company. And in some ways it is the only way we get to find out how things work.
  • acliffhayacliffhay Posts: 5
    edited 2015-02-17 08:57
    Thanks lanternfish!

    That gives me enough to plug away. Thanks for the hints on posting code, as well.

    Al
Sign In or Register to comment.