430 controls 6963c to drive LCD

Publisher:EnchantedHeartLatest update time:2014-12-10 Source: laoguKeywords:MSP430  6963c Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
/*****************************************************************************
Read LCD status word to STA
Function: Used to judge busy/idle before writing data or commands to the LCD
******************************************************************************/
void read_sta(void)
{
   P4DIR = 0x00;           //P4 data input
   P3OUT =   P3_2_DATAIO; //4245 ( x1 ) data transmission direction selection: from LCD to 430
   P3OUT =   P3_1_CD;      // Command mode
   P3OUT &= ~P3_0_RD;     //read
   STA = P4IN;             // Read back status
   P3OUT  = P3_0_RD;      //cancel read
   P4DIR = 0xff;           //P4 port is set to data output mode    
   P3OUT &= ~P3_2_DATAIO; //4245 ( x1 ) data transmission direction selection: from 430 to LCD
 
}
/*****************************************************************************
Judge the status bit S1, S0 function ( read and write instructions and read and write data status )
******************************************************************************/
void ST1( void )
    {
      do
        {
        read_sta();
        }
      while( (STA & 0x03) != 0x03 );
 
    }
/*****************************************************************************
Status bit S2 function ( data automatic reading status )
******************************************************************************/
void ST2( void )
   {
     do
     {
       read_sta();
     }
    while( (STA & 0x04) != 0x04);
   }
/*****************************************************************************
- Status bit S3 function ( data automatic write status ) -
******************************************************************************/
void ST3( void )
   {
     do
     {
       read_sta();
     }
     while( (STA & 0x08) != 0x08 );
   }
/*****************************************************************************
Write data byte
******************************************************************************/
void write_data(unsigned char Byte )
{
        ST1();
        P4OUT = Byte;
        P3OUT &= ~P3_1_CD;        // Data mode
        P2OUT &= ~P2_7_WR ;      // write
        P2OUT  =  P2_7_WR ;    
}
/*****************************************************************************
Automatically write data bytes
******************************************************************************/
void autowrite_data(unsigned char Byte )
{
        P4OUT = Byte;
        P3OUT &= ~P3_1_CD;        // Data mode
        P2OUT &= ~P2_7_WR ;      // write
        P2OUT  =  P2_7_WR ;    
}
 
/*****************************************************************************
Write command word
******************************************************************************/
void write_cmd(unsigned char cmd )
{
        ST1();
        P4OUT = cmd ;
        P3OUT =   P3_1_CD   ;       // Command mode
        P2OUT &= ~P2_7_WR ;       // write
        P2OUT  =  P2_7_WR ;    
}
/*****************************************************************************
Writing commands with only one argument
******************************************************************************/
void write_onepara(unsigned char dat1,unsigned char command )
{
 
        write_data( dat1 );
        write_cmd( command );
        
}
/*****************************************************************************
Write a command with two parameters
******************************************************************************/
void write_doublepara(unsigned char dat1,unsigned char dat2,unsigned char command )
{
 
        write_data( dat1 );
        write_data( dat2 );
        write_cmd( command );
        
}
/*****************************************************************************
Function to clear the display buffer
******************************************************************************/
void CLEAR_RAM( void )
    {
    int i;
    write_doublepara( 0x00,0x00,0x24 );        /* Set the first address of display RAM */
  
    write_cmd( 0xb0 );                         /* Set automatic write mode */
 
    for(i=0;i<8200;i++)                        /* Clear 8K memory */
       {         
         ST3();                                /* Judge status bit S3 */
         write_data(0x00);                     /* write data */            
        }
     write_cmd( 0xb2 ); /*                        Set automatic write end instruction */        
       
    }
/*****************************************************************************
Some initial setting functions for the LCD screen
******************************************************************************/
void LcdIni( void )
    {
       write_doublepara(0x00,0x00,0x40);        /* Set the first address of the text display area */
       write_doublepara(0x28,0x00,0x41);        /* Set the text display area width */
       write_doublepara(0x03,0x00,0x22);     /* Set CGRAM bias address */
 
       write_doublepara(0x00,0x08,0x42);        /* Set the first address of the graphics display area */
       write_doublepara(0x1e,0x00,0x43);        /* Set the width of the graphics display area */
//       write_cmd(0xa2);                         /* Cursor shape setting */   
  //      write_doublepara(0x08,0x08,0x21);        /* Set the cursor position */
       write_cmd(0x80);                         /* Display mode settings logical " or " synthesis , internal character generator is effective */
       write_cmd(0x98);                         /* Display switch setting: turn off text and turn on graphic display */
       CLEAR_RAM();
    }
Keywords:MSP430  6963c Reference address:430 controls 6963c to drive LCD

Previous article:Detailed explanation of DS18B20 temperature sensor
Next article:Timed interruption controls the on and off of the light

Recommended ReadingLatest update time:2024-11-16 15:46

MSP430F5438 lights up LED
Today I just wanted to light up an LED lamp. Because there was no video, I had to do a lot of things by myself. I had talked to the store in the afternoon, and they said they would give me some technical support, but they didn’t give me any at all. I really wanted to go to hell. In fact, the code had been written a lo
[Microcontroller]
MSP430F5438 lights up LED
MSP430 C language keyword expansion
1.interrupt is used for interrupt function. The definition is as follows: Syntax: interrupt void function name() or interrupt void function name() Parameters: The interrupt function has no parameters. The interrupt function needs to specify the interrupt vector. Return: The interrupt function is generally
[Microcontroller]
MSP430G2553 as DS18B20 temperature controller
//P2.5 relay output #include"msp430g2553.h" #include"LCD1602_4bit.h" #include"DS18B20.H" unsigned char temp_L,temp_H,temp_s,temp_s_flag,temp_s_H,temp_s_M,temp_s_L,temp; unsigned char time_num; unsigned char i1; unsigned char table_1 ="Real:"; unsigned char table_2 ="set:"; unsigned char table_3 ="setti
[Microcontroller]
Rechargeable brain pacemaker based on single chip microcomputer design
Among movement disorders, Parkinson's disease (PD) is characterized by increased muscle tension and decreased movement. It was named after the British Janes Parkinson who first described it in 1817. According to incomplete statistics, there are about 1.2 to 1.3 million Parkinson's disease patients in my country, and t
[Microcontroller]
Rechargeable brain pacemaker based on single chip microcomputer design
What are the maskable interrupts of MSP430?
Interrupts largely reflect the performance of a microcontroller. From this point of view, MSP430 does a very good job in interrupts, mainly by providing a very rich interrupt source, the basic ones are IO interrupts, timer interrupts and some interface interrupts (SPI, UART, I2C) and so on. Now I will talk about som
[Microcontroller]
Getting Started with MSP430: Hardware Basics
A few points worth noting: 1. The reset signal is the starting point of the MCU. There are two reset signals for 430: the power-on reset signal POR and the power-on clear signal PUC. The POR signal is only used when the power is on and the RST/NMI reset pin is set to the reset function, and the system is reset when it
[Microcontroller]
msp430 accurately measures low frequency
//****************************************************************************** // Date: 2009.8.16 // Author: xurafreedom // Email: freedomxura@gmail.com / mxh20999@163.com // Blog: http://xurafreedom.cublog.cn // Basic principle: 1s timing, count the number of rising edges of the captured signal during this time
[Microcontroller]
An AC frequency detection system based on MSP430 single chip microcomputer
1 Introduction Since frequency signals have the advantages of strong anti-interference, easy transmission, and high measurement accuracy, many non-frequency sensor signals are converted into frequency quantities for measurement and processing. Therefore, frequency measurement methods are attractin
[Microcontroller]
An AC frequency detection system based on MSP430 single chip microcomputer
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号