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

📄 config.cwg

📁 语音信号加密
💻 CWG
字号:
/////////////////////////////////////
//  Generated Initialization File  //
/////////////////////////////////////

#include "c8051F020.h"

// Peripheral specific initialization functions,
// Called from the Init_Device() function
void Reset_Sources_Init()
{
    WDTCN     = 0xFF;
}

void Timer_Init()
{
    TMOD      = 0x10;
    T2CON     = 0x04;
    RCAP2L    = 0xAF;
    RCAP2H    = 0x3C;
    TL2       = 0xAF;
    TH2       = 0x3C;
}

void ADC_Init()
{
    ADC0CN    = 0xCD;
}

void DAC_Init()
{
    DAC0CN    = 0x80;
}

void Comparator_Init()
{
    int i = 0;
    CPT0CN    = 0x85;
    for (i = 0; i < 60; i++);  // Wait 20us for initialization
    CPT0CN    &= ~0x30;
}

void Voltage_Reference_Init()
{
    REF0CN    = 0x03;
}

void Port_IO_Init()
{
    P0MDOUT   = 0xFF;
    P1MDOUT   = 0xFF;
    P2MDOUT   = 0xFF;
    P3MDOUT   = 0xFF;
    XBR2      = 0x40;
}

void Oscillator_Init()
{
    int i = 0;
    OSCXCN    = 0x67;
    for (i = 0; i < 3000; i++);  // Wait 1ms for initialization
    while ((OSCXCN & 0x80) == 0);
    OSCICN    = 0x0C;
}

void Interrupts_Init()
{
    IE        = 0xA0;
    IP        = 0x20;
}

// Initialization function for device,
// Call Init_Device() from your main program
void Init_Device(void)
{
    Oscillator_Init();
	Reset_Sources_Init();
    Timer_Init();
    ADC_Init();
    DAC_Init();
    Comparator_Init();
    Voltage_Reference_Init();
    Port_IO_Init();
    Interrupts_Init();
}

void timer2int(void);
sbit txen=P3^3;

void main (void) {
 
   Init_Device();                     // initialize oscillator
   txen=0;
   while (1);
}

void timer2int(void) interrupt 5
{
  
} 

⌨️ 快捷键说明

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