Page 533 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 533
[GLCD.c]
TFT LCD를 동작시키기 위한 프로그램 소스이다. TFT LCD는 가로 320 세로 240의 도트로 이
루어져있고 글씨를 출력하고자 한다면 그 도트에 맞는 각각의 색을 지정해주어야 한다.
#include "stm32f10x.h"
#include "GLCD.h"
#include "font.h"
unsigned int text;
unsigned int back;
unsigned short DeviceCode;
void GLCD_init (void) // LCD 초기 셋팅. 알고시프면
데이터시트 보세요
{
/* Enable clock for GPIOA,B,C,D,E AFIO and SPI3. */
RCC->APB2ENR |= 0x0000007D;
/* NCS is PB2, GPIO output set to high. */
GPIOE->CRL = 0x33333333; //
GPIOE->CRH = 0x33333333;
GPIOD->CRH &= 0x0000ffff; //PD12,PD13,14,15
GPIOD->CRH |= 0x33330000;
GPIOD->BSRR = 0x0000F000; //cs,rs,wr,rd = 1;
delay(2); /* Delay 50 ms */
DeviceCode = rd_reg(0x00);
if(DeviceCode == 0x9320)
{
/ * S t a r t I n i t i a l S e q u e n c e
--------------------------------------------------*/
wr_reg(0xE5, 0x8000); /* Set the internal vcore voltage */
wr_reg(0x00, 0x0001); /* Start internal OSC */
wr_reg(0x01, 0x0100);
- 526 -