SD16A中的差分輸入口跟SD16AE不是一一對應的, A2輸入: SD16INCTL0 |= SD16INCH_2; SD16AE = SD16AE6 + SD16AE7; //A2輸入口為P1.6/P1.7 A3輸入: SD16INCTL0 |= SD16INCH_3; SD16AE = SD16AE4 + SD16AE5; //A3輸入口為P1.4/P1.5 A4輸入: SD16INCTL0 |= SD16INCH_4; SD16AE = SD16AE2 + SD16AE3; //A4輸入口為P1.2/P1.3 某大蝦的程序如下: 這是我寫的SD16A驅動程序中通道選擇的部分,把司馬大俠剩下的幾個通道補充完整了,呵呵 switch ( channel ) { case 0: SD16INCTL0 |= SD16INCH_0; P6SEL |= BIT1 | BIT0; break; case 1: SD16INCTL0 |= SD16INCH_1; P6SEL |= BIT3 | BIT2; break; case 2: SD16INCTL0 |= SD16INCH_2; SD16AE = SD16AE6 | SD16AE7; break; case 3: SD16INCTL0 |= SD16INCH_3; SD16AE = SD16AE4 | SD16AE5; break; case 4: SD16INCTL0 |= SD16INCH_4; SD16AE = SD16AE2 | SD16AE3; break; case 5: SD16INCTL0 |= SD16INCH_5; break; case 6: SD16INCTL0 |= SD16INCH_6; break; case 7: SD16INCTL0 |= SD16INCH_7; break; } |