Re: 30f2010燒入後,程式無法正常執行
|
||||
---|---|---|---|---|
版主
|
不好意思!這麼晚才找出問題來。
發表於: 2004/10/5 22:24
|
|||
|
Re: PIC與RS323間傳輸
|
||||
---|---|---|---|---|
版主
|
C 還是Assembly ? which PIC ?
發表於: 2004/10/4 13:54
|
|||
|
Re: MPLAB會組譯錯誤嗎?
|
||||
---|---|---|---|---|
版主
|
看了你的程式,這該怎麼說呢!
TRISB 應該利用 include *.inc 的方式將Microchip所定義的周邊名稱帶入到程式裡。 list p=16F877a #include <p16f877a.inc> ; Include file locate at defult directory 二進制的寫法為 : b'00000001' 十進制的寫法為 : d'200' 或 .200 十六進制的寫法為 : h'3F'或 0x3f 或03fh 各家出的組義器,語法的定義會稍有不同的格式 建議看一下 MPASM & MPLINK User's Guide 或看一下右邊的教育訓練內的 MPASM Workshop 講義。
發表於: 2004/10/4 13:49
|
|||
|
Re: PIC 的 complier有那些, 可以到那兒download呢?
|
||||
---|---|---|---|---|
版主
|
除了 MPLAB IDE 以外,還有很多的軟體可以在底下的網站上下載: http://www.microchip.com/stellent/idc ... 1475&category=devSoftware
MPLAB C18 : PIC18Fxxxx C compiler , Demo Version 可以使用60天 MPLAB c30 : dsPIC C Compiler 至於PIC16Cxxx的C Compiler,就只有使用Third-Party的產品了,其相關連結網站如下: Hi-Tech PIcc http://www.microchip.com/stellent/idc ... ech+picc&DesignDocSelect=
發表於: 2004/10/4 13:37
|
|||
|
Re: 再來一個問題
|
||||
---|---|---|---|---|
版主
|
MPLAB C18 是可以定義超過256Bytes的陣列,你可以參考右邊教育訓練下的W410 C18 Workshop Page 133 - 135 的說明。
摘錄其說明如下 : 1. 陣列的存取一般是被限定在同一個“Bank”內的資料最多為 256 Bytes,但可透過下列方式以擴展陣列: - 巨大陣列的存取在MPLAB-C18是可以被允許的 - 利用 #progma 將該陣列設定到該Bank的起始位置0xn00 (n為Bank數)。 - 修改連結敘述檔(Linker Script)即可達到巨大陣列的存取: - 檔案位置“C:\mcc18\lkr\18f452.lkr”。 - 陣列的擴展必須是相鄰的banks。 - 此區域必須加以保護以避免被其它變數所使用,使用“PROTECTED” 的屬性參數。 2. 程式範例: #pragma udata HugeObj //select HugeObj section static unsigned char Array1[0x200]; //define array #pragma udata //return to default udata section unsigned char *Ptr1; //define array pointer (16-bits) void main(void) { unsigned int Count; //define counter variable Ptr1 = Array1; //initialize pointer for (Count=0x00; Count<0x200; Count++) { *Ptr1=0xFF; //set array element to 0xFF Ptr1++; } } 3. Linker檔的修改 ACCESSBANK NAME=accessram START=0x0 END=0x7F DATABANK NAME=gpr0 START=0x80 END=0xFF DATABANK NAME=gpr1 START=0x100 END=0x1FF //DATABANK NAME=gpr2 START=0x200 END=0x2FF //DATABANK NAME=gpr3 START=0x300 END=0x3FF DATABANK NAME=gpr4 START=0x400 END=0x4FF DATABANK NAME=gpr5 START=0x500 END=0x5FF ACCESSBANK NAME=accesssfr START=0xF80 END=0xFFF DATABANK NAME=hugestuff START=0x200 END=0x3FF PROTECTED SECTION NAME=HugeObj RAM=hugestuff
發表於: 2004/10/4 11:57
|
|||
|
dsPIC30F2010 A/D Buffer (ADCBUF6 - F)沒有被定義的問題
|
||||
---|---|---|---|---|
版主
|
依據 Microchip 總公司通告,DSPIC30F2010在LINK30的連結描述檔裡
C:\pic30_tools\support\gld\p30f2010.gld 有關ADCBUF6 到 ADCBUFF 沒有被定義到,造成程式設計師誤以為ADC只有 ADCBUF0~5個,這是錯誤的。 實際上ADCBUF還是有16個,只要修改p30f2010.gld加入ADCBUF6~ADCBUFF就可以。 1. 使用C30者,只要修改 gld file 2. 使用ASM30,同時修改 gld 和 inc (注意 inc 的位置,有C版本及MPLAB IDE的版本,位置不一樣。)的
發表於: 2004/10/4 10:15
|
|||
|
Re: 為何變數無法致能?
|
||||
---|---|---|---|---|
版主
|
1. 看起來你對PIC18F452的指令還不是很熟悉它的使用語法,建議下載右邊的教育訓練課程內的W400研讀一下PIC18F系列的Access Bank的使用方式。
2. 有關USART的使用範例程式可參考W400裡的Lab4,那裡有詳細的說明;底下就是從該程式中針對USART的涉頂所寫的副程式景供參考: ; OSC = 16MHz ;*********************************************************************** ;**** Initial USART as 9600,N,8,1 ;*********************************************************************** Init_USART: movlw b'00100000' ; 8-bit data mode , ASYNC movwf TXSTA ; Low Speed mode, Enable TxD ; movlw b'10010000' ; Enable Serial Port, 8-bit receive movwf RCSTA ; Continuous Receive, Disable Address Detection ; movlw .25 ; Set baud rate at 9600 with Low Speed mode movwf SPBRG ; bcf PIR1,TXIF ; Clear TxD interrupt flag bcf PIE1,TXIE ; Disable TxD interrupt ; bcf IPR1,RCIP ; Set the RxD for Low priority interrupt bcf PIR1,RCIF ; Clear RxD interrupt flag bsf PIE1,RCIE ; Enable RxD interrupt ; return
發表於: 2004/10/4 9:41
|
|||
|
Re: dspic中的 frame pointer 是要做何用
|
||||
---|---|---|---|---|
版主
|
1. W14 can be used as a stack frame pointer (FP)
2. LNK #N ; Allocates (N-2)/2 words of local storage - W14 (prior stack FP) is stacked; W15 is incremented - W15 value saved in W14 (new FP, start of local storage) - W15 advanced by N/2 words (end of local storage + 1 word)(i.e. N must be an even number to keep stack word aligned) - [W14 + y] accesses local storage for function callwhere: 0 <= y <= N-2 - W14 with a -ve offset accesses parameters from calling routine 3. ULNK ; De-allocates temporary storage space - Restores W14 (start of local storage) to W15 - W15 decremented then stack popped into W14 (prior stack FP).
發表於: 2004/10/1 16:57
|
|||
|
Re: 30f2010燒入後,程式無法正常執行
|
||||
---|---|---|---|---|
版主
|
忘了問,是否有使用到 QEI ???
在ICD2 Debug Mode 暫存器 "ADPCFG" 會被設定為 0xFFFF,PORTB 及 QEI 功能可以呈現出來。 但在 Stand Alone Mode 下,Power-On Reset 會將暫存器 "ADPCFG" 清除為0x0000,結果會將導致QEI無法在類比模式的輸入PIN工作。 解決方式是將PORTB設為數位模式,方式如下: ADPCFGbits = 0x00nn; (where nn is the value for configuring the PORTB pins to digital)
發表於: 2004/10/1 15:56
|
|||
|