Wyatte Ricks
Published

CY8C4247LQI-BL483 LCD and USS Project

LCD displaying the Ultra Sonic Sensors reading with Top Design, Pin layout, and code.

AdvancedShowcase (no instructions)4 hours65
CY8C4247LQI-BL483 LCD and USS Project

Things used in this project

Hardware components

Infineon CY8C4247LQI-BL483
×1
Ultrasonic Sensor - HC-SR04
SparkFun Ultrasonic Sensor - HC-SR04
×1
Jumper wires (generic)
Jumper wires (generic)
×1
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

PSoC Creator
Cypress PSoC Creator

Story

Read more

Schematics

Top Design

Simply you need the LCD char block and a UART if desired. Most importantly are the Trigger and Counter Blocks which are essential for the Ultra Sonic Sensor to work.

Pin Layout

https://www.infineon.com/dgdl/Infineon-Component_Character_LCD_(CharLCD)_V1.50-Software%20Module%20Datasheets-v02_02-EN.pdf?fileId=8ac78c8c7d0d8da4017d0e79469f097e

Datasheet for LCD in order to properly set up plug in pins from LCD display.

Trigger Block

Counter

System Settings

Bread Board Example

Code

Code

C#
Code with USS, UART, and LCD
/* ========================================
 *
 * Copyright YOUR COMPANY, THE YEAR
 * All Rights Reserved
 * UNPUBLISHED, LICENSED SOFTWARE.
 *
 * CONFIDENTIAL AND PROPRIETARY INFORMATION
 * WHICH IS THE PROPERTY OF your company.
 *
 * ========================================
*/
#include "project.h"
#include <stdio.h>
  
// set up variables for UART and Ultra Sonic Sensor

uint8 echo_flag = 0; 
uint16 echo_distance;
//char serial_output[20];
int dist =0;

//Interupt

CY_ISR( Timer_Int_Handler ) {
    // read centimeters
    echo_distance = Timer_Echo_ReadCapture();
    dist = echo_distance;
    echo_flag = 1;


    Timer_Echo_ClearInterrupt ( Timer_Echo_INTR_MASK_CC_MATCH );
}


  
int main(void)
{


    CyGlobalIntEnable; /* Enable global interrupts. */


    // Start up code - enable UART, PWM and Timer used for ultrasonic module
    LCD_Char_Start();
    LCD_Char_DisplayOn();
    Timer_Echo_Start();
    Timer_Echo_Start();
    PWM_Trigger_Start();
    PWM_Trigger_Init();
    //UART_Start();

    for(;;) {
    
    // Registration of Timer ISR

    Timer_Echo_Int_StartEx( Timer_Int_Handler );
    
        CyDelay(500);
        // if a distance was measured, print the distance and clear the flag
        /*sprintf(serial_output, "%d cm", dist);
        UART_UartPutString(serial_output);
        UART_UartPutCRLF(0u);*/
        
        //LCD Display 
        
        LCD_Char_ClearDisplay();
        LCD_Char_Position(0,0);
        LCD_Char_PrintString("PSoC SonicRANGER");
    
        LCD_Char_Position(1,0);
        LCD_Char_PrintString("Distance: ");
    
        LCD_Char_Position(1,10);
        LCD_Char_PrintNumber(dist);
    
        LCD_Char_Position(1,14);
        LCD_Char_PrintString("cm");

        CyGlobalIntDisable; /* Disable global interrupts, so the flag gets cleared. */
        echo_flag = 0;
        CyGlobalIntEnable; /* Enable global interrupts after the flag is cleared. */
    
 }
  
}
/* [] END OF FILE */

Credits

Wyatte Ricks

Wyatte Ricks

1 project • 1 follower

Comments