app026-3 UART 115200 baud rate
|
||||
---|---|---|---|---|
新會員
|
我測試 9600 ok 可是115200不行,請問有什麼要注意的嗎?
// JTAG/Code Protect/Write Protect/Clip-on Emulation mode // Watchdog Timer/ICD pins select _CONFIG1(JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2) // Disable CLK switch and CLK monitor, OSCO or Fosc/2, HS oscillator, // Primary oscillator _CONFIG2(FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMOD_XT & FNOSC_PRI) UARTInit() { TRISFbits.TRISF3 = 0; // This is an EXAMPLE, so brutal typing goes into explaining all bit sets //******************************************************************************** // STEP 1: configure U1MODE // No Flow Control Mode, No Loop-Back // No Auto-Baud, No Rx-Inversion // Low BaudRate, // 8-bit with no parity // 1 Stop-bit // bit 14, bit 10 no use //********************************************************************************/ U1MODEbits.UARTEN = 0; // Bit15 TX, RX DISABLED, ENABLE at end of func //= 0; // Bit14 no use U1MODEbits.USIDL = 0; // Bit13 Continue in Idle U1MODEbits.IREN = 0; // Bit12 No IR translation U1MODEbits.RTSMD = 0; // Bit11 Simplex Mode //= 0; // Bit10 no use U1MODEbits.UEN = 0; // Bits8,9 TX,RX enabled, CTS,RTS not U1MODEbits.WAKE = 0; // Bit7 No Wake up (since we don't sleep here) U1MODEbits.LPBACK = 0; // Bit6 No Loop Back U1MODEbits.ABAUD = 0; // Bit5 No Autobaud (would require sending '55') U1MODEbits.RXINV = 0; // Bit4 IdleState = 1 U1MODEbits.BRGH = 0; // Bit3 16 clocks per bit period U1MODEbits.PDSEL = 0; // Bits1,2 8bit, No Parity U1MODEbits.STSEL = 0; // Bit0 One Stop Bit //******************************************************************************** // STEP 2: // Load the count to get 300 baudrate // BRG = Fcy/(16*BaudRate)-1 where Fcy = Fosc/2 = 4MHz //********************************************************************************/ U1BRG = 0x01; //0x19; //******************************************************************************** // STEP 3: // Tx Interrupt to interrupt when at least one location is free in Tx buffer // No Tx Inversion, Disable Sync Break // Enable Transmit, Disable Address Detect // Interrupt on every receive. // bit 12 no use //********************************************************************************/ U1STAbits.UTXISEL1 = 0; //Bit15 Int when Char is transferred (1/2 config!) U1STAbits.UTXINV = 0; //Bit14 N/A, IRDA config U1STAbits.UTXISEL0 = 0; //Bit13 Other half of Bit15 //= 0; //bit 12 no use U1STAbits.UTXBRK = 0; //Bit11 Disabled U1STAbits.UTXEN = 0; //Bit10 TX pins controlled by UART1 U1STAbits.UTXBF = 0; //Bit9 *Read Only Bit* U1STAbits.TRMT = 0; //Bit8 *Read Only bit* U1STAbits.URXISEL = 0; //Bits6,7 Int. on character recieved U1STAbits.ADDEN = 0; //Bit5 Address Detect Disabled U1STAbits.RIDLE = 0; //Bit4 *Read Only Bit* U1STAbits.PERR = 0; //Bit3 *Read Only Bit* U1STAbits.FERR = 0; //Bit2 *Read Only Bit* U1STAbits.OERR = 0; //Bit1 *Read Only Bit* U1STAbits.URXDA = 0; //Bit0 *Read Only Bit* IFS0bits.U1TXIF = 0; // Clear the Transmit Interrupt Flag IEC0bits.U1TXIE = 0; // Enable Transmit Interrupts IFS0bits.U1RXIF = 0; // Clear the Recieve Interrupt Flag IEC0bits.U1RXIE = 1; // Enable Recieve Interrupts U1MODEbits.UARTEN = 1; // And turn the peripheral on U1STAbits.UTXEN = 1; }
發表於: 2009/7/7 16:28
|
|||
|
Re: 請問APP026-3 ver4 的 uart 有沒有 example
|
||||
---|---|---|---|---|
新會員
|
sorry , 我要的是 pic24 的範例程式, Thanks
發表於: 2008/3/19 12:36
|
|||
|
請問APP026-3 ver4 的 uart 有沒有 example
|
||||
---|---|---|---|---|
新會員
|
好像沒有app026-3 ver4 的說明,請問有沒有 uart 的 example
Thanks
發表於: 2008/3/18 21:48
|
|||
|
想用USB PIC 來教學是否有資料可以提供
|
||||
---|---|---|---|---|
新會員
|
想用USB PIC 來教單晶片:
不知是否有利用 usb作ISP的功能。 或是有其他資料可以參考。 Thanks
發表於: 2005/4/1 21:51
|
|||
|
Re: PICDEM Z 2.4 GHz 台灣有賣嗎
|
||||
---|---|---|---|---|
新會員
|
禾伸堂可以幫忙訂購.
(02)26596720-206蕭先生 不過要訂金而且4-6 week 才能拿到
發表於: 2005/1/7 16:18
|
|||
|
PIC18F2455 有sample可以索取嗎
|
||||
---|---|---|---|---|
新會員
|
我想測試一下 usb function,不知是否有sample可以索取嗎??
Thanks for your help
發表於: 2005/1/4 17:51
|
|||
|
PICDEM Z 2.4 GHz 台灣有賣嗎
|
||||
---|---|---|---|---|
新會員
|
Dear Sir :
I want to buy PICDEM Z 2.4 GHz Demonstration Kit, can you give me some information. Ted Chen
發表於: 2005/1/4 14:18
|
|||
|