dsPIC33FJ128MC708 的PORTB怪現象(Release時)
|
||||
---|---|---|---|---|
新會員
|
我使用APP026-2作硬體平台使用REAL ICE做除錯與燒錄,用MPLAB IDE 與C30寫一個程式,本來用Debugger模式RUN很正常,後來用Programmer去燒一切都不對了,查了兩天然後寫了最簡單的程式:
我將RE0~4接到LED1~4,RB0~4接到S1~4,在Dubugger時,未按下SW前LED都亮,按下SW後對應的LED熄滅-正常;選Programmer後用Release重新編譯並Program後就變成不管怎麼按SW,LED都是微微亮著, 我看過版上為何燒錄出來的IC不會動他是PORTB沒設定為Digital,可是我有設呀,而且我原本的程式與PORTB[0:7]無關的部分都正常運作。 Please help me,是哪個Reg也要設定嗎? 以下是最簡化的測試程式程式碼(有確認過CLOCK、GLD檔): #include <P33FJ128MC708.h> int main ( void ) { unsigned char longdata; AD1PCFGH = 0xffff; Nop( ); AD1PCFGL = 0xffff; Nop( ); TRISB = 0xffff; TRISE = 0xff00; LATB = 0xffff; LATE = 0xffff; Nop(); while(1){ longdata = PORTB; Nop(); PORTE = longdata; Nop(); } }
發表於: 2008/1/23 2:59
|
|||
|