Giter Club home page Giter Club logo

stm32_lcd16x2's Introduction

LCD16x2 STM32F4xx

Drive LCD 16x2 with 4pin, Without I2C on STM32F407VG discovery board but you can use it for other microcontrollers.

attention: some unused peripheral are modified.

ALL YOU NEED IS THIS TWO PERIPHERALS:

  • Timer (I wrote it for TIM1 with this settings.)
  • GPIO

ports:

All pins are set on GPIOE:

d7 -> pin 15 as D7_Pin
d6 -> pin 14 as D6_Pin
d5 -> pin 13 as D5_Pin
d4 -> pin 12 as D4_Pin
E  -> pin 11 as E_Pin
RS -> pin 10 as RS_Pin
RW -> pin 9  as RW_Pin

LCD_LIB.c Library:

LCD_init():

Send some command to LCD for turn LCD On and responsible and select 4pin Mode.(READ about commands in datasheet)

LCD_send_data(char data):

Because we use 4pin mode we should split our character ASCII HEX to 4 highbit and 4 lowbit.

Then sending 4 highbit and 4 lowbit of character to LCD_send function with rs = 0 (for sending data we need rs = 0, more information in LCD_send)

LCD_send_cmd(char cmd):

Work like LCD_send_data but with rs = 1

LCD_send(char data, int rs):

At first we define RS_Pin with function rs input

RS_Pin must be 0 for sending data
RS_Pin must be 1 for sending data

In this step, char is 4 bit, so we send it by set our 4 Data Pin(D4-D7), 1 or 0.

After that we set E_Pin, 1, to say to LCD that we sending data, read the pins! and give LCD some time, then set E_Pin to 0.

LCD_send_string(char *str) :

This function get a string, select string characters and send them to LCD_send_data function.

LCD_cur(int row, int col) :

Select curser location with command.(READ datasheet to know how it works)

LCD_cls() :

Send Clear-Screen command to LCD and give LCD some time.

stm32_lcd16x2's People

Contributors

aliansgp avatar

Watchers

 avatar

stm32_lcd16x2's Issues

Print meaningless characters

after a while , when code work properly, LCD print meaningless characters
and also get repaired itself sometimes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.