Re: PIC16F84A的IO無法pushdown.
|
||||
---|---|---|---|---|
新會員
|
多謝了! 問題真是出在ISR裡面。
另外, 我用的mplab v7.6, 有時指令會show 藍色, 有時show紫色, 是不是可以設定呢? 謝謝,
發表於: 2007/5/30 19:31
|
|||
|
PIC16F84A的IO無法pushdown.
|
||||
---|---|---|---|---|
新會員
|
我寫了一段程式, 邏輯沒錯, 卻無法正確執行, 我對portb寫入0, 量portb電位, 才發現portb的電位沒有拉到Low,請問是什麼原因, 我的程式只是寫入0fh, f0h而已, 如下:
__config _XT_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF list p=16F84A ; Include file, change directory if needed include "p16f84a.inc" ;********************************************************** ;Variables ;********************************************************** org 0x10 temp_a = H'0c' temp_b = H'0d' flash_bit = H'0e' push_b = H'0f' delay = H'10' bit_count = H'11' word_count = H'12' rx = H'13' user = H'14' ;user name: reserve 6 bytes for "BONBON" id = H'1a' ;ID : reserve 8 bytes for "CR-V KEY" succeed = H'22' temp_status = H'23' temp_w = H'24' ten_time = H'25' ;********************************************************** ; Start at the reset vector ;********************************************************** org 0x000 nop goto Start org 0x004 ;======================================================== ;Timer0 ;======================================================== TIMER0 movwf temp_w movlw STATUS movwf temp_status decfsz ten_time, 1 goto _ten_time movlw H'ff' xorwf flash_bit,1 _ten_time bsf STATUS,RP0 btfss INTCON, T0IF goto _End_TIMER0 bcf INTCON,T0IF ; 清除計時器中斷旗號 _End_TIMER0 bcf STATUS,RP0 movlw temp_status movwf STATUS movlw temp_w retfie ;======================================================== ;Initial Timer0 ;======================================================== InitTimer bsf STATUS,RP0 bcf OPTION_REG,T0CS ; 開始振盪器脈波輸入 bcf OPTION_REG,PSA ; 設定使用脈波預除器 bsf INTCON,GIE ; 打開全域中斷開關(中斷總開關) bcf INTCON,T0IF ; 清除計時器中斷旗號 movlw H'00' andwf OPTION_REG, 1 movlw H'04' iorwf OPTION_REG, 1 bcf STATUS,RP0 retlw 0 ;======================================================== ;Start Timer0 ;======================================================== StartTimer bsf STATUS,RP0 bcf OPTION_REG,T0CS ; 設定振盪器脈波輸入(1/4 osc) bsf INTCON,T0IE ; 打開計時器中斷 bcf STATUS,RP0 retlw 0 ;********************************************************** ; Start at the reset vector ;********************************************************** Start bsf STATUS, RP0 movlw H'00' movwf TRISB ;PORTB all outputs movlw H'FF' movwf TRISA ;PORTA ALL IN bcf STATUS, RP0 movlw H'00' movwf PORTB movlw H'ff' movwf PORTA clrf INTCON call InitTimer call StartTimer ;Enable INT _Main btfsc flash_bit, 0 goto _rev movlw H'7f' movwf PORTB goto _Main _rev movlw H'fe' movwf PORTB goto _Main ;Do it again end
發表於: 2007/5/29 20:36
|
|||
|