Top Banner
Text LCD Control Text LCD Control MIAT STM32 Development Kit WU-YANG 浯陽科技有限公司 謝昇憲 support.wuyang@gmail.com Technology Co., Ltd.
26

Text LCD Controlccy.dd.ncu.edu.tw/~chen/course/embeddedSoft/ES實驗03-文字型LCD... · Declared Version Training Only Declare Document Number Document Version 1.00 Release Date

Mar 22, 2018

Download

Documents

ngominh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • Text LCD ControlText LCD ControlMIAT STM32 Development Kit

    WU-YANG

    [email protected] Co., Ltd.

    pp y g@g

  • Declared Version

    Training Only

    Declare

    Document Number

    Document Version 1.00

    Release Date 2009.08.04

    Document Title Text LCD Control

    Exercise Time Lecture 90 minutes Operating 90 minutes

    MIAT STM32F10 EVBPlatform MIAT STM32F10x EVB MIAT IOB

    Peripheral Text LCD

    Author Wu-Yangg

    Key Word STM32F10x, Text LCD

    22

  • ARM C t M3ARM Cortex-M3

    3

  • Text LCD ControlTe t LCD F n tion ListText LCD Function ListDevelopment FlowARM Configure

  • Text LCD Control(1)( )

    Text LCD Pin Define Text LCD Block Diagram

    5

  • Text LCD Control(2)( )

    1.ROMCGCharacter GeneratorROMCG ROM1925x7"A"LCD "A" ASCII41HDDRAMCG ROM "A"LCD

    6

  • Text LCD Control(3)( )

    7

  • Text LCD Control(2)( )

    2.RAMDDData DisplayRAMDD RAMLCDDD RAM00H67HLCD "A"21DD RAM40H41HLCD

    8

  • Text LCD Control(2)( )

    3.RAMCG RAM64LCD5x8800H07H

    9

  • Text LCD Control(3)( )

    Instruction Set

    10

  • Text LCD Timer

    11

  • Busy checky

    12

  • Text LCD Function List(1)( )

    init_lcd()LCDLCDLCD LCD

    write_com(unsigned char c)C

    it d t ( i d h ) write_data(unsigned char c)C

    print(char line, char *str)LCD*strLCDline

    prline1(char x, char w) LCDwxLCDwx

    prline2(char x, char w) LCDwx

    13

  • Text LCD Function List(2)( ) clear(void)

    LCD home(void)

    setCursor(char index)

    shiftDisplayLeft(void)

    Display shiftDisplayRight(void) shiftDisplayRight(void)

    Display pf4h(unsigned int value)

    hexLCDhexLCD

    14

  • Development Flowp

    Embedded Software Side intmain(void){

    Connect the EVB and the IOB

    Programming

    #ifdefDEBUGdebug();

    #endif

    /*Systemclocksconfiguration*/CC C fi ti ()

    g gBootupSTM32F10x

    RCC Configure

    GPIO Configure

    LCD Initial

    RCC_Configuration();

    /*GPIOconfiguration*/GPIO_Configuration();

    /* LCD */LCD Initial / /init_lcd();

    clear();while(1){

    print(1 "HelloWorld!!");print(1, HelloWorld!! );delay(10000);

    }}

    15

  • Configure RCCgvoidRCC_Configuration(void){

    /*RCCsystemreset(fordebugpurpose)*/RCC_DeInit();/*EnableHSE*/RCC HSEConfig(RCC HSE ON);

    RCC FwLib Functions List

    RCC_HSEConfig(RCC_HSE_ON);/*WaittillHSEisready*/HSEStartUpStatus=RCC_WaitForHSEStartUp();if(HSEStartUpStatus==SUCCESS){

    /*EnablePrefetchBuffer*/FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);/*Flash2waitstate*// /FLASH_SetLatency(FLASH_Latency_2);/*HCLK=SYSCLK*/RCC_HCLKConfig(RCC_SYSCLK_Div1);/*PCLK2=HCLK*/RCC_PCLK2Config(RCC_HCLK_Div1);/*PCLK1=HCLK/2*/RCC_PCLK1Config(RCC_HCLK_Div2);/*ADCCLK=PCLK2/4*/RCC_ADCCLKConfig(RCC_PCLK2_Div4);/*PLLCLK=8MHz*7=56MHz*/RCC_PLLConfig(RCC_PLLSource_HSE_Div1,RCC_PLLMul_7);/*EnablePLL*/RCC PLLC d(ENABLE)RCC_PLLCmd(ENABLE);/*WaittillPLLisready*/while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY)==RESET){}/*SelectPLLassystemclocksource*/RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);/*WaittillPLLisusedassystemclocksource*/while(RCC GetSYSCLKSource()!=0x08){}while(RCC_GetSYSCLKSource()!=0x08){}

    }/*Enableperipheralclocks*/

    /*EnableGPIOCclock*/RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);

    }

    1616

    }

  • Configure GPIOgvoidGPIO_Configuration(void){GPIO_InitTypeDefGPIO_InitStructure;

    GPIO FwLib Functions List

    /*ConfigureIOconnectedtoGPIOC*********************/GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2

    |GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7|GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10;

    GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;GPIO_Init(GPIOC,&GPIO_InitStructure);

    }

    1717

  • Text LCD

  • Text LCD

    rsrw

    DB0DB1DB2DB3DB4DB5DB6DB7enrs

    19

  • / \ \

    Project

    lib

    Lab.dfu

    hw_config.c lcd_func.c Text LCD

    21

  • MIAT STM32 user manual (ch3, ch4) , hexdfu

    USB dfu Text LCD

    22

  • shiftDisplayLeft functionText LCD shiftDisplayLeft functionText LCD

    setCGRAM functionText LCDCG RamRam

    23

  • ~(90min)( )

  • Exe 1 : Exe_1 : Exe_2 : CGRAM

    [1] MIAT_STM32_user_manual_V1.00.pdf[2] STM32F10xxx reference manual pdf[2] STM32F10xxx reference manual.pdf[3] STM32F103XX firmware library.pdf[4] LMC-SSC2D16-01 Serial USER MANUAL(Text LCD [4] LMC SSC2D16 01 Serial USER MANUAL(Text LCD

    datasheet)

    25

  • Q & AQ & A