// 216 SCI0 ERI0 void INT_SCI0_ERI0(void){SHRS_recv_eri0();} // 217 SCI0 RXI0 void INT_SCI0_RXI0(void){SHRS_recv_rxi0();} // 218 SCI0 TXI0 void INT_SCI0_TXI0(void){SHRS_send_txi0();} // 219 SCI0 TEI0 void INT_SCI0_TEI0(void){/* sleep(); */} // 220 SCI1 ERI1 void INT_SCI1_ERI1(void){SHRS_recv_eri1();} // 221 SCI1 RXI1 void INT_SCI1_RXI1(void){SHRS_recv_rxi1();} // 222 SCI1 TXI1 void INT_SCI1_TXI1(void){SHRS_send_txi1();} // 223 SCI1 TEI1 void INT_SCI1_TEI1(void){/* sleep(); */} // 224 SCI2 ERI2 void INT_SCI2_ERI2(void){SHRS_recv_eri2();} // 225 SCI2 RXI2 void INT_SCI2_RXI2(void){SHRS_recv_rxi2();} // 226 SCI2 TXI2 void INT_SCI2_TXI2(void){SHRS_send_txi2();} // 227 SCI2 TEI2 void INT_SCI2_TEI2(void){/* sleep(); */} |
#include "iodefine.h" #include "sh7125rslib.h" |
#include "iodefine.h" #include "sh7125rslib.h" int main(void) { char buf[32]; int n; SHRS_Open(1); SHRS_Sends(1,"Hello!\r\n"); for(;;){ n=SHRS_CheckRecv(1); //受信データの確認 //もし1文字でも受信データがあれば以下の処理をする if(n){ n=SHRS_Recv(1,buf,n); //データの受信 while(SHRS_CheckSend(1)<n); //送信バッファの確認 SHRS_Send(1,buf,n); //データの送信 } //... //この間,別の作業をしてもかまわない. //... } return 0; } //e2studioの場合,下の記述も追加 extern "C" { void abort(void){} } |
SCBRR | ボーレート[bps] | 備考 |
0 | 781250.0 | |
1 | 390625.0 | |
2 | 260416.7 | |
3 | 195312.5 | |
4 | 156250.0 | |
5 | 130208.3 | |
6 | 111607.1 | 115200に対し-3.12% |
7 | 97656.3 | |
8 | 86805.6 | |
9 | 78125.0 | |
10 | 71022.7 | |
11 | 65104.2 | |
12 | 60096.2 | |
13 | 55803.6 | 57600に対し-3.12% |
14 | 52083.3 | |
15 | 48828.1 | |
16 | 45955.9 | |
17 | 43402.8 | |
18 | 41118.4 | |
19 | 39062.5 | 38400に対し+1.73% |
20 | 37202.4 | |
21 | 35511.4 | |
22 | 33967.4 | |
23 | 32552.1 | |
24 | 31250.0 | 31250に対し 0.00% |
40 | 19054.9 | 19200に対し-0.76% |
80 | 9645.1 | 9600に対し+0.47% |
・次の2つのうちいずれか一方 #define SHRS_RXD0_PA10 #define SHRS_RXD0_PE1 ・次の2つのうちいずれか一方 #define SHRS_TXD0_PA11 #define SHRS_TXD0_PE2 ・次の2つのうちいずれか一方 #define SHRS_RXD1_PA14 #define SHRS_RXD1_PE4 ・次の2つのうちいずれか一方 #define SHRS_TXD1_PA15 #define SHRS_TXD1_PE5
#include "iodefine.h" #define SHRS_BRR0 13 #define SHRS_BRR1 6 #define SHRS_BRR2 80 #define SHRS_RECVBUFFERSIZE0 64 #define SHRS_RECVBUFFERSIZE1 512 #define SHRS_RECVBUFFERSIZE2 8 #define SHRS_SENDBUFFERSIZE0 16 #define SHRS_SENDBUFFERSIZE1 128 #define SHRS_SENDBUFFERSIZE2 256 #define SHRS_RXD0_PA10 #define SHRS_TXD0_PA11 //#define SHRS_RXD0_PE1 //#define SHRS_TXD0_PE2 #define SHRS_RXD1_PA14 #define SHRS_TXD1_PA15 //#define SHRS_RXD1_PE4 //#define SHRS_TXD1_PE5 #define SHRS_USE_PRINTF #define SHRS_PRINTF_BUFFERSIZE 512 #include "sh7125rslib.h" |