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


Browsing this Thread:   1 Anonymous Users




(1) 2 »


Re: 舊版本C30可編譯,新版本的C30編譯不會過問題求教?
#14
資深會員
資深會員


查看用戶資訊
參照:

cct1210 寫道:
我找到UART.H的定義,在第35行定義如下,

#if defined(__dsPIC33F__) || defined(__PIC24H__) || \
defined(__dsPIC30F1010__) || defined(__dsPIC30F2020__) || defined(__dsPIC30F2023__) || defined(__dsPIC30F4011__)

#define _UART_V2

#elif defined(__dsPIC30F__)

#define _UART_V1

#endif

看起來dsPIC30F4011是定義在_UART_V2,不是在_UART_V1
Ryang版主,看起來新版本V3.22(V3.20b亦是)跟你的V3.12有很大的不同,就是差很大.


版主你好 從上述我也找到bug

我是用5015 6015
在UART.H的定義 都沒有

而QEI 6015也沒定義

其他我還有使用TIME CN 等未查
阿 難怪代理商查不出來 也問原廠 阿對不起原廠是你喔
也查不出來 都說沒問題
現在的我學乖了 不用函式庫 改功能變數位元宣告

發表於: 2010/1/13 9:53
==== ^^ ^^ ====
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 舊版本C30可編譯,新版本的C30編譯不會過問題求教?
#13
版主
版主


查看用戶資訊
題外話,
如果有詳細看 dsPIC30F Family Reference Manual 裡的 UART 章節的話對周邊的設定就會比較清楚,查一下也會了解那個位元 Default 的值為0,所以這個參數搞不過就不用設它也行,因為 Data Sheet 說它開機是 0 的設定。

UTXBRK : R/W-0 (標示為該位元是可讀、可寫入的位元,Reset 後的 Default 值為 0)

像 TRMT 位元標示 : R-1 (表示該位元只能做讀取的功能,default 值為 1 )

發表於: 2010/1/12 10:11
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 舊版本C30可編譯,新版本的C30編譯不會過問題求教?
#12
資深會員
資深會員


查看用戶資訊
修改 support\peripheral_30F_24H_33F目錄下的uart.h,使得dsPIC30F4011定義在UART_V1下,C30編譯成功.
感謝Ryang版主的幫助及其他網友不厭其煩的指教,今天可以有個好眠了!

發表於: 2010/1/11 20:32

Edited by cct1210 on 2010年01月11日 20:58:33
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 舊版本C30可編譯,新版本的C30編譯不會過問題求教?
#11
版主
版主


查看用戶資訊
那就是定義錯了,dsPIC30F4011 的 UART 是屬於舊的架構,不會與 dsPIC33F/PIC24H 使用相同的架構的。所以是 Microchip 在新版的C30 V3.22 又被抓包了,通融一下 uart.h 改一下讓它成為 V1 的定義。

發表於: 2010/1/11 16:32
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 舊版本C30可編譯,新版本的C30編譯不會過問題求教?
#10
資深會員
資深會員


查看用戶資訊
我找到UART.H的定義,在第35行定義如下,

#if defined(__dsPIC33F__) || defined(__PIC24H__) || \
defined(__dsPIC30F1010__) || defined(__dsPIC30F2020__) || defined(__dsPIC30F2023__) || defined(__dsPIC30F4011__)

#define _UART_V2

#elif defined(__dsPIC30F__)

#define _UART_V1

#endif

看起來dsPIC30F4011是定義在_UART_V2,不是在_UART_V1
Ryang版主,看起來新版本V3.22(V3.20b亦是)跟你的V3.12有很大的不同,就是差很大.

發表於: 2010/1/11 16:02

Edited by cct1210 on 2010年01月11日 21:07:03
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 舊版本C30可編譯,新版本的C30編譯不會過問題求教?
#9
資深會員
資深會員


查看用戶資訊
附上程式主檔test.c
個人使用MPLAB8.4, C30 V3.22
當device選dsPIC30f6010a,可編譯,選dsPIC30f4011,則就會出現編譯錯誤.

Attach file:


Link only for registered users

發表於: 2010/1/11 15:43
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 舊版本C30可編譯,新版本的C30編譯不會過問題求教?
#8
版主
版主


查看用戶資訊
回覆 cct1210 :

我使用的 C30 是 V3.12 的版本,在其 uart.h 檔案裡的宣告 dsPIC30F4011 是屬於 UART_V1 的架構有別於底下的 V2 架構。
#if defined(__dsPIC33F__) || defined(__PIC24H__) || 
    
defined(__dsPIC30F1010__) || defined(__dsPIC30F2020__) || defined(__dsPIC30F2023__)

#define _UART_V2

[color=ff0000]#elif defined(__dsPIC30F__)

#define _UART_V1[/color]


我有在 V1 的 uart.h 檔裡找到 "UART_TX_PIN_NORMAL" 的定義,我不知道位何你的版本會找不到,麻煩在檢查一下 uart.h 檔的相關宣告。
底下為 uart.h 對此位元的宣告,一般是要設成NORMAL (=0) 的,開機的 default 也是設為 0 的,如果強設為 1 的話則可將 TxD 腳拉成 Low 輸出直到將該位元清為 0,該位元主要設給Lin Bus 送出 Break Signal 功能用,一般的UART 的模式下不會用到此功能。

#define UART_TX_PIN_NORMAL 0xF7FF /* UART TX pin operates normally */
#define UART_TX_PIN_LOW 0xFFFF /* UART TX pin driven low */

發表於: 2010/1/11 11:27
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 舊版本C30可編譯,新版本的C30編譯不會過問題求教?
#7
資深會員
資深會員


查看用戶資訊
請看以下程式,主要是從C30的docs\periph_lib\dsPIC30F_dsPIC33F_PIC24H_UART_Help.htm抄下來的

#include<p30fxxxx.h>
#include<uart.h>
/* Received data is stored in array Buf */
char Buf[80];
char * Receiveddata = Buf;
/* This is UART1 transmit ISR */
void __attribute__((__interrupt__)) _U1TXInterrupt(void)
{
IFS0bits.U1TXIF = 0;
}
/* This is UART1 receive ISR */
void __attribute__((__interrupt__)) _U1RXInterrupt(void)
{
IFS0bits.U1RXIF = 0;
/* Read the receive buffer till atleast one or more character can be read */
while( DataRdyUART1())
{
( *( Receiveddata)++) = ReadUART1();
}
}
int main(void)
{
/* Data to be transmitted using UART communication module */
char Txdata[] = "Microchip";
/* Holds the value of baud register */
unsigned int baudvalue;
/* Holds the value of uart config reg */
unsigned int U1MODEvalue;
/* Holds the information regarding uart
TX & RX interrupt modes */
unsigned int U1STAvalue;
/* Turn off UART1module */
CloseUART1();
/* Configure uart1 receive and transmit interrupt */
ConfigIntUART1(UART_RX_INT_EN & UART_RX_INT_PR6 &
UART_TX_INT_DIS & UART_TX_INT_PR2);
/* Configure UART1 module to transmit 8 bit data with one stopbit. Also Enable loopback mode */
baudvalue = 5;
U1MODEvalue = UART_EN & UART_IDLE_CON &
UART_DIS_WAKE & UART_EN_LOOPBACK &
UART_EN_ABAUD & UART_NO_PAR_8BIT &
UART_1STOPBIT;
U1STAvalue = UART_INT_TX_BUF_EMPTY &
UART_TX_PIN_NORMAL &
UART_TX_ENABLE & UART_INT_RX_3_4_FUL &
UART_ADR_DETECT_DIS &
UART_RX_OVERRUN_CLEAR;
OpenUART1(U1MODEvalue, U1STAvalue, baudvalue);
/* Load transmit buffer and transmit the same till null character is encountered */
putsUART1 ((unsigned int *)Txdata);
/* Wait for transmission to complete */
while(BusyUART1());
/* Read all the data remaining in receive buffer which are unread */
while(DataRdyUART1())
{
(*( Receiveddata)++) = ReadUART1() ;
}
/* Turn off UART1 module */
CloseUART1();
return 0;
}

若在MPLAB的Select devices選dsPIC30F6010A則可以編譯通過,若選擇dsPIC30F4011編譯則出現error: 'UART_TX_PIN_NORMAL' undeclared (first use in this function)
,所以跟是不是使用"USE_AND_OR" 一點關係也沒有,覺得有點風馬牛不相及.
個人有點困惑,從出現的訊息"UART_TX_PIN_NORMAL' undeclared,應該是此定義(應該是使用#define 所定義),在dsPIC30F4011的head檔被刪掉了(什麼原因就不得而知???,因為在V3.02C還在,V3.20B不見了),而在dsPIC30F6010A內還保留著,想起來有點可怕,都沒說原因就不見了,我以前的很多程式,不明不白地就不能動了.
希望有人可解答我的問題,是不是我那裡搞錯了,真希望我錯了,這樣我才能安心.

發表於: 2010/1/9 0:47
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 舊版本C30可編譯,新版本的C30編譯不會過問題求教?
#6
版主
版主


查看用戶資訊
我還沒安裝 C30 v3.20 版本,不過找一下 "USE_AND_OR" 的定義行是否有備註解掉就知道的。
基本上 "USE_AND_OR" 沒有定義的話就會使用 & 的運算,而以前所寫的練習也都是以 & 的運算元為主的。

如 Timer 的編譯有相同問題就找一下。

發表於: 2010/1/8 18:02
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 舊版本C30可編譯,新版本的C30編譯不會過問題求教?
#5
資深會員
資深會員


查看用戶資訊
參照:

Ryang 寫道:
maru2000 大大,真有你的這樣都讓你找的到。謝謝。

剛檢查了一下 C30 V3.12 的版本(我目前在用的),其實他又改了回來了,很抱歉這個定義又改到其它的檔案了:
C:\Program Files\Microchip\MPLAB C30\src\peripheral_24F\include\PIC24F_periph_features.h
的檔案了,而且將 " /* #define USE_AND_OR */" 加上註解了,所以Timers.h 將會使用 & 的方式來運算這些常數值。
所以如果你使用 v3.12 (含) 以後的版本就可以跟以前相容了。

PIC24F_periph_features.h 檔裡的說明:
#include <p24Fxxxx.h>

/* By default, configuration constants are assembled from macros */
/* using the bit-wise AND operator (&). An alternate mode is */
/* available in which constants are assembled using the bit-wise */
/* OR operator (|) to set values and bit-wise AND (&) masks to */
/* clear values. To enable the alternate mode, define the */
/* USE_AND_OR symbol. */
/* */
/* To define this macro as a compiler option: */
/* -DUSE_AND_OR */
/* To define this macro in source code: */
/* #define USE_AND_OR */


我使用V3.20版
有改回來
但是還是不行
執行上述函式庫還是會有問題 "燒錄後"

我有一產品使用V2.4
後來要降低成本改dsPIC33FJ
升級到V3.20但是舊產品有問題

現在PC 灌2個XP
1個使用V2.4
1個使用V3.20

真麻煩

後來dsPIC33FJ 就不用函式庫宣告 少掉麻煩

發表於: 2010/1/8 15:03
==== ^^ ^^ ====
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

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... ]

教育訓練中心

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