Re: 使用 hex 燒錄 無法動作
|
||||
---|---|---|---|---|
初級會員
|
確認一下PIC單晶片的燒錄設定,以PIC12F675為例,如下:
1. Oscillator, 選擇Internal RC No Clock 。 2. Watch Dog, 若程式中有CLRWDT指令出現,則設定為ON 。 3. Power Up Timer, 設定為ON 。 4. Master Clear Enable, 設定為External 。 5. Brown Out Detect, 設定為ON 。 6. Code Protect, 設定為OFF 。 7. Data EE Read Protect, 設定為OFF 。 Try Run看看是否能解決PIC單晶片無法正常動作的問題。
發表於: 2007/2/27 9:12
|
|||
|
Re: 請問關於adcresh.adcresl...和retlw的小問題
|
||||
---|---|---|---|---|
初級會員
|
RETLW B'01100000' ;1
上一行指的是查表的return值. 在查表結束後跳回到主程式之前,會把B'01100000'存放在W暫存器內,回主程式之後可直接讀取W暫存器的值來使用. ;1 而分號後面的內容是程式之註解,在程式做組譯時會將其忽略視而不見
發表於: 2007/2/13 9:07
|
|||
|
Re: 請問關於adcresh.adcresl...和retlw的小問題
|
||||
---|---|---|---|---|
初級會員
|
將ADCON1的ADFM設為1 (A/D結果會從ADRESL的最低位元開始填).
當A/D轉換完成後,要'手動'將ADRESL與ADRESH讀出來才可使用,程式碼如下: LOOP: BTFSC ADCON0,GO GOTO LOOP ; GO=1表示尚未完成 BANKSEL ADRESL MOVF ADRESL,W ; 讀取A/D結果的低位元組 BANKSEL DATBF1 MOVWF DATBF1 ; 儲存A/D結果之低位元組 MOVF ADRESH,W ; 讀取A/D結果的高位元組部分,以及6個0 MOVWF DATBF2 ; 儲存A/D結果之高位元組 以上的A/D為10位元取樣,得到的值為0000H ~ 03FFH(10進制表示即為0 ~1023)
發表於: 2007/2/13 8:40
|
|||
|
Re: 如何偵測風扇轉速
|
||||
---|---|---|---|---|
初級會員
|
假設你的Timer是每40us, 計時值就上數+1
公式如下: 轉速RPM = 60 ÷ (週期 × 40us) 單位是rpm(每分鐘的轉數)
發表於: 2007/2/9 9:46
|
|||
|
Re: Wake UP from Hardware UART?
|
||||
---|---|---|---|---|
初級會員
|
During Sleep mode, all clocks to the EUSART are
suspended. Because of this, the Baud Rate Generator is inactive and a proper character reception cannot be performed. The Auto-Wake-up feature allows the controller to wake-up due to activity on the RX/DT line. This feature is available only in Asynchronous mode. The Auto-Wake-up feature is enabled by setting the WUE bit of the BAUDCTL register. Once set, the normal receive sequence on RX/DT is disabled and the EUSART remains in an Idle state, monitoring for a wakeup event independent of the CPU mode. A wake-up event consists of a high-to-low transition on the RX/DT line.
發表於: 2007/2/9 9:38
|
|||
|
Re: 請問 RB PORT 中斷
|
||||
---|---|---|---|---|
初級會員
|
引用Datasheet, 說明如下:
PORTB 埠的4 個引腳RB7:RB4,有電位變化中斷的特性。只有引腳配置爲"輸入"時才能産生中斷(即,RB7:RB4 中任一配置爲輸出的引腳都沒有電位變化中斷比較功能)。輸入引腳RB7:RB4 的當前值與上次讀PORTB 時鎖存的舊值比較,RB7:RB4 的“不匹配”輸出相或,産生RB 埠電位變化中斷,並將旗標位元RBIF(INTCON<0>)設為1。
發表於: 2007/2/9 9:14
|
|||
|
Re: 關於外部按鍵控制的問題
|
||||
---|---|---|---|---|
初級會員
|
程式的上邏輯是ok的, 不過有個小地方要注意, 程式一開始定義I/O PORT只要執行一次就可, 以免I/O PORT被強制恢復為初始化值, 而產生I/O PORT動作不正確。
以下對你的程式稍作修改, 修改之處會有註解, 如下: org 0x00 nop goto main main: banksel TRISB movlw 0xff movwf TRISB banksel PORTB clrf PORTB banksel TRISC clrf TRISC banksel PORTC clrf PORTC movlw b'00000110' movwf PORTC goto start start: btfsc PORTB, 1 call delay_4ms btfsc PORTB, 1 goto start ; 在start內一直偵測, 即可判斷到RB1的狀態. goto red red: call delay_5ms movlw b'00000001' movwf PORTC call delay_5ms goto red delay_5ms: 省略 return delay_4ms: 省略 return end
發表於: 2007/2/9 9:06
|
|||
|
Re: PIC16F877燒錄!!!
|
||||
---|---|---|---|---|
初級會員
|
發表於: 2007/1/25 13:10
|
|||
|
Re: PIC16F877燒錄!!!
|
||||
---|---|---|---|---|
初級會員
|
以目前單晶片燒錄的方法,是必須透過燒錄器來進行.HEX的載入程序,也就是由燒錄器對MCLR這隻PIN腳做RESET之後,再進入燒錄模式中,藉由RS232介面來載入.HEX 。
所以要用電腦寫一套控制程式,去執行上述的載入流程,要留意的重點是,要知道PIC單晶片的ICSP的通訊協定(Protocol),才有辦法寫這支控制程式。
發表於: 2007/1/25 11:56
|
|||
|