[mw_shl_code=c,true][/mw_shl_code]
[mw_shl_code=c,true]头文件[/mw_shl_code]
[mw_shl_code=c,true]
[mw_shl_code=c,true]#ifndef __RA8806_H
#define __RA8806_H
#include "sys.h"
#include "stdlib.h"
//?????¨??
#define RD PCout(6)//?????????????????????????§
#define WR PCout(7)//?????????????????????????§
#define RS PCout(8)//??????????????????????????????
#define CS PCout(9)//???????????????????§
#define BUSY PCout(10)//??????????????
#define INT PCout(11)//????·??ú????????
#define RST PCout(12)//????
//PB0~7??????????
#define DATAOUT(x) GPIOB->ODR=(GPIOB->ODR&0xff00)|(x&0x00ff);//????
//#define DATAINT GPIOB->IDR=(GPIOB-IDR&0x00ff);//???? IDR??16?????è?????????í ????8??????
//????????
void LCD_Init(void);//??????
void SOFTRST(void);
//void LCD_DisplayOn(void);//??????
//void LCD_DisplayOff(void);//??????
//void LCD_Clear(u16 Color);//????
//void LCD_SetCursor(u16 Xpos, u16 Ypos);//?è??×?±ê
//void LCD_DrawPoint(u16 x,u16 y);//????
//u16 LCD_RD_DATA(void);//????LCD????
void LCD_WriteReg(u8 LCD_Reg, u8 LCD_RegValue);//???????÷ ?????÷±à?? ????????????
//RA8806?????÷
#define WLCR 0x00
#define MISC 0x01
#define ADSR 0x03
#define INTR 0x0F
#define WCCR 0x10
#define CHWI 0x11 //new(have change)
#define MAMR 0x12
#define AWRR 0x20
#define DWWR 0x21
#define AWBR 0x30
#define DWHR 0x31 //new(have change)
#define AWLR 0x40
#define AWTR 0x50
#define CURX 0x60 //new(have change)
#define BGSG 0x61
#define EDSG 0x62 //new
#define CURY 0x70 //new(have change)
#define BGCM 0x71
#define EDCM 0x72
#define BTMR 0x80
#define ITCR 0x90 //new(have change)
#define KSCR1 0xA0
#define KSCR2 0xA1
#define KSDR0 0xA2 //new(have change)
#define KSDR1 0xA3
#define KSDR2 0xA4
#define MWCR 0xB0 //new(have change)
#define MRCR 0xB1 //new
#define TPCR 0xC0
#define TPXR 0xC1
#define TPYR 0xC2
#define TPZR 0xC3
#define PCR 0xD0 //new(have change)
#define PDCR 0xD1 //new
#define PNTR 0xE0
#define FNCR 0xF0
#define FVHT 0xF1
#endif
[/mw_shl_code]
[/mw_shl_code]
[mw_shl_code=c,true][/mw_shl_code]
[mw_shl_code=c,true][/mw_shl_code]
[mw_shl_code=c,true][/mw_shl_code]
[mw_shl_code=c,true]#include "ra8806.h"
#include "stdio.h"
#include "delay.h"
//?í????
void SOFTRST()
{ CS=0;
delay_ms(1000);
RST=0;
delay_ms(1100);
RST=1;
delay_ms(1000);
}
//???????÷±à??
void LCD_WR_REG(u8 data)
{
CS=0;//??????
RD=1;//????????????
RS=1;//????
WR=0;
DATAOUT(data);
WR=1;//?????????ê??
CS=1;//????????
RD=1;
RS=1;
}
//???????÷????
void LCD_WR_DATA(u8 data)
{
CS=0;
RD=1;
RS=0;//????
WR=0;
DATAOUT(data);
WR=1;
CS=1;
RS=1;
RD=1;
}
//???????÷
void LCD_WriteReg(u8 LCD_Reg,u8 LCD_RegValue)
{
LCD_WR_REG(LCD_Reg);
LCD_WR_DATA(LCD_RegValue);
}
//??????RA8806
void LCD_Init(void)
{
RCC->APB2ENR|=1<<3;//????PORTB?±??
RCC->APB2ENR|=1<<4;//????PORTC?±??
//8080????
JTAG_Set(SWD_ENABLE);
GPIOB->CRL=0X33333333;
GPIOB->ODR|=0XFFFF;
GPIOC->CRH&=0XFFF00000;
GPIOC->CRL&=0X00FFFFFF;
GPIOC->CRH|=0X00033333;
GPIOC->CRL|=0X33000000;//???ì????
GPIOC->ODR|=0X1FC0;//??????????
LCD_WriteReg(WLCR,0x04);
LCD_WriteReg(MISC,0x08);
LCD_WriteReg(ADSR,0x00);
LCD_WriteReg(INTR,0x00);
LCD_WriteReg(WCCR,0x00);
LCD_WriteReg(CHWI,0x00);
LCD_WriteReg(MAMR,0x13);
LCD_WriteReg(AWRR,39);
LCD_WriteReg(DWWR,39);
LCD_WriteReg(AWBR,239);
LCD_WriteReg(DWHR,239);
LCD_WriteReg(AWLR,0x00);
LCD_WriteReg(AWTR,0x00);
LCD_WriteReg(CURX,0x00);
LCD_WriteReg(BGSG,0x00);
LCD_WriteReg(EDSG,0x00);
LCD_WriteReg(CURY,0x00);
LCD_WriteReg(BGCM,0x00);
LCD_WriteReg(EDCM,0x00);
LCD_WriteReg(BTMR,0x00);
LCD_WriteReg(ITCR,0x27);
LCD_WriteReg(PNTR,0x00);
LCD_WriteReg(FNCR,0x00);
LCD_WriteReg(FVHT,0x00);
}
[/mw_shl_code]
[mw_shl_code=c,true][/mw_shl_code]
[mw_shl_code=c,true][/mw_shl_code]
[mw_shl_code=c,true]
[mw_shl_code=c,true]int main(void)
{
Stm32_Clock_Init(9); //?????±???è??
delay_init(72); //???±??????
uart_init(72,9600); //?®????????
LED_Init(); //????????LED??????????????
// OLED_Init(); //?????????§
SOFTRST();
LCD_Init();
// LCD_WriteReg(WLCR,0x04);//??????????????????????????
// LCD_WriteReg(MISC,0x88);//?????©?¨????
// LCD_WriteReg(PNTR,0xFF);
// LCD_WriteReg(FNCR,0xA8);
LCD_WriteReg(MISC,0X05);
// LCD_WriteReg(FVHT,0x00);
while(1)
{
LED0=1;
delay_ms(500);
LED0=0;
delay_ms(500);
// OLED_DrawPoint(3,63,1);
// OLED_Refresh_Gram();
}[/mw_shl_code]
[/mw_shl_code]
[mw_shl_code=c,true]只是写了个小小的程序,却怎么也无法显示啊!断断续续的都搞了半个月了,希望用过这个控制器的同仁帮忙看一下吧![/mw_shl_code]
[mw_shl_code=c,true]我一直都是怀疑是不是时序的问题,可是我在网上查了好多资料,也修改过很多的时序,可就是不行,无法显示。[/mw_shl_code]
我的手机太垃圾,照相不清楚,反正有显示。
一周热门 更多>