XMOS プログラミング入門 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. http://www.morikita.co.jp/books/mid/085251 このサンプルページの内容は, 初版 1 刷発行時のものです.
i 40 LED OS OS XMOS 32 XMOS OS XMOS XMOS XMOS OS FPGA ASIC
ii XMOS Chapter 1 Chapter 2 XMOS Chapter 3 XMOS Chapter 4 XMOS C XC XMOS XMOS URL Chapter 4 XMOS Example A 1 XMOS XMOS XMOS OS XMOS 1 2 XMOS 2014 2
iii Contents Chapter 1 XMOS 1.1 xcore Tile 1 1.2 xcore 3 1.3 xconnect 5 1.4 8 1.5 10 1.6 12 1 Chapter 2 XMOS 2.1 15 2.2 CSP 16 2.3 16 2.4 18 15 Chapter 3 3.1 21 3.2 XN 23 3.3 24 3.4 XMOS 28 3.5 28 3.6 31 3.7 33 21 Chapter 4 XMOS 4.1 35 4.2 37 4.3 41 4.4 43 4.5 52 4.6 54 4.7 56 35
iv Contents 4.8 59 4.9 62 XMOS Example A A.1 PulseGen 74 A.2 PulseCounter 75 A.3 StartButton 76 A.4 77 73 Example B UART B.1 Send_UART 80 B.2 Read_UART 81 79 Example C RC C.1 RC 85 C.2 86 C.3 ServoPulseGen 87 C.4 ServoPos 88 C.5 89 C.6 90 85 Example D D.1 XMOS 91 D.2 92 D.3 RotaryInc 93 D.4 ServoPos2 94 D.5 95 91 Example E E.1 97 E.2 98 E.3 RotaryAbs 98 97
v E.4 ServoPos3 99 E.5 100 Example F AD F.1 SPI AD XMOS 103 F.2 104 F.3 104 F.4 106 103 Example G XMOS Windows PC RS232 G.1 109 G.2 RS232_ChannelEnd 111 G.3 RS232_X32 114 G.4 RS232 115 109 Example H H.1 XTAG2 122 H.2 123 H.3 123 H.4 XMOS 124 H.5 XN 125 H.6 126 H.7 128 H.8 XTAG2 129 H.9 129 121 Appendix XMOS 1. 133 2. 134 133 139 141
1 Chapter 1 XMOS XMOS 1.1 xcore Tile XMOS 5 OS XMOS xcore xconnect 1.2 1.3 1.4 L XS1-L8 1.1 8 Logical Core xconnect I/O xcore Tile XMOS
2 Chapter 1 XMOS 1.1 xcore Tile 4 6 8 10 12 16 L AD A USB2.0 PHY U 1.2 2 8 A XS1-A8 1.3 U 12 XS1-U12 3 1.2 XS1-A8
1.2 xcore 3 1.3 XS1-U12 xcore 1 XS1-L8 1.2 xcore XS1-L8 400 MHz 500 MHz 2 1.1 8 32 RISC 1 64 KB RAM I/O I/O
4 Chapter 1 XMOS 400 MHz 50 MHz 8 500 MHz 4 1 125 MIPS 125 MIPS 4 500 MIPS I/O I/O I/O 10 ns XMOS I/O IC XMOS I/O 1.1 xcore Tile I/O I/O I/O xcore I/O RTOS 10 ns IC XMOS software defined silicon XMOS FPGA ASIC
71 XMOS Chapter 4 XMOS XMOS Examples A B UART C RC D E F AD G XMOS Windows PC RS232 H
Example A I/O DFD XMOS A.1 DFD PulseGen PulseCounter StartButton XMOS PulseGen I/O PulseCounter IC A.2 PulseGen PulseCounter A.3 XMOS XMOS FPGA FPGA XMOS A.1 PulseCounter DFD
74 Example A A.2 A.3 XMOS A.1 PulseGen A.1 PulseGen 1 High 50 1 10 ns High 500 ns 500 ns 0 Low Low 500 ns while 1 MHz 1 MHz A.2 PulseCounter
A.2 PulseCounter 75 A.1 PulseGen void PulseGen(out port outp){ timer tmr; unsigned time; tmr :> time; // while(1){ outp <: 0xf; // 1 time += 50; // 50 10 ns 500 ns tmr when timerafter(time) :> void; // outp <: 0x0; // time += 50; // 50 10 ns 500 ns tmr when timerafter(time) :> void; // } } A.2 PulseCounter A.2 PulseCounter PulseCounter StartButton while old_p High Low Low High going 0 while StartButton XC A.2 PulseCounter void PulseCounter(chanend St, unsigned MTime_ms, in port inp){ timer tmr; int stcmd; unsigned going, mt, now; unsigned old_p, new_p, count; count=0; mt=mtime_ms*100000; old_p=0xf; going=1; while(1){ St :> stcmd; // count=0; going=1; tmr :> now; // while(going){ // select{ case inp when pinsneq(old_p) :> new_p: //
76 Example A } } old_p=new_p; // count=count+1; // break; case tmr when timerafter(now+mt) :> void: // going = 0; break; } } St <: count/2; // A.3 StartButton StartButton A.3 WaitForClick() 4.9 LED Pulse Counter PulseCounter 1 A.3 StartButton void StartButton(chanend St, out port LED, in port Button_A){ int CountData=0; int cmd=0; while(1){ printstrln("please click SW1 to start!!"); // WaitForClick(Button_A, 200); // flash(led, 0xf); // St <: cmd; // St :> CountData; // printstrln("finish"); printstr("count Data = "); printintln(countdata); // printstrln(""); } }
中原博史 ( なかはら ひろし ) 1974 年 北海道大学工学部精密工学科卒業 1976 年 北海道大学大学院工学研究科情報工学専攻修士課程修了 1976 年 松下電器産業 ( 株 )( 現パナソニック ( 株 )) 入社 1986 年 北海道職業訓練短期大学校 ( 現北海道職業能力開発大学校 ) 勤務 2013 年 北海道職業能力開発大学校電子情報技術科 現在に至る 藤原祐介 ( 森北出版 ) 富井 晃 ( 森北出版 ) dignet エーヴィスシステムズ 協栄製本 XMOS プログラミング入門 中原博史 2014 2014 年 4 月 10 日第 1 版第 1 刷発行 本書の無断転載を禁ず 中原博史 森北博巳 東京都千代田区富士見 1-4-11( 102-0071) 電話 03-3265-8341/FAX 03-3264-8709 http://www.morikita.co.jp/ 日本書籍出版協会 自然科学書協会会員 <( 社 ) 出版者著作権管理機構委託出版物 > 落丁 乱丁本はお取替えいたします. Printed in Japan/ISBN978-4-627-85251-8