element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Embedded and Microcontrollers
  • Technologies
  • More
Embedded and Microcontrollers
Blog Building a Low Power Compact LCD Display - I2C Traffic
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Embedded and Microcontrollers to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 22 Nov 2016 2:59 PM Date Created
  • Views 688 views
  • Likes 7 likes
  • Comments 0 comments
  • lcd
  • i2c
  • lcd-s301c31tr
  • pcf85176t
  • logic_analyzer
Related
Recommended

Building a Low Power Compact LCD Display - I2C Traffic

Jan Cumps
Jan Cumps
22 Nov 2016

Our Raspberry Pi friends will know the Building a Low Power Compact LCD Display project that shabaz published a while ago. He designed a £5 LCD module and the source code for Raspberry Pi.

image
Let's have a look at the I2C traffic. I used the Hercules port that I made of Shabaz' example to capture it.

 

 

What data is flowing according to the code?

Our code tries to send 9 bytes.

  • 1:          the 7-bit I2C address + read/write bit
  • 2 - 6:    config and commands
  • 7 - 9:    data for the segments and dots

 

#define LCD_ADDR 0x38
// ...

// Commands (these can be 'continued' by setting the MSB
#define DEVICE_ADDR 0x62
#define BLINK_OFF 0x70
#define BANK_CMD 0x78


// BANK_CMD bit values
#define WR_BANK_A 0x00
#define WR_BANK_B 0x02
#define DISP_BANK_A 0x00
#define DISP_BANK_B 0x01

// ...

 unsigned char mode, device, bank, blinkmode;


  mode=0xc9; // Set static mode, display enabled, continuation enabled
  device=DEVICE_ADDR | 0x80; // Select the device, continuation enabled
  bank=BANK_CMD | 0x80 | WR_BANK_A | DISP_BANK_A; 
  blinkmode=BLINK_OFF | 0x80;
  buf[0]=mode;
  buf[1]=device;
  buf[2]=blinkmode;
  buf[3]=bank;
  buf[4]=0x00; // pointer
  buf[5]=progval->byte0;
  buf[6]=progval->byte1;
  buf[7]=progval->byte2;

 

What's really flowing to the LCD Controller

These two captures are the result of sending ' . . ' and '  0.0' to the display:

image

image

Everything looks as expected. On the odd lines from 3 to 17 we find exactly what's defined in the code.

Line 3 in the screen captures, with value 0xc9, is exactly what's assigned to buf[0]in the code.

  mode=0xc9; // Set static mode, display enabled, continuation enabled
  //...
  buf[0]=mode;

 

The only thing that may need some more clarification is the I2C address, on line 1.

We've set it to 0x38, but in the transfers there is 0x70.

That's part of the I2C protocol.

The address isn't 8 bit, but 7 bit.

That 7 bit value is appended with a read/write bit. 1 if we're reading, 0 if we're writing.

Because we're writing to the LCD, we append the address with a 0.

The value 0x38 left shifted and with the last bit set to 0 equals 0x70.

 

image

 

Related Blog
Building a Low Power Compact LCD Display - Port to Hercules Safety Microcontroller
Building a Low Power Compact LCD Display - I2C Traffic
Building a Low Power Compact LCD Display - Port to SimpleLink TI-RTOS
  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube