Re: 關於CCS COMPILER問題?
|
||||
---|---|---|---|---|
資深會員
|
再請問一下,stream=high_speed這個是指把BRGH設為1嗎?謝謝
發表於: 2004/9/24 0:21
|
|||
|
Re: 關於CCS COMPILER問題?
|
||||
---|---|---|---|---|
資深會員
|
有三招,
第一招,用 CCS 的函數,看你的版本夠不夠新 A new function has been added: SETUP_UART that works the same as SET_UART_SPEED. A new feature of this function is when a FALSE (or 0) is passed it turns off the UART and when a TRUE (or 1) is passed in it turns the UART on. Passing in a baud rate also turns on the UART. 第二招,直接硬幹 #byte SPBRG = 0xFAF // 18F452 的鮑率 暫存器 RS232_baud_rate_code = 21; // 42 for 57600 baud rate // 21 for 115200 @ 40 MHz // 9 for 250000 SPBRG = RS232_baud_rate_code; // 寫入暫存器,隨你改鮑率設定 第三招,沒玩過,不太確定 #use rs232(baud=19200,xmit=pin_c6,rcv=pin_c7,stream=high_speed) #use rs232(baud=9600,xmit=pin_c6,rcv=pin_c7,stream=low_speed) #use rs232(baud=4800,xmit=pin_c3,rcv=pin_c4,stream=GPS) main() { fprintf(high_speed, "test_123"); delay_ms(200); fprintf(low_speed, "test_456");
發表於: 2004/9/23 22:49
|
|||
|
關於CCS COMPILER問題?
|
||||
---|---|---|---|---|
資深會員
|
想請問各位,如果在CCS裡已設定了鮑率,可以在某段程式裡再更改鮑率成9600嗎?謝謝~
#use rs232(baud=19200, xmit=PIN_C6, rcv=PIN_C7)
發表於: 2004/9/23 20:49
|
|||
|