- 打卡等级:初来乍到
- 打卡总天数:7
- 最近打卡:2024-07-14 13:13:18
注册会员
- 积分
- 128
|
发表于 2024-7-10 23:28:29
|
显示全部楼层
#define ntc_switc_on() do{P1_mode_out_pp(pin_5); P15 = 1;} while(0)
#define ntc_switc_off() do{P1_mode_out_pp(pin_5); P15 = 0;} while(0)
#define pin_0 0x01 //IO引脚 Px.0
#define pin_1 0x02 //IO引脚 Px.1
#define pin_2 0x04 //IO引脚 Px.2
#define pin_3 0x08 //IO引脚 Px.3
#define pin_4 0x10 //IO引脚 Px.4
#define pin_5 0x20 //IO引脚 Px.5 //0x05
#define pin_6 0x40 //IO引脚 Px.6
#define pin_7 0x80 //IO引脚 Px.7
#define pin_low 0x0F //IO低4位引脚
#define pin_high 0xF0 //IO高4位引脚
#define pin_all 0xFF //IO所有引脚
#define P0_mode_out_pp(Pin) P0M1 &= ~(Pin), P0M0 |= (Pin);
#define P1_mode_out_pp(Pin) P1M1 &= ~(Pin), P1M0 |= (Pin);
#define P2_mode_out_pp(Pin) P2M1 &= ~(Pin), P2M0 |= (Pin);
#define P3_mode_out_pp(Pin) P3M1 &= ~(Pin), P3M0 |= (Pin);
#define P4_mode_out_pp(Pin) P4M1 &= ~(Pin), P4M0 |= (Pin);
#define P5_mode_out_pp(Pin) P5M1 &= ~(Pin), P5M0 |= (Pin);
#define P6_mode_out_pp(Pin) P6M1 &= ~(Pin), P6M0 |= (Pin);
#define P7_mode_out_pp(Pin) P7M1 &= ~(Pin), P7M0 |= (Pin);
问题解决 注意上面的宏定义 这里pin_5 不能简单随手写成5 因为0x05 等于 0x04 + 0x01 也就导致P10口的上拉被使能 然后跟随器的输出一半VCC 再和上拉的4.7K分电源电压 等于2.4V{:5_270:} |
|