CPU电路图
显示电路控制板电路图程序#include // 包含型号头文件
本文引用地址:http://www.eepw.com.cn/article/201611/324014.htm//#include
#include // 包含"位"操作头文件#include #include #include #include #include #include #define uchar unsigned char#define uint unsigned int#define TRUE 1#define FALSE 0#define ad_Temp_flag 0x03 // 温度转换通道#define ad_Vout_flag 0x04 // 电压转换通道#define ad_Iout_flag 0x05 // 电流转换检测#define FAN_ON (PORTB_Bit3 = 1) // FAN 开#define FAN_OFF (PORTB_Bit3 = 0) // FAN 关#define D1_ON (PORTA_Bit0 = 0) // D1 开#define D1_OFF (PORTA_Bit0 = 1) // D1 关#define D2_ON (PORTA_Bit1 = 0) // D2 开#define D2_OFF (PORTA_Bit1 = 1) // D2 关#define D3_ON (PORTA_Bit2 = 0) // D3 开#define D3_OFF (PORTA_Bit2 = 1) // D3 关#define D4_ON (PORTB_Bit2 = 0) // D4 开#define D4_OFF (PORTB_Bit2 = 1) // D4 关#define D5_ON (PORTA_Bit6 = 0) // D5 开#define D5_OFF (PORTA_Bit6 = 1) // D5 关#define D6_ON (PORTA_Bit7 = 0) // D6 开#define D6_OFF (PORTA_Bit7 = 1) // D6 关#define DATA164_ON (PORTB_Bit1 = 1) // 74HC164 DATA=1#define DATA164_OFF (PORTB_Bit1 = 0) // 74HC164 DATA=0#define CLK164_ON (PORTB_Bit0 = 1) //#define CLK164_OFF (PORTB_Bit0 = 0) //#define Temp_out_lo 0x339 // -5℃ 41.56K #define Temp_out_hi 0x10e // 50℃ 3.588Kuint ad_Temp_result; // 温度转换结果uint ad_Vout_result; // 电压转换结果uint ad_Iout_result; // 电流转换结果uint Vout_disp;uint Iout_disp;uint Iout_adj;uchar time_cnt1;uchar adc_get_flag;//#pragma vector=0x10;//__interrupt void TIMER2_OVF_Server(void);void mcu_init(void); // I/O初始化,PWM初始化void adc_init(void); // ADC初始化uint adc_get(uchar adc_ch); // 启动AD转换,并返回转换值void Vout_adc_get(void); // 电压检测void Temp_adc_get(void); // 温度检测void Iout_adc_get(void); // 电流检测//数码管显示代码定义__flash uchar disp_led[10] @0x0040 ={ 0x0a, // 0 0x7b, // 1 0x4c, // 2 0x58, // 3 0x39, // 4 0x98, // 5 0x88, // 6 0x5b, // 7 0x08, // 8 0x18, // 9};
关键词:
单片机可控可调电