EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / 128×64 Raystar LCD Problem

128×64 Raystar LCD Problem

|

Microcontroller › AVR › 128×64 Raystar LCD Problem

  • This topic has 0 replies, 1 voice, and was last updated 12 years, 9 months ago by Bogdan.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • May 26, 2013 at 5:26 pm #2443
    Bogdan
    Participant

    Hello all ! I tryed to build my own software for Raystar 128×64 LCD and I don’t know what’s wrong …

    I’m using Mega32 MCU . A friend is working in Bascom and has builded for me a little software . That it’s work .

     

     

     

    /*
     * GraphicLCD.c
     *
     * Created: 5/26/2013 6:27:47 PM
     *  Author: Ken
     */ 
     
     
    #include <avr/io.h>
     
    #define DATA_PORT PORTC
    #define DATA_DDR DDRC
    #define CTRL_PORT PORTD
    #define CTRL_DDR DDRD
    #define RS 2
    #define CS1 3
    #define CS2 4
    #define E 5
    #define RW 7
     
    void Check_LCD_busy(void);
    void Set_Y_Address(uint8_t yaddress);
    void Set_Page(uint8_t page);
    void DisplayOn(void);
    void DisplayOff(void);
    void ctrloff(void);
    void Enable(void);
    void Send_Data(uint8_t data);
    void Send_Command(uint8_t cmd);
     
    int main(void)
    {
    CTRL_DDR = 0xFF;
    DisplayOn();
    Send_Command(0x40);
    Send_Command(0xB8);
    Send_Data(124);
    Send_Data(126);
    Send_Data(19);
    Send_Data(19);
    Send_Data(126);
    Send_Data(124);
    }
     
    void Enable(){
    CTRL_PORT |= 1<<E;
    asm volatile (“nop”);
    CTRL_PORT &= ~(1<<E);
    }
     
    void ctrloff(void){
    CTRL_PORT &= ~(1<<CS1 | 1<<CS2 | 1<<E | 1<<RS | 1<<RW);
    }
    void Check_LCD_busy(){
    DATA_DDR = 0x00;
    CTRL_PORT |= 1<<CS1 | 1<<RW;
    CTRL_PORT &= ~(1<<RS);
    while (DATA_PORT >= 0x80){
    Enable();
    }
    DATA_DDR = 0xFF;
     
    }
     
    void Set_Y_Address(uint8_t yaddress){
    Check_LCD_busy();
    ctrloff();
    CTRL_PORT |= 1<<CS1;
    CTRL_PORT &= ~(1<<RS | 1<<RW);
    DATA_PORT = 0x40 + yaddress;
    Enable();
     
    }
     
    void Set_Page(uint8_t page){
    Check_LCD_busy();
    ctrloff();
    CTRL_PORT |= 1<<CS1;
    CTRL_PORT &= ~(1<<RS | 1<<RW);
    DATA_PORT = 0xB8 + page;
    Enable();
    }
     
    void Send_Data(uint8_t data){
    Check_LCD_busy();
    CTRL_PORT |= 1<<RS | 1<<CS1;
    CTRL_PORT &= ~(1<<RW);
    DATA_PORT = data;
    Enable();
     
    }
     
    void DisplayOff(){
    ctrloff();
    DATA_PORT = 0x3E;
    CTRL_PORT &= ~(1<<RW | 1<<RS);
    Enable();
    }
     
    void DisplayOn(){
    ctrloff();
    DATA_PORT = 0x3F;
    CTRL_PORT &= ~(1<<RW | 1<<RS);
    Enable();
    }
     
    void Send_Command(uint8_t cmd){
    Check_LCD_busy();
    ctrloff();
    CTRL_PORT |= 1<<CS1;
    CTRL_PORT &= ~(1<<RS | 1<<RW);
    DATA_PORT = cmd;
    Enable();
    }
  • Author
    Posts
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • cpap change over circuit March 14, 2026
  • Fender rumble 100 base amp, power, light and overdrive light flash repeatedly when power turned on no output March 13, 2026
  • Phone to op amp circuit? March 13, 2026
  • Arduino standalone minimal March 13, 2026
  • Project boxes March 13, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise