Regarding 7 segment display of pressure value.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
suto_2664507
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

I would like to display the pressure from ADC_DelSig_ 1 to LED_Driver_ 1, but please let me know what kind of function should be used. The 7 segments have 4 digits, but the display uses 3 digits from the right.

LED_Driver_1_Start();             /* 7セグ  初期化                              */
LED_Driver_1_WriteString7Seg( "PSoC",0 );        /* 7セグ  文字列の表示                        */
// LED_Driver_1_Write7SegDigitHex( 0x01,3 );        /* 7セグ  HEX表示                             */
CyDelay(2000);               /* 2SEC 待ち                                 */

  LED_Driver_1_SetDisplayRAM( 0xFF,0 );         /* 7セグ  HEX表示 4桁                         */
LED_Driver_1_SetDisplayRAM( 0xFF,1 );               /* 7セグ  HEX表示 3桁                         */
LED_Driver_1_SetDisplayRAM( 0xFF,2 );               /* 7セグ  HEX表示 2桁                         */
LED_Driver_1_SetDisplayRAM( 0x7F,3 );               /* 7セグ  HEX表示 1桁                         */
tim_cnt1 = 500;               /* 0.5SEC 待ち                               */
dev_rtry   = 3;               /* デバイス情報取得リトライカウント設定                */

    /* Initialize Variables */
    ContinuouslySendData = FALSE;
    SendSingleByte = FALSE;
    SendEmulatedData = FALSE;
    EmulatedData = 0;
   
    /* Start the ADC conversion */
    ADC_DelSig_1_StartConvert();
   
    /* Send message to verify COM port is connected properly */
          
    if(ADC_DelSig_1_IsEndConversion(ADC_DelSig_1_RETURN_STATUS))
        {
            /* Use the GetResult16 API to get an 8 bit unsigned result in
             * single ended mode.  The API CountsTo_mVolts is then used
             * to convert the ADC counts into mV before transmitting via
             * the UART.  See the datasheet API description for more
             * details */
            Output = ADC_DelSig_1_CountsTo_mVolts(ADC_DelSig_1_GetResult16());
           
            /* Send data based on last UART command */
            if(SendSingleByte || ContinuouslySendData)
            {
                float inputRange=4.0-0.8;                                   // 入力電圧の幅                   
                float outputRange=5.0-0.0;                                  // 出力パルス(MPascal)の幅
                float inputVoltage=Output/1000.0;                           // Outputは入力電圧をmVで表しているので、1000.0で割ってVに変換
                float pascal=(inputVoltage-0.8)*outputRange/inputRange;     // 入力が0.8Vのとき0.0MPascal、4.0Vのとき5.0MPascalを出力
                /* Format ADC result for transmition */
                sprintf(TransmitBuffer, "Sample: %lu mV %6.3f MPa\r\n", Output, pascal); // パスカル表示を追加
            }
        }
    }
}キャプチャ01.JPG

0 Likes
1 Reply
Anonymous
Not applicable

There are three ways to display it.

1.Using the segment LED

2. Use the segment LCD as shown below

http://www.cypress.com/documentation/development-kitsboards/cy8ckit-029-psoc-lcd-segment-drive-expan...

3. Using the character LCD

0 Likes