⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 disp.c

📁 在ucos-ii下用LPC2290的spi端口驱动M65的液晶屏
💻 C
字号:
/* ***********************************************************************
**
**  Copyright (C) 2005  Christian Kranz
**
**  Siemens S65 Display Control for L2F50 type of display
**  EPSON L2F50 compatible
*********************************************************************** */
// file disp.c
//

// avr specific includes for local usage
//#include <avr/pgmspace.h>  // AVR specific functions to access the program memory

// my public includes

#include "config.h"


uint16 backcolor=0xFFFF;    // color of background
uint16 textcolor=0x0000;


void port_init()
{
  //uint8 tmp;
  
  IO2DIR  |= LCD_CS;
  IO2DIR  |= LCD_RESET;
  IO2DIR  |= LCD_RS;


  LCD_RESET_Clr();
  //PORTB &= ~_BV(LCD_RESET);
  //DDRB |= _BV(LCD_RESET);


  LCD_CS_Clr();
  //PORTB &= ~_BV(LCD_CS);
  //DDRB |= _BV(LCD_CS);
  

  LCD_RS_Set();
  //PORTB |= _BV(LCD_RS);  // not used from LPH display
  //DDRB |= _BV(LCD_RS);
  
  // setup SPI Interface
  PINSEL0 = 0x5500;
  S0PCCR = 0x08;        	 // 设置SPI时钟分频
  S0PCR = (0 << 3) | 	// CPHA = 0, 数据在SCK 的第一个时钟沿采样
     	  (1 << 4) | 	// CPOL = 1, SCK 为低有效
		  (1 << 5) | 	// MSTR = 1, SPI 处于主模式
		  (0 << 6) | 	// LSBF = 0, SPI 数据传输MSB (位7)在先
		  (0 << 7); 	// SPIE = 0, SPI 中断被禁止
  

  //SPCR = _BV(MSTR) | _BV(SPE) | _BV(SPR0);
  //SPSR = 1;  // double speed bit
  //tmp=SPSR;
}










// end of file

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -