Program for MSP430 controller LCD SED1335
//------------------------------------------------------------
//------------------------------------------------------------
#define WC_ADD XBYTE[0xC100]
#define WD_ADD XBYTE[0xC000]
#define RD_ADD XBYTE[0xC100]
#define RB_ADD XBYTE[0xC000]
void INTR(void);
void CLEAR(void); /* 信号输入 x [0---319] ,y [0---239] */
void CCTW(unsigned int x,unsigned char y,unsigned char m,unsigned char n,unsigned char *p);
void dot (unsigned int x,unsigned char y,bit c); /* c=1 划点 c=0 取消点*/
void INTR(void)
{
unsigned char code SYSTAB[]={0x30,0x87,0x07,0x27,0x42,0xf0,0x28,0x00}; // control parameter
unsigned char code SCRTAB[]={0x00,0x00,0xf0,0x00,0x40,0xf0,0x00,0x80,0x00,0x00};
unsigned char i=0x0;
WC_ADD = 0x40;
for(i = 0 ;i < 8; i++)
{
WD_ADD = SYSTAB;
}
WC_ADD = 0x44;
for(i = 0;i < 10;i++)
{
WD_ADD = SCRTAB;
}
WC_ADD = 0x5a;
WD_ADD = 0x0;
WC_ADD = 0x5b;
WD_ADD = 0x0;
WC_ADD = 0x59;
WD_ADD = 0x54;
}
void CLEAR(void)
{
unsigned char i=0,j=0;
WC_ADD = 0x4c;
WC_ADD = 0x46;
WD_ADD = 0x0;
WD_ADD = 0x0;
WC_ADD = 0x42;
for(i = 0;i < 255;i++)
{
for(j = 0;j < 255;j++)
{ WD_ADD = 0x0;
}
}
}
void CCTW(unsigned int x,unsigned char y,unsigned char m,unsigned char n,unsigned char *p)
{
unsigned char ap=0x28,i,j,k,tt=0,uu=0,rr=0,ee=0,ff=0,gg=0; /*ap 修改 P7, 行字符个数 */
unsigned int l;
tt = x%8;
x=x/8;
l = y*ap + x+0x4000;
x = (unsigned char)(l&0x00ff);
y = (unsigned char)((l&0xff00)>>8);
WC_ADD=0x4c; /*设置光标“右”移动方式 */
for(i=0;i< n;i++)
{
WC_ADD = 0x46; /* 光标指针设置 */
WD_ADD = x; /* 光标地址16位 */
WD_ADD = y;
if(tt==0)
{
WC_ADD = 0x42; /* 连续写入数据*/
for (j=0;j
WD_ADD = *p;
p++ ;
}
} /* 0 1 2 3 */
else { /* 0---7 8---16 17---24 25---32*/
for(j=0;j
RD_ADD=0x43; /* 读数据 */
uu=RD_ADD;
rr=RD_ADD;
/*-----------------------------------------------------*/
gg=*p; /* 处理数据*/
p++;
k=uu>>(8-tt);
k=k<<(8-tt); // 高位
ee=k;
k=gg>>tt; // 移高位作为低位
ee=ee|k;
/*-----------*/
k=rr<k=k>>tt; // 低位
ff=k;
k=gg<<(8-tt);
ff=ff|k;
/*--------------------------------------------------------------*/
WC_ADD=0x4d; /*Change the cursor "left" movement mode */
RD_ADD=0x43;
k=RD_ADD;
k=RD_ADD;
WC_ADD=0x4c; /*Non-complex cursor "right" movement mode */
WC_ADD = 0x42; /* Send two data */
WD_ADD =ee;
WD_ADD =ff;
/*This data is sent, two were sent before, one needs to be returned*/
WC_ADD=0x4d; /*Change the cursor "left" movement mode */
RD_ADD=0x43;
k=RD_ADD;
k=RD_ADD;
WC_ADD=0x4c; /*Non-complex cursor "right" movement mode */
RD_ADD=0x43;
k=RD_ADD;
}
}
l=(ap+x+(y<<8));
x=(unsigned char)(l&0x00ff);
y=(unsigned char)((l&0xff00)>>8);
}
}
void dot (unsigned int x,unsigned char y,bit c)
{
unsigned char ap=0x28,tt=0,uu=0,gg=0,k=0; /*ap modifies P7, number of characters in a row */
unsigned int l=0;
tt = x%8;
x = x/8;
l = y*ap + x+0x4000;
x = (unsigned char)(l&0x00ff);
y = (unsigned char)((l&0xff00)>>8);
WC_ADD = 0x4c;
WC_ADD = 0x46; /* cursor pointer setting */
WD_ADD = x; /* Cursor address 16 bits */
WD_ADD = y;
RD_ADD=0x43; /* Read data */
uu=RD_ADD;
if(c)
{
gg = 1;
gg =gg<<(7-tt);
uu=uu|gg;
}
else {
gg = 1;
gg =gg<<(7-tt);
gg = ~gg;
uu=uu≫
}
WC_ADD=0x4d;
RD_ADD=0x43;
k=RD_ADD;
WC_ADD = 0x4c; /* Non-complex cursor "right" movement mode */
WC_ADD = 0x42; /* Send two data */
WD_ADD = uu;
}
Previous article:MSP430F449 Clock
Next article:RS232 interface program for msp430f449
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- 【Download】New version GD32F10x: Based on Arm Cortex-M3 32-bit MCU
- Wireless mouse production
- Case sharing: Analysis of TPS54240 circuit burning out after power on
- RISC-V brings more than just open source
- Working Principle of SRAM Circuit
- STM32 pin short circuit to ground analysis
- [ART-Pi Review] 1: Demo Experience
- DSP core + coprocessor
- Fundamentals of Electronic Components and Practical Circuits (Revised Edition)
- Mastering Verilog HDL: Detailed Examples of IC Design Core Technologies.part01.rar