{"id":2459,"date":"2014-10-16T14:58:42","date_gmt":"2014-10-16T05:58:42","guid":{"rendered":"http:\/\/oohito.com\/nqthm\/?p=2459"},"modified":"2014-10-16T14:58:42","modified_gmt":"2014-10-16T05:58:42","slug":"serialport%e3%81%ae%e8%ac%8e","status":"publish","type":"post","link":"https:\/\/oohito.com\/nqthm\/archives\/2459","title":{"rendered":"SerialPort\u306e\u8b0e"},"content":{"rendered":"<p>\u300c\u306a\u306e\u307c\u30fc\u3069\u300d\u3092\u3064\u306a\u3052\u305fPC\u4e0a\u3067\u3001<a href=\"http:\/\/oohito.com\/nqthm\/fluo\" title=\"Fluo\">Fluo<\/a>\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u884c\u3063\u3066\u3044\u308b\u306e\u3060\u304c\u3001\u4f8b\u306b\u3088\u3063\u3066SerialPort\u3067\u60a9\u307e\u3055\u308c\u3066\u3044\u308b\u3002<br \/>\n\u305a\u3063\u3068Mac OS X\u4e0a\u3067\u958b\u767a\u3057\u3066\u3044\u3066\u7279\u306b\u30c8\u30e9\u30d6\u30eb\u304c\u306a\u304b\u3063\u305f\u306e\u3067\u898b\u904e\u3054\u3057\u3066\u3044\u305f\u304c\u3001Windows\u3067\u5229\u7528\u3059\u308b\u3068\u554f\u984c\u304c\u751f\u3058\u308b\u3053\u3068\u306b\u6c17\u3065\u3044\u305f\u3002<br \/>\n\u73fe\u8c61\u3068\u3057\u3066\u306f\u4e00\u5ea6\u30aa\u30fc\u30d7\u30f3\u3057\u305f\u30dd\u30fc\u30c8\u3092\u30af\u30ed\u30fc\u30ba\u3059\u308b\u3068\u518d\u30aa\u30fc\u30d7\u30f3\u3067\u304d\u306a\u304f\u306a\u308b\u3068\u3044\u3046\u3053\u3068\u3002<br \/>\n\u30b3\u30fc\u30c9\u3067\u793a\u3059\u3068\u3001\uff12\u756a\u76ee\u306eopenPort:\u3067\u30a8\u30e9\u30fc\u306b\u306a\u308b\u3002<\/p>\n<pre>s := SerialPort new openPort: 'COM3'.\ns close.\ns openPort: 'COM3'.<\/pre>\n<p>\u3053\u308c\u306b\u3064\u3044\u3066\u306f\u65e2\u306b\u8b70\u8ad6\u304c\u306a\u3055\u308c\u3066\u3044\u305f\u3002<br \/>\n<a href=\"http:\/\/forum.world.st\/Package-for-manage-USB-RS232-td4744124.html\">http:\/\/forum.world.st\/Package-for-manage-USB-RS232-td4744124.html<\/a><br \/>\nSerialPort\u306e\u30bd\u30fc\u30b9\u3092\u773a\u3081\u3066\u307f\u308b\u3068\u3001primitiveClosePortByName:\u306b\u554f\u984c\u304c\u3042\u308b\u3088\u3046\u3060\u3002<\/p>\n<pre>primClosePortByName: portName\n\t<primitive: 'primitiveSerialPortCloseByName' module:'SerialPlugin'>\n\t^ nil\"(DNS)\"\n\t\"self primitiveFailed.\"<\/primitive:><\/pre>\n<p>\u308f\u3056\u308f\u3056self primitiveFailed\u304c\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3055\u308c\u3066\u3044\u308b\u306e\u306f\u3001\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u305f\u4eba\u304c\u3053\u306e\u554f\u984c\u3092\u8a8d\u8b58\u3057\u3066\u3044\u3066\u653e\u7f6e\u3057\u305f\u3063\u3066\u3053\u3068\u304b\u3002<br \/>\nSerialPort\u3067\u306f\u3042\u305f\u304b\u3082close\u304c\u6210\u529f\u3057\u305f\u304b\u306e\u3088\u3046\u306b\u898b\u305b\u304b\u3051\u3066\u3044\u308b\u306e\u3060\u304c\u3001\u5b9f\u969b\u306b\u306f\u3053\u306e\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u3092\u547c\u3093\u3060\u5f8c\u3001primOpenPortByName:\u3092\u547c\u3076\u3068\u5931\u6557\u3057\u3001SerialPort>>#openPort:\u306e\u4e2d\u3067\u30a8\u30e9\u30fc\u3068\u5224\u5b9a\u3055\u308c\u308b\u3002<br \/>\n\u5148\u307b\u3069\u306e\u30e1\u30fc\u30ea\u30f3\u30b0\u30ea\u30b9\u30c8\u306e\u3084\u308a\u53d6\u308a\u3067\u306fSerialPort>>#openPort:\u5185\u306e\u30a8\u30e9\u30fc\u5224\u5b9a\u90e8\u5206\u3092\u524a\u9664\u3059\u308c\u3070\u52d5\u304f\u3068\u3042\u308a\u3001\u8a66\u3057\u3066\u307f\u305f\u3089\u3061\u3083\u3093\u3068\uff12\u5ea6\u76ee\u3082\u30aa\u30fc\u30d7\u30f3\u3067\u304d\u305f\u3002\u8a72\u5f53\u7b87\u6240\u306f\u3053\u3053\u3002<\/p>\n<pre>\t\"result isNil ifTrue:[ self error:'Cannot open ', portId printString. ].\"<\/pre>\n<p>\u3053\u306e\u3088\u3046\u306b\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3057\u3066\u304a\u3051\u3070\u5192\u982d\u306e\u30c8\u30e9\u30d6\u30eb\u306f\u56de\u907f\u3067\u304d\u308b\u3002<br \/>\n\u3053\u308c\u3067\u3044\u3044\u306e\u304b\u751a\u3060\u7591\u554f\u3067\u3042\u308b\u304c\u3002<br \/>\n\u30d7\u30e9\u30b0\u30a4\u30f3\u306b\u554f\u984c\u3042\u308a\u305d\u3046\u3060\u304b\u3089\u6687\u3092\u898b\u3064\u3051\u3066\u539f\u56e0\u7a76\u660e\u3057\u3066\u307f\u3088\u3046\u3002<br \/>\n\u3068\u304b\u3044\u3063\u3066\u30d7\u30e9\u30b0\u30a4\u30f3\u95a2\u4fc2\u306f\u3044\u3064\u3082\u632b\u6298\u3057\u3066\u308b\u3051\u3069\u3002<br \/>\n\uff08\u3053\u3053\u304b\u3089\u8ffd\u8a18\uff09<br \/>\n<a href=\"https:\/\/github.com\/pharo-project\/pharo-vm\/blob\/master\/platforms\/win32\/plugins\/SerialPlugin\/sqWin32SerialPort.c\">\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u30bd\u30fc\u30b9<\/a>\u3092\u773a\u3081\u3066\u898b\u308b\u3068\u3001\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u65b9\u3067\u30cf\u30f3\u30c9\u30eb\u306e\u7ba1\u7406\u3092\u884c\u3063\u3066\u3044\u305f\u3002\u30dd\u30fc\u30c8\u3092\u540d\u524d\u3067\u306a\u304f\u756a\u53f7\u3067\u3082\u547c\u3079\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u305f\u306e\u306f\u305d\u306e\u305b\u3044\u304b\u3002<br \/>\nWindows\u3067\u306fCOM3\u306b\u5bfe\u5fdc\u3059\u308b\u756a\u53f7\u306f3\u306a\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8a66\u3057\u3066\u307f\u305f\u3089\u30aa\u30fc\u30d7\u30f3\u3082\u30af\u30ed\u30fc\u30ba\u3082\u554f\u984c\u306a\u304f\u52d5\u304f\u3067\u306f\u306a\u3044\u304b\u3002<\/p>\n<pre>s := SerialPort new.\ns openPort: 3.\ns primClosePort: 3.\ns openPort: 3.\ns primClosePort: 3.<\/pre>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067Windows\u4e0a\u3067\u306f\u756a\u53f7\u3067\u30dd\u30fc\u30c8\u3092\u6307\u5b9a\u3059\u308c\u3070\u5927\u4e08\u592b\u306a\u3088\u3046\u3060\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u300c\u306a\u306e\u307c\u30fc\u3069\u300d\u3092\u3064\u306a\u3052\u305fPC\u4e0a\u3067\u3001Fluo\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u884c\u3063\u3066\u3044\u308b\u306e\u3060\u304c\u3001\u4f8b\u306b\u3088\u3063\u3066SerialPort\u3067\u60a9\u307e\u3055\u308c\u3066\u3044\u308b\u3002 \u305a\u3063\u3068Mac OS X\u4e0a\u3067\u958b\u767a\u3057\u3066\u3044\u3066\u7279\u306b\u30c8\u30e9\u30d6\u30eb\u304c\u306a\u304b\u3063\u305f\u306e\u3067\u898b\u904e\u3054\u3057\u3066\u3044\u305f\u304c\u3001Windo&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[],"class_list":["post-2459","post","type-post","status-publish","format-standard","hentry","category-pharo"],"_links":{"self":[{"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/posts\/2459","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/comments?post=2459"}],"version-history":[{"count":0,"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/posts\/2459\/revisions"}],"wp:attachment":[{"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/media?parent=2459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/categories?post=2459"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/tags?post=2459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}