⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 m62354.c

📁 DA芯片M62354的驱动源程序。用于车载LCD TV系统。在实际系统中使用。
💻 C
字号:
/*******************************************************************************
**                            (c) Copyright 2004-2005, xujiajun
**                                    All Rights Reserved
**                                        V040723
**--------------文件信息--------------------------------------------------------
**创   建   人: 徐家俊
**创建日期: 2006年1月20日
**描        述:M62354驱动
**--------------版本修订历史----------------------------------------------------
** 修改人:徐家俊
** 版  本: V
** 日 期: 年月日
** 描 述:
**--------------当前版本修订----------------------------------------------------
** 修改人:徐家俊
** 版  本:
** 日 期:年月日
** 描 述:
**------------------------------------------------------------------------------
*******************************************************************************/
#define IN_M62354
#include"main.h"

#define _Nop_62354()   _nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_()
/*-----------------------------------------------------------------------------*/
/********************************************************************************************************
 Descriptions:          SEND_DATA_M62354
 input parameters:      Channel: 1 to 6. Data to DA
 Returned value:        None
 Used global variables: None
 Calling modules:       None
 Created by:            xjj 2006/01/20
-------------------------------------------------------------------------------------------------------
 Modified by:
********************************************************************************************************/
void SendDataTo62354(uchar Channel, uchar Data)
{
    uchar i;

    Channel &= 0x0f;
    M62354Ld_Port = 0;
    _Nop_62354();
    for(i=0;i<4;i++)
    {
        M62354Clk_Port = 0;
        if(Channel & 0x01)
            M62354Di_Port = 1;
        else
            M62354Di_Port = 0;
        _Nop_62354();
        M62354Clk_Port = 1;
        _Nop_62354();
        Channel >>= 1;
    }
    for(i=0;i<8;i++)
    {
        M62354Clk_Port = 0;
        if(Data & 0x80)
            M62354Di_Port = 1;
        else
            M62354Di_Port = 0;
        _Nop_62354();
        M62354Clk_Port = 1;
        _Nop_62354();
        Data <<= 1;
    }
    _Nop_62354();
    M62354Ld_Port = 1;
    M62354Ld_Port = 0;
    _Nop_62354();
    M62354Ld_Port = 1;
}
/********************************************************************************************************
 Descriptions:          Send Bright contrast color Data To 62354
 input parameters:      Channel: 1 to 6. Data to DA
 Returned value:        None
 Used global variables: None
 Calling modules:       None
 Created by:            xjj 2006/01/20
-------------------------------------------------------------------------------------------------------
 Modified by:
********************************************************************************************************/
void Send3SimTo62354(void)
{
    uchar temp;

    if(ucColor > 32)
        ucColor = 15;
    temp = ucColor*5;
    temp >>= 1;// 除2
    temp += 90;
    SendDataTo62354(COLOR_DA_ADDR, temp);

    if(ucContrast > 32)
        ucContrast = 15;
    temp = ucContrast*7/3 + 52;
    SendDataTo62354(CONTRAST_DA_ADDR, temp);

    if(ucBright > 32)
        ucBright = 15;
    temp = ucBright*7/9 + 90;
    SendDataTo62354(BRIGHT_DA_ADDR, temp);
}
/********************************************************************************************************
 Descriptions:          视频模式,包含对遥控信号的响应,OSD显示,
                        送数到M62354(明亮、柔和、自定义)
 input parameters:      None
 Returned value:        None
 Used global variables: None
 Calling modules:       Remoter,OSD,M62354
 Created by:            xjj 2006/01/20
-------------------------------------------------------------------------------------------------------
 Modified by:
********************************************************************************************************/
void VideoModelSelect(void)
{
    uchar Buf[12];

    if(ucRemValue == REM_MODEL)
    {
        ucRemValue = REM_INVALID;
        ucRemShadow = REM_INVALID;
        ucOSDAutoClearTime = OSD_AUTO_CLEAR_TIME;
        switch(ucVideoModel)
        {
            case CUSTOM:
            {
                ucVideoModel = BRIGHTNESS;
                break;
            }//the end of case
            case BRIGHTNESS:
            {
                ucVideoModel = SOFTNESS;
                break;
            }//the end of case
            case SOFTNESS:
            {
                ucVideoModel = CUSTOM;
                break;
            }//the end of case
            default:
            {
                ucVideoModel = CUSTOM;
            }
        }//the end of switch
        
        //display by the OSD when status changed
        switch(ucVideoModel)
        {
            case CUSTOM:
            {
                Buf[0] = OSD_ADDR_ROW_8;
                Buf[1] = OSD_COLUMN_10;
                Buf[2] = OSD_NC;
                Buf[3] = OSD_NC;
                Buf[4] = OSD_C;
                Buf[5] = OSD_U;
                Buf[6] = OSD_S;
                Buf[7] = OSD_T;
                Buf[8] = OSD_0;
                Buf[9] = OSD_M;
                Buf[10] = OSD_NC;
                Buf[11] = OSD_NC;
                ISendStr(MTV018_ADDR,Buf[0],&Buf[1],11);
                break;
            }//the end of case
            case BRIGHTNESS:
            {
                Buf[0] = OSD_ADDR_ROW_8;
                Buf[1] = OSD_COLUMN_10 ;
                Buf[2] = OSD_B         ;
                Buf[3] = OSD_R         ;
                Buf[4] = OSD_I         ;
                Buf[5] = OSD_G         ;
                Buf[6] = OSD_H         ;
                Buf[7] = OSD_T         ;
                Buf[8] = OSD_N         ;
                Buf[9] = OSD_E         ;
                Buf[10] =OSD_S         ;
                Buf[11] =OSD_S         ;
                ISendStr(MTV018_ADDR,Buf[0],&Buf[1],11);
                break;
            }//the end of case
            case SOFTNESS:
            {
                Buf[0] =   OSD_ADDR_ROW_8;
                Buf[1] =   OSD_COLUMN_10 ;
                Buf[2] =   OSD_NC        ;
                Buf[3] =   OSD_S         ;
                Buf[4] =   OSD_0         ;
                Buf[5] =   OSD_F         ;
                Buf[6] =   OSD_T         ;
                Buf[7] =   OSD_N         ;
                Buf[8] =   OSD_E         ;
                Buf[9] =   OSD_S         ;
                Buf[10] =  OSD_S         ;
                Buf[11] =  OSD_NC        ;
                ISendStr(MTV018_ADDR,Buf[0],&Buf[1],11);
                break;
            }//the end of case
        }//the end of switch
        Buf[0] = OSD_ATTR_ROW_8;
        Buf[1] = OSD_COLUMN_10;
        Buf[2] = 0x02;
        Buf[3] = 0x02;
        Buf[4] = 0x02;
        Buf[5] = 0x02;
        Buf[6] = 0x02;
        Buf[7] = 0x02;
        Buf[8] = 0x02;
        Buf[9] = 0x02;
        Buf[10] = 0x02;
        Buf[11] = 0x02;
        ISendStr(MTV018_ADDR,Buf[0],&Buf[1],11);
    }//if(ucRemValue == REM_MODEL)

    //send the data to M62354
    switch(ucVideoModel)
    {
        case CUSTOM:
        {
            Send3SimTo62354();
            break;
        }//the end of case
        case BRIGHTNESS:
        {
            Buf[0] = ucColor;
            Buf[1] = ucContrast;
            Buf[2] = ucBright;
            ucColor = 27;
            ucContrast = 30;
            ucBright =27;
            Send3SimTo62354();
            ucColor = Buf[0];
            ucContrast = Buf[1];
            ucBright = Buf[2];
            break;
        }//the end of case
        case SOFTNESS:
        {
            Buf[0] = ucColor;
            Buf[1] = ucContrast;
            Buf[2] = ucBright;
            ucColor = 24;
            ucContrast = 14;
            ucBright = 16;
            Send3SimTo62354();
            ucColor = Buf[0];
            ucContrast = Buf[1];
            ucBright = Buf[2];
            break;
        }//the end of case
    }//the end of switch
}






⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -