Re: 請問一下有關於Software UART
|
||||
---|---|---|---|---|
版主
|
WriteUART( ) 是送出 UART 的訊號函數,用中斷點設定找一下問題,看看成是是否有執行到這裡。
發表於: 2007/2/14 13:39
|
|||
|
Re: 請問一下有關於Software UART
|
||||
---|---|---|---|---|
新會員
|
如果只改上面腳位的話..compiler會有以下錯誤
MPLINK 3.40, Linker Copyright (c) 2003 Microchip Technology Inc. Error - could not find definition of symbol 'DelayRXHalfBitUART' in file 'OPENUART.O'. Errors : 1 我後來去別的地方看,他是說還要定義下列function,我把下列function寫在sw_uart.h裡面 DelayTXBitUART Delay for: ((((2*FOSC) / (4*baud)) + 1) / 2) - 12 cycles DelayRXHalfBitUART Delay for: ((((2*FOSC) / (8*baud)) + 1) / 2) - 9 cycles DelayRXBitUART Delay for: ((((2*FOSC) / (4*baud)) + 1) / 2) - 14 cycles 定義之後compiler就會過,可是還是沒法輸出資料於終端機,請問一下這是什麼問題,要顯示資料在終端機可以用WriteUART這個指令嗎
發表於: 2007/2/14 12:09
|
|||
|
Re: 請問一下有關於Software UART
|
||||
---|---|---|---|---|
版主
|
依底下程式 (OpenUART.asm)所顯示,只要變更 PORTB 4 & 5 就可以了。
C:\mcc18\src\traditional\pmc\SW_UART\openuart.asm INCLUDE "p18cxxx.inc" SWTXD equ PORTB ; Transmit pin port and pin SWTXDpin equ 4 TRIS_SWTXD equ TRISB ; Transmit pin tris and pin SWRXD equ PORTB ; Receive pin port and pin SWRXDpin equ 5 TRIS_SWRXD equ TRISB ; Receive pin tris and pin
發表於: 2007/2/14 11:47
|
|||
|
Re: 請問一下有關於Software UART
|
||||
---|---|---|---|---|
版主
|
只要改一下腳位的定義就可以了,需注意要使用的腳位是否有AD輸入功能或比I/O更高優先的設定。
發表於: 2007/2/14 11:37
|
|||
|
Re: 請問一下有關於Software UART
|
||||
---|---|---|---|---|
新會員
|
是不是還要加什麼delay的?
發表於: 2007/2/14 10:41
|
|||
|
請問一下有關於Software UART
|
||||
---|---|---|---|---|
新會員
|
請問一下,如果要使用軟體之UART,若一開始腳位就不一樣
(PortG.1,PortG.2),是否要更改到c18的openuart.asm 那中間需要注意什麼事情,再請各位高手教導一下,謝謝 MPLAB 6620 感謝
發表於: 2007/2/13 9:36
|
|||
|