8 Replies Latest reply on Mar 14, 2015 1:02 AM by dilipkumarmn

    PSoC 4 Pioneer Kit Community Project#062 – Ready…Set…GO! PSoC Stopwatch

    cy.wbz

      Hello!

       

      In this example we are looking to expand on our earlier graphical displays by creating a stop watch. Our various LCD and GLCD examples try to cover a wide range of display options available to users. In this example we use an I2C based character LCD modules. For this project we will use the I2C Character LCD component, which allows the customer to control the Character LCD with 2 pins instead of the typical 7 required by our Parallel Character LCD component. For this example we use a Serial LCD 16x2 Blue and White LCD for Arduino kits.

       

      001 - Schematic Capture.PNG

       

      Forum Post Attachments:

       

      At the bottom of this post we are including the following items:

      • Example Project Zip File
      • Zip File of Images
        • Project Schematic
        • Component Configurations

       

      Components Used:

       

      The user can download the example project at the bottom of this post. The project uses the following list of Creator Components:

      • I2C (Master mode)
      • TCPWM
      • CyClock
      • I2C Character LCD
      • Debouncer
      • ISR
      • CyPins

       

      Firmware Description:

       

      The main.c firmware is included in the example project. Please review the commented sections for more details.

       

      The example projects uses the SCL/SDA pins on the Kit to control the LCD (via the breadboard as the shield doesn’t have a connection to SCL/SDA) and the SW2 on the Kit to control the stopwatch.

       

      Any I2C Character LCD should be possible given the flexibility of the provided component in the catalog.

      To setup your LCD, you will need the datasheet to be able to enter the I2C address for the LCD on the General tab of the I2C LCD component.  Unless you are able to locate a NXP PCF2119x LCD, the Command format entry on the customizer should be configured for Custom format, which will enable the fields on the Custom Commands tab.  In that tab, again from the datasheet, you will need to modify the commands to match the byte sequences defined for the device.  You can also specify additional commands (in this example we added the SetContrast and SetBrightness APIs) to control any extra functionality your I2C LCD may have that you wish to utilize.

       

      The setup of the firmware will update the display every other millisecond and move the bouncing dot at the top of the display approximately every 33ms.  Pushing SW2 on the kit will clear and start the timer, pushing it again will stop the timer and the animation at the top of the display.

       

      Hardware Connections:

       

      Please connect a simple Breadboarding shield to the Pioneer kit. Then connect the LCD display to the Breadboard. In this example we use the SainSmart prototyping shield.

       

      running_image.JPG

       

      stopped_image.JPG

       

      Test Your Project:

       

      Connect your I2C display and program the Pioneer kit with the example. The setup of the firmware will update the display every other millisecond and move the bouncing dot at the top of the display approximately every 33ms.  Pushing SW2 on the kit will clear and start the timer, pushing it again will stop the timer and the animation at the top of the display.

       

      I hope this example can help you in your design.

       

      Best,

      Matt