1
我使用圖片18f14k50,我正在嘗試一個簡單的測試。只要讓LED閃爍。事情是,我已經將ANSEL,ANSELH,ADCON1等都設置爲0,並且將所有端口都設置爲輸出。但我還沒有看到和LED閃爍。pic18f14k50不輸出
這裏去的代碼(我用的MicroC)
void main() {
TRISA = 0; // set direction to be output
TRISB = 0; // set direction to be output
TRISC = 0; // set direction to be output
ANSEL = 0;
ANSELH = 0;
IOCA = 0;
IOCB = 0;
CM2CON0.C2ON = 0;
CM1CON0.C1ON = 0;
ADCON1 = 0;
//PORTC = 0xFF;
while(1){
LATA = 0x00; // Turn OFF LEDs on PORTA
LATB = 0x00; // Turn OFF LEDs on PORTB
LATC = 0x00; // Turn OFF LEDs on PORTC
delay_ms(1000); // 1 second delay
LATA = 0xFF; // Turn ON LEDs on PORTA
LATB = 0xFF; // Turn ON LEDs on PORTB
LATC = 0xFF; // Turn ON LEDs on PORTC
delay_ms(1000); // 1 second delay
} // Endless loop
}
感謝所有幫助!