#include <m8c.h> // part specific constants and macros
#include "PSoCAPI.h" // PSoC API definitions for all User Modules
void main(void)
{
unsigned char port;
// M8C_EnableGInt ; // Uncomment this line to enable Global Interrupts
PRT1DM0=0X00;
PRT1DM1=0XFF;
PRT1DM2=0X00;
PRT1GS=0Xff;
PRT2DM0=0XFF;
PRT2DM1=0X00;
PRT2DM2=0X00;
PRT2GS=0X00;
port=PRT1DR;
PRT2DR=port;
// Insert your main routine code here.
}
a
我的程序是这样的,但是我在配置里没有改。他默认的端口配置是high z analog
然后我打开PSCConfigTBL.asm发现里面的代码如下:
LoadConfigTBL_pdproject25_Ordered:
; Ordered Global Register values
M8C_SetBank0
mov reg[00h], 00h ; Port_0_Data register (PRT0DR)
M8C_SetBank1
mov reg[00h], 00h ; Port_0_DriveMode_0 register (PRT0DM0)
mov reg[01h], ffh ; Port_0_DriveMode_1 register (PRT0DM1)
M8C_SetBank0
mov reg[03h], ffh ; Port_0_DriveMode_2 register (PRT0DM2)
mov reg[02h], 00h ; Port_0_GlobalSelect register (PRT0GS)
M8C_SetBank1
mov reg[02h], 00h ; Port_0_IntCtrl_0 register (PRT0IC0)
mov reg[03h], 00h ; Port_0_IntCtrl_1 register (PRT0IC1)
M8C_SetBank0
mov reg[01h], 00h ; Port_0_IntEn register (PRT0IE)
mov reg[04h], 00h ; Port_1_Data register (PRT1DR)
M8C_SetBank1
mov reg[04h], 00h ; Port_1_DriveMode_0 register (PRT1DM0)
mov reg[05h], ffh ; Port_1_DriveMode_1 register (PRT1DM1)
M8C_SetBank0
mov reg[07h], ffh ; Port_1_DriveMode_2 register (PRT1DM2)
mov reg[06h], 00h ; Port_1_GlobalSelect register (PRT1GS)
M8C_SetBank1
mov reg[06h], 00h ; Port_1_IntCtrl_0 register (PRT1IC0)
mov reg[07h], 00h ; Port_1_IntCtrl_1 register (PRT1IC1)
M8C_SetBank0
mov reg[05h], 00h ; Port_1_IntEn register (PRT1IE)
mov reg[08h], 00h ; Port_2_Data register (PRT2DR)
M8C_SetBank1
mov reg[08h], 00h ; Port_2_DriveMode_0 register (PRT2DM0)
mov reg[09h], ffh ; Port_2_DriveMode_1 register (PRT2DM1)
M8C_SetBank0
mov reg[0bh], ffh ; Port_2_DriveMode_2 register (PRT2DM2)
mov reg[0ah], 00h ; Port_2_GlobalSelect register (PRT2GS)
M8C_SetBank1
mov reg[0ah], 00h ; Port_2_IntCtrl_0 register (PRT2IC0)
mov reg[0bh], 00h ; Port_2_IntCtrl_1 register (PRT2IC1)
M8C_SetBank0
mov reg[09h], 00h ; Port_2_IntEn register (PRT2IE)
M8C_SetBank0
ret
上面表明模式还是在HIGH Z ANALOG . |