?? lcd.c
字號:
#include <msp430x14x.h>
#include <stdio.h>
#include <math.h>
/***************************************Lcd Control Pin Macro Define***********************************/
#define LCD_RD_DISABLE P5OUT|=BIT0 //lcd read disable
#define LCD_RD_ENABLE P5OUT&=~BIT0 //lcd read enable
#define LCD_CS_LOW P5OUT&=~BIT6 //chip select enable
#define LCD_CS_HIGH P5OUT|=BIT6 //chip select disable
#define LCD_WR_ENABLE P5OUT&=~BIT1 //lcd write enable
#define LCD_WR_DISABLE P5OUT|=BIT1 //lcd write disable
#define LCD_A0_COMM P5OUT&=~BIT2 //when A0=0 -> command
#define LCD_A0_DATA P5OUT|=BIT2 //when A0=1 -> data
#define LCD_RESET_LOW P4OUT&=~BIT2 //lcd reset enable
#define LCD_RESET_HIGH P4OUT|=BIT2 //lcd reset disable
/***************************************Lcd Command Macro Define**************************************/
#define ICON_ENABLE 0xa3 //icon enable &set the page address to 16
#define ICON_DISABLE 0xa2 //icon disable (default)
#define SET_PAGE 0xb0 //set page address
#define SET_COLUMN_MSB 0x10 //set column address MSB
#define SET_COLUMN_LSB 0x00 //set column address LSB
#define SET_MODIFY_READ 0xe0 //set modify-read mode
#define RESET_MODIFY_READ 0xee //reset modify-read mode
#define DISPLAY_ON 0xaf //display on
#define DISPLAY_OFF 0xae //display off
#define SET_INITIAL_LINE_REG 0x40 //2-byte instruction to specify the initial display line to
//realize vertical scrolling
#define SET_INITIAL_COM0_REG 0x44 //2-byte instruction to specify the initial COM0 to realize
//windows scrolling without the change of display data
#define SET_PARTIAL_DISPLAY 0x48 //2-byte instruction to set partial display duty ratio
#define SET_N_LINE_INVERSION 0x4c //2-byte instruction to set N-line inversion register
#define RELEASE_N_LINE_INVERSION 0xe4 //release N-line inversion mode
#define REVERSE_DISPLAY_ON 0xa7 //reverse display
#define REVERSE_DISPLAY_OFF 0xa6 //normal display
#define ENTIRE_DISPLAY_ON 0xa5 //entire display on
#define ENTIRE_DISPLAY_OFF 0xa4 //entire display off
#define POWER_CONTROL 0x28 //control power circuit operation
#define SELECT_DC_STEP 0x64 //select the step-up of internal voltage converter
#define SELECT_REGULATOR_REG 0x20 //select the internal resistance ratio of the regulator resistor
#define SELECT_ELEC_VOL_REG 0x81 //2-byte instruction to specify the reference voltage
#define SELECT_LCD_BIAS 0x50 //select lcd bias
#define BIAS_POWER_SAVE_HIGH 0xf3 //bias power save save the bias current consumption(high)
#define BIAS_POWER_SAVE_LOW 0x00 //bias power save save the bias current consumption(low)
#define SHL_NORMAL_DIRECTION 0xc0 //SHL = 0: normal direction (COM0 → COM127)
//COM output scanning direction is selected by this instruction
//which determines the LCD driver output status.
#define SHL_REVERSE_DIRECTION 0xc8 //SHL = 1: reverse direction (COM127 → COM0)
#define ADC_NORMAL_DIRECTION 0xa0 //ADC = 0: normal direction (SEG0 → SEG127)
//Changes the relationship between RAM column address and segment
//driver. The direction of segment driver output pins could be
//reversed by software. This makes IC layout flexible in LCD
//module assembly.
#define ADC_REVERSE_DIRECTION 0xa1 //ADC = 1: reverse direction (SEG127 → SEG0)
#define OSCILLATOR_ON 0xab //start the built-in oscillator
#define POWER_NORMAL_MODE 0xa8 //P = 0: normal mode
#define POWER_SLEEP_MODE 0xa9 //P = 1: sleep mode
#define RELEASE_POWER_SAVE_MODE 0xe1 //release power save mode
#define SOFTWARE_RESET 0xe2 //initial the internal function
#define SET_FRC_PWM_MODE 0x90 /* FRC PWM1 PWM0 Status of PWM & FRC
0 4FRC
1 3FRC
0 0 9PWM
0 1 9PWM
1 0 12PWM
1 1 15PWM */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -