Example #1
0
int main()
{    
    uint8 ch;           /* Data sent on the serial port */
    uint8 count = 0u;    /* Initializing the count value */
    uint8 pos = 0u;

    CyGlobalIntEnable; 

    isr_1_Start();      /* Initializing the ISR */
    UART_1_Start();     /* Enabling the UART */
    LCD_Char_1_Start(); /* Enabling the LCD */

        
    for(ch = START_CHAR_VALUE; ch <= END_CHAR_VALUE; ch++)
    {
        UART_1_WriteTxData(ch); /* Sending the data */

        count++;        
        if(count % LCD_NUM_COLUMNS == 0u) /* If the count value reaches the count 16 start from first location */
        {
            pos = 0u;  /* resets the count value */
            LCD_Char_1_WriteControl(LCD_Char_1_CLEAR_DISPLAY); /* Display will be cleared when reached count value 16 */
        }    

        LCD_Char_1_Position(0u, pos++);   /* LCD position to the count++ */
        LCD_Char_1_PutChar(ch);         /* print the value in the LCD */
                
        LCD_Char_1_Position(1u, 0u);
        LCD_Char_1_PrintInt8(count);    /* prints the count in the LCD */
        CyDelay(200u);
    }

    for(;;) {}
}
Example #2
0
/*******************************************************************************
* Function Name: main
********************************************************************************
*
* Summary:
*  Main function performs following functions:
*   1: Initializes the LCD
*   2: Get the temperature of the Die
*   3: Print the Die Temperature value in LCD
*   4: Print the Status value in the LCD
*
* Parameters:
*  None.
*
* Return:
*  None.
*
*******************************************************************************/
int main()
{
    cystatus Status;
    int16 temperature;

    /* Initializing the LCD */
    LCD_Char_1_Start();

    while(1)
    {
        /* Providing some delay */
        CyDelay(50);

        /* Reading the Die Temperature value */
        Status = DieTemp_1_GetTemp(&temperature);
       

        /* Displaying the Die Temperature value on the LCD */
        LCD_Char_1_Position(0u, 0u);
        LCD_Char_1_PrintString("Temp = ");

        if (temperature >= 0)
        {
            LCD_Char_1_PrintString("+");
        }
        else
        {
            /* If the temperature value is negative, display "-" sign and make value positive */
            LCD_Char_1_PrintString("-");
            temperature = (uint16)(~temperature + 1u);
        }
        
        LCD_Char_1_PrintNumber((uint16) (temperature));
        LCD_Char_1_PrintString(" ");
        
        LCD_Char_1_PutChar(LCD_Char_1_CUSTOM_7);
        LCD_Char_1_PrintString("C");

        /* Displaying the status value on the LCD */
        LCD_Char_1_Position(1u, 0u);
        LCD_Char_1_PrintString("Status = ");
        LCD_Char_1_PrintInt8((uint8) Status);
    }
}