• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
:::

論壇索引


Board index » All Posts




Re: PIC18F452 EEPROM 自動Reset
初級會員
初級會員


使用bootloader後就沒有用icd2了。

目前發現bo目前發現bootloader及icp的程式還在,但是eeprom的最後一個byte被還原為ff了,原因不明。



發表於: 2005/1/11 15:54
頂部


Re: 如何以C18撰寫一從獨立之16進制檔內(如檔名為abc.HEX而非將內容貼在主程式內)抓取資料並由IO Port 1個Byte接一個Byte送出
初級會員
初級會員


我指的是組譯時連同該16進制檔的內容一起組譯,讓該16進制資料檔成為ROM區間的一部分資料

發表於: 2005/1/11 15:45
頂部


Re: 关于PIC16F917
高級會員
高級會員


其實參考其它元件的設定方式 , 就像RY大大說的加入這些參數 , 那把F917自己較特殊的定義自己寫上去就可以了 ,

發表於: 2005/1/11 14:54
頂部


Re: PIC16F716的ADC問題
高級會員
高級會員


有幾個疑問 , 你的ADC讀完後是否有什麼判斷流程 ? 會不會是ADC大於你的判定值就跳錯程式區 ?

用ICD2看看就知道當在那了,

發表於: 2005/1/11 14:47
頂部


Re: p16f877, 關TMR1中斷使用問題
新會員
新會員


謝謝指導。仍無法找到問題所在。
此為範例程式
因配合bootloader,所以:
reset vector 設在0x10, 而interrupt vector設在0x14
其中macro是將W_reg及STATUS狀態先暫存,待程式執行完後
再回存。
在interrupt子程式中只有T1_Int有程式,作為測式TMR1 Interrupt用。

請再次不吝指教。

list p=16f877,r=dec
#include "p16f877.inc"
#include "mymacro.mac"

;******* Define variables here *************

W_Temp equ 0x21
STATUS_Temp equ 0x22
Counter equ 0x23


;******* Start and Interrupt vector *************

org 0x10 ; reset vector
goto Main_Program

org 0x14
goto Int_Service ; interrupt vector

;******* Main Process 'Start' *******************

Main_Program:
call Initial

Main_Program_End:
goto Main_Program_End

;******* Main Process 'End' *********************
;------------------------------------------------
;******* Program Test 'Start' *******************

Program_Test:

Program_Test_End:
return

;******* Program Test 'End' *********************
;------------------------------------------------
;******* Function Call 'Start' ******************

Function_Test:

;------------------------------------------------

Time_Ini:
banksel TMR1H
movlw 0xff
movwf TMR1H
movlw 0xee
movwf TMR1L
return

;------------------------------------------------

Function_Test_End:
retlw 0

;******* Function Call 'End' ********************
;------------------------------------------------
;******* Initial System 'Start' *****************

Initial:
banksel TRISD
clrf TRISD
banksel PORTD
movlw 0x01
movwf PORTD
movlw 0x00
movwf T1CON
clrf Counter
call Time_Ini
banksel INTCON
bsf INTCON, GIE
bsf INTCON, PEIE
banksel PIE1
bsf PIE1,TMR1IE
banksel T1CON
bsf T1CON,TMR1ON

Initial_End:
return

;******* Initial System 'End' *******************
;------------------------------------------------
;******* Interrupt Service 'Start' **************

Int_Service:
PUSH_W_STATUS W_Temp,STATUS_Temp ;Macro

;******* Check interrupt source **************

btfsc INTCON,INTF
goto EX_Int
btfsc INTCON,T0IF
goto T0_Int
btfsc INTCON,RBIF
goto RB_Int

; peripheral 1 interrupt *********************

banksel PIR1
btfsc PIR1,TMR1IF
goto T1_Int
btfsc PIR1,TMR2IF
goto T2_Int
btfsc PIR1,CCP1IF
goto CCP1_Int
btfsc PIR1,SSPIF
goto SSP_Int
btfsc PIR1,TXIF
goto TX_Int
btfsc PIR1,RCIF
goto RC_Int
btfsc PIR1,ADIF
goto AD_Int
btfsc PIR1,PSPIF
goto PSP_Int

; peripheral 2 interrupt *********************

btfsc PIR2,CCP2IF
goto CCP2_Int
btfsc PIR2,BCLIF
goto BCL_Int
btfsc PIR2,EEIF
goto EE_Int

;---------------------------------------------
; Interrupt Service routine ******************

EX_Int:
;******* add your code here ******************

;---------------------------------------------
bcf INTCON,INTF
goto Int_Service_End

T0_Int:
;******* add your code here ******************


;---------------------------------------------

bcf INTCON,T0IF
goto Int_Service_End

RB_Int:
;******* add your code here ******************

;---------------------------------------------
bcf INTCON,RBIF
goto Int_Service_End

T1_Int:
;******* add your code here ******************

call Time_Ini
incf Counter,F
movf Counter,W
sublw 0xa4
btfss STATUS,Z
goto T1_Int_End
bcf STATUS,C
rlf PORTD,W
rlf PORTD,F
clrf Counter

;---------------------------------------------

T1_Int_End:
bcf PIR1,TMR1IF
goto Int_Service_End

T2_Int:
;******* add your code here ******************


;---------------------------------------------
bcf PIR1,TMR2IF
goto Int_Service_End

CCP1_Int:
;******* add your code here ******************

;---------------------------------------------
bcf PIR1,CCP1IF
goto Int_Service_End

SSP_Int:
;******* add your code here ******************

;---------------------------------------------
bcf PIR1,SSPIF
goto Int_Service_End

TX_Int:
;******* add your code here ******************

;---------------------------------------------
bcf PIR1,TXIF
goto Int_Service_End

RC_Int:
;******* add your code here ******************

;---------------------------------------------
bcf PIR1,RCIF
goto Int_Service_End

AD_Int:
;******* add your code here ******************

;---------------------------------------------
bcf PIR1,ADIF
goto Int_Service_End

PSP_Int:
;******* add your code here ******************

;---------------------------------------------
bcf PIR1,PSPIF
goto Int_Service_End

CCP2_Int:
;******* add your code here ******************

;---------------------------------------------
bcf PIR2,CCP2IF
goto Int_Service_End

BCL_Int:
;******* add your code here ******************

;---------------------------------------------
bcf PIR2,BCLIF
goto Int_Service_End

EE_Int:
;******* add your code here ******************

;---------------------------------------------
bcf PIR2,EEIF
goto Int_Service_End

;---------------------------------------------
POP_W_STATUS W_Temp,STATUS_Temp ;Macro

Int_Service_End:
retfie

;******* Interrupt Service 'End' ****************
;------------------------------------------------

end

發表於: 2005/1/11 14:30
頂部


Re: 請問MPLAB C30和MBLAB IDE有何不同?
版主
版主


MPLAB IDE 是寫程式及除錯平台

MPLAB C30 是 ANSI C Compiler

C30 編譯過的程式可以在 MPLAB IDE 下除錯。

發表於: 2005/1/11 14:04
頂部


Re: 急急!!!pic18f8310选取哪个工具仿真?
版主
版主


用 ICD2 仿真就可以了,顯示黃燈代表可以使用但功能上還沒測試完畢(beta testing),但是可以用。

發表於: 2005/1/11 13:59
頂部


Re: p16f877, 關TMR1中斷使用問題
高級會員
高級會員


ORG 0x000 ; processor reset vector
clrf PCLATH ; 保證頁位元被清除
goto main ; 到程式開始位址


;**************************************
;*** INTERRUPT SERVICE ROUTINE ***
;*** PROGRAM BY LEE-CHIN-WEI ***
;*** INITIAL DATE : 2003-06-09 ***
;**************************************

ORG 0x004 ; 中斷向量位址
movwf w_temp ; save off current W register contents
movf STATUS,w ; move status register into W register
movwf status_temp ; save off contents of STATUS register
BTFSS INTCON,T0IF ; TIMER INT 0 FLAG == 1 ?
GOTO END_INT ; NO THEN RETURN

BCF INTCON,T0IF ; YES THEN CLEAR T0IF FLAG
BSF F_TMAIN ; SET THE MAIN LOOP FLAG=1
MOVLW .6
MOVWF TMR0

; isr code can go here or be located as a call subroutine elsewhere

END_INT:
movf status_temp,w ; retrieve copy of STATUS register
movwf STATUS ; restore pre-isr STATUS register contents
swapf w_temp,f
swapf w_temp,w ; restore pre-isr W register contents
retfie ; return from interrupt

;*********************************************
;*** MAIN SERVICE ROUTINE
;*** INITIAL DATE 2003-06-09
;*********************************************

main
CALL INIT_IO ; initial all IO port
CALL CLEAR_ALL_MEMORY ; clear all memory
CALL SYSTEM_INITIAL ; the system initial service routine
LOOP:
CALL KEY_SCAN ; KEY SCAN
CALL KEY_DEBOUNCE_PROC ; KEY DEBOUNCE PROCESS
CALL CHECK_SYSTEM_TIME ; CHECK THE SYSTEM TIME
CALL FUN_PROC
LOOP1:
BTFSS F_TMAIN ;
GOTO LOOP1 ;
BCF F_TMAIN ;
NOP ;
GOTO LOOP ;
;**************************************
;*** SYSTEM INITIAL SERVICE ROUTINE ***
;*** INITIAL DATE : 2003-06-09 ***
;*** PROGRAM BY LEE-CHIN-WEI ***
;**************************************
SYSTEM_INITIAL:
BANKSEL OPTION_REG ;OPTION_REG IN RAM BANK 1這一點要特別注意
MOVLW B'00000011' ; 1:16 FOR TIMER
MOVWF OPTION_REG
BSF INTCON,GIE
BSF INTCON,T0IE
BANKSEL TMR0
MOVLW .6
MOVWF TMR0
RETLW 0


我想你可能忘了切BANK
我在systems_initial第一行註解你可以看一下

發表於: 2005/1/11 13:34
頂部


Re: p16f877, 關TMR1中斷使用問題
高級會員
高級會員


把程式貼上
這樣很難替你診斷

發表於: 2005/1/11 13:28
頂部


p16f877, 關TMR1中斷使用問題
新會員
新會員


小弟最近才接觸PIC16F877。
那位先進有空時請不吝指導下列問題:

在設定Timer1 interrupt時遇到下列問題:
當Timer1 overflow時程式會直接回到 reset vector而不是到
interrupt vector。
小弟有再三確認已設定:
movlw 0x00
movwf T1CON
INTCON GIE, PEIE, 設為1
PIE1 TMR1IE 設為1
最後
t1con TMR1ON, 設為1。
以上。不知問題是發生在那裡。

發表於: 2005/1/11 12:35
頂部



« 1 ... 7278 7279 7280 (7281) 7282 7283 7284 ... 7522 »



:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------