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


Browsing this Thread:   1 Anonymous Users






Re: 在請教uart的問題
#2
版主
版主


查看用戶資訊
因為有使用 PIC24F 的周邊函數庫,所以在 Project 的 Libraries 要加入其周邊函數庫。
C:\Program Files\Microchip\MPLAB C30\lib\PIC24F\libpPIC24Fxxx-coff.a

發表於: 2008/10/29 14:34
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


在請教uart的問題
#1
新會員
新會員


查看用戶資訊
一塊P24FJ16GA002電路板,有接一顆75176 RS485的IC,我想要透過這顆IC和電腦的RS232溝通,目前已經有RS232轉RS485的轉接頭了硬體方面改好了
目前剩下程式這塊不是很懂~請各位大大教導一下小弟
目前我的程式如下

#include<P24FXXXX.h>
#include "uart.h"
//#include "ReadUART1.h"


void Init_PORT(void);
void isr_high(void);
void Init_UART(void);

unsigned int Rec_Data;



int main( void )
{

Init_UART( ); // UART 模組測試程式
Init_PORT( );
isr_high( );

while(1);
{
if (Rec_Data=='s') // Received 's' from RS-232
{
PORTB=0XF0;
}

if (Rec_Data=='p') // Received 'p' from RS-232
{
PORTB=0XFF;
}
if (Rec_Data=='r') // Received 'r' Read Cmmand from RS-232
{
PORTB=0X0F;
}

}
}


/***********************************************/
// Subroutine to initialize UART module

void Init_UART(void)
{

U1BRG=95; //Set Baudrate
IPC3bits.U1TXIP2 = 1; //Set Uart TX Interrupt Priority
IPC3bits.U1TXIP1 = 0;
IPC3bits.U1TXIP0 = 0;
IPC2bits.U1RXIP2 = 1; //Set Uart RX Interrupt Priority
IPC2bits.U1RXIP1 = 0;
IPC2bits.U1RXIP0 = 0;
U1STA = 0;
U1STAbits.ADDEN = 1; //Address detect enabled
U1MODE = 0x8080; //Enable Uart for 8-bit data
//no parity,1 STOP bit,wake enabled//
U1STAbits.UTXEN = 1; //Enable Transmit
IEC0bits.U1TXIE = 1; //Enable Transmit Interrupt
IEC0bits.U1RXIE = 1;
// Enable RxD Interrupt//
}

void Init_PORT(void)
{

PORTB=0x00;
TRISB=0x00; // Set PORTB as Output port
}

//#pragma interrupt isr_high

void isr_high(void)
{


Rec_Data= ReadUART1( ); // Read data from Receiver FIFO


}

編譯完就會出現
C:\pic\001\main.c:77: undefined reference to `ReadUART1'
是部會我沒有這各檔案的關係
還是是我程式哪裡出了問題
請各位前輩指導

發表於: 2008/10/29 11: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... ]

教育訓練中心

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