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

📄 main.c

📁 PHILIPS LPC76X Comparator
💻 C
字号:
    #include <REG768.H>

    void main (void)
    {
        unsigned char i;

    /************************************************
    Set CIN1A(P0^4) and CIN2A(P0^2 as Input Only and
    CMP1 Out(P0^6) and CMP2 Out(P0^0) as Push-Pull
    Output
    ************************************************/

        P0M2 &= ~0x14;  // Set P0^4 and P0^2 Input Only
        P0M1 |=  0x14;  // Disable Dig Out on Cmp Input pins.
        PT0AD =  0x14;  // Disable Digital Input on CMP pins.

    /****************************************************
    Enable the Comparator 1 with Pos In on CIN1A and
    Neg In from internal Vref of 1.28V.
    ****************************************************/
        CMP1  = 0x2C;
   
    /****************************************************
    Enable the Comparator 2 with Pos In on CIN2A and
    Neg In from external CMPREF.
    ****************************************************/
        CMP2  = 0x24;

    /********************************************************
    Delay 10uSec to allow comparator to stabilize
    ********************************************************/
        for (i=0; i<= 10; i++);    // Do nothing delay 10uSec
        while(1)
        {
            ;  // Loop Forever
            ;  // Your software here 
        }
    }

⌨️ 快捷键说明

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