{"id":257778,"date":"2022-03-04T18:17:45","date_gmt":"2022-03-04T09:17:45","guid":{"rendered":"https:\/\/hldc.co.jp\/support\/?post_type=qna&#038;p=257778"},"modified":"2022-04-07T16:12:09","modified_gmt":"2022-04-07T07:12:09","slug":"qna-257778","status":"publish","type":"qna","link":"https:\/\/hldc.co.jp\/support\/qna\/qna-257778\/","title":{"rendered":"UART\u63a5\u7d9a\u306e\u30c9\u30e9\u30a4\u30d0\u30ab\u30b9\u30bf\u30de\u30a4\u30ba"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; admin_label=&#8221;section&#8221; _builder_version=&#8221;3.22&#8243; da_disable_devices=&#8221;off|off|off&#8221; global_colors_info=&#8221;{}&#8221; da_is_popup=&#8221;off&#8221; da_exit_intent=&#8221;off&#8221; da_has_close=&#8221;on&#8221; da_alt_close=&#8221;off&#8221; da_dark_close=&#8221;off&#8221; da_not_modal=&#8221;on&#8221; da_is_singular=&#8221;off&#8221; da_with_loader=&#8221;off&#8221; da_has_shadow=&#8221;on&#8221;][et_pb_row admin_label=&#8221;row&#8221; _builder_version=&#8221;3.25&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_text admin_label=&#8221;\u5192\u982d&#8221; _builder_version=&#8221;4.14.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;]UART\u63a5\u7d9a\u306b\u304a\u3044\u3066\u3001\u901a\u5e38\u306e\u30c6\u30b9\u30c8\u30dd\u30a4\u30f3\u30c8\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306b\u3001\u30c9\u30e9\u30a4\u30d0\u30d5\u30a1\u30a4\u30eb\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059\u3002[\/et_pb_text][et_pb_text admin_label=&#8221;\u672c\u6587&#8221; _builder_version=&#8221;4.14.2&#8243; _module_preset=&#8221;default&#8221; hover_enabled=&#8221;0&#8243; global_colors_info=&#8221;{}&#8221; sticky_enabled=&#8221;0&#8243;]<\/p>\n<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">Contents<\/p><ul class=\"toc_list\"><li><a href=\"#i\"><span class=\"toc_number toc_depth_1\">1<\/span> \u30b5\u30f3\u30d7\u30eb\u30c9\u30e9\u30a4\u30d0\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba<\/a><ul><li><a href=\"#_TP_BusUartInit\"><span class=\"toc_number toc_depth_2\">1.1<\/span> _TP_BusUartInit\u95a2\u6570\u3092\u8a18\u8ff0\u3059\u308b<\/a><\/li><li><a href=\"#_TP_BusOutDrv\"><span class=\"toc_number toc_depth_2\">1.2<\/span> _TP_BusOutDrv\u95a2\u6570\u3092\u8a18\u8ff0\u3059\u308b<\/a><\/li><\/ul><\/li><li><a href=\"#Includedefine\"><span class=\"toc_number toc_depth_1\">2<\/span> \u5404\u7a2eInclude\u3001define\u306e\u8a2d\u5b9a<\/a><ul><li><a href=\"#32bit\"><span class=\"toc_number toc_depth_2\">2.1<\/span> \u30bf\u30fc\u30b2\u30c3\u30c8\u74b0\u5883\u3067\u306e\u7b26\u53f7\u7121\u305732bit\u306e\u578b\u540d\u6307\u5b9a<\/a><\/li><li><a href=\"#Inline\"><span class=\"toc_number toc_depth_2\">2.2<\/span> \u95a2\u6570\u306eInline\u5316<\/a><\/li><li><a href=\"#i-2\"><span class=\"toc_number toc_depth_2\">2.3<\/span> \u30bf\u30fc\u30b2\u30c3\u30c8\u306e\u30b3\u30f3\u30d1\u30a4\u30eb<\/a><\/li><\/ul><\/li><\/ul><\/div>\n<h2><span id=\"i\">\u30b5\u30f3\u30d7\u30eb\u30c9\u30e9\u30a4\u30d0\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba<\/span><\/h2>\n<p>\u30b5\u30f3\u30d7\u30eb\u30c9\u30e9\u30a4\u30d0\u306f<a href=\"https:\/\/hldc.co.jp\/support\/by-product\/dtplus-trace\/download\/sample-driver\/\">\u3053\u3061\u3089<\/a>\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3044\u305f\u3060\u3044\u305f\u30c9\u30e9\u30a4\u30d0\u30d5\u30a1\u30a4\u30eb\u306f\u3001\u30bf\u30fc\u30b2\u30c3\u30c8\u74b0\u5883\u306b\u5408\u308f\u305b\u3066\u3001\u4e0b\u8a18\u306e\u5185\u5bb9\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<h3><span id=\"_TP_BusUartInit\">_TP_BusUartInit\u95a2\u6570\u3092\u8a18\u8ff0\u3059\u308b<\/span><\/h3>\n<p>_TP_BusUartInit\u95a2\u6570\u306f\u3001\u521d\u3081\u3066TP\u306e\u51fa\u529b\u304c\u884c\u308f\u308c\u308b\u969b\u306b\u4f7f\u7528\u3059\u308b\u30dd\u30fc\u30c8\u30ec\u30b8\u30b9\u30bf\u306e\u8a2d\u5b9a\u30fb\u521d\u671f\u5316\u3092\u884c\u3046\u95a2\u6570\u3067\u3059\u3002\u51fa\u529b\u5148\u306eCOM\u30dd\u30fc\u30c8\u306e\u6307\u5b9a\u3001\u53ca\u3073\u30dc\u30fc\u30ec\u30fc\u30c8\u3001\u30c7\u30fc\u30bf\u30d3\u30c3\u30c8\u30b5\u30a4\u30ba\u306a\u3069\u306e\u901a\u4fe1\u8a2d\u5b9a\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<pre><code>\/*==================================================================*\/\n\/* Func: _TP_BusUartInit                                            *\/\n\/* Desc: Please describe the code to initialize Uart ports.         *\/\n\/*==================================================================*\/\nstatic \u3000\u3000\u3000HANDLE hCom = 0;\nstatic\u3000\u3000\u3000DCB dcb;\nstatic void _TP_BusUartInit(void)\n{\nhCom = CreateFileA(\n\u3000\u3000\u3000\u3000\u3000\u3000\u201dCOM1\u2033, GENERIC_READ | GENERIC_WRITE, 0,\n\u3000\u3000\u3000 NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );\n\u3000\u3000\u3000GetCommState( hCom, &amp;dcb );\n\u3000\u3000\u3000dcb.BaudRate = 115200;\ndcb.ByteSize = 8;\n\u3000\u3000\u3000dcb.Parity = NOPARITY;\ndcb.StopBits = ONESTOPBIT;\n\u3000\u3000\u3000SetCommState( hCom, &amp;dcb );\n} \n<\/code><\/pre>\n<h3><span id=\"_TP_BusOutDrv\">_TP_BusOutDrv\u95a2\u6570\u3092\u8a18\u8ff0\u3059\u308b<\/span><\/h3>\n<p>_TP_BusOutDrv\u95a2\u6570\u306f\u3001\u30c6\u30b9\u30c8\u30dd\u30a4\u30f3\u30c8\u306e\u901a\u904e\u60c5\u5831\u51fa\u529b\u3092\u5236\u5fa1\u3059\u308b\u95a2\u6570\u3067\u3059\u3002<\/p>\n<p>\u203b\u30bf\u30fc\u30b2\u30c3\u30c8\u74b0\u5883\u306eOS\u304cWindows\u3001Linux\u306e\u5834\u5408\u306f\u3001\u3053\u3061\u3089\u306e\u5909\u66f4\u306f\u4e0d\u8981\u3067\u3059\u3002<\/p>\n<p>Uart_Send(hCom, buff, count, &amp;n, NULL);\u3092\u304a\u5ba2\u69d8\u306e\u30bf\u30fc\u30b2\u30c3\u30c8\u74b0\u5883\u306eUART\u9001\u4fe1\u7528\u306eAPI\u306b\u3054\u5909\u66f4\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><code>\/\/\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014-\n\/\/ Func: _TP_BusOutDrv\n\/\/ Desc: Test Point Output Function\n\/\/\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014-\nstatic int init = 0;\nDT_INLINE void _TP_BusOutDrv( unsigned char *buff, DT_UINT count )\n{\n\u3000\u3000\u3000int n;\n\u3000\u3000\u3000if( init == 0 ){\n\u3000\u3000\u3000\u3000\u3000\u3000_TP_BusUartInit();\n\u3000\u3000\u3000\u3000\u3000\u3000init = 1;\n\u3000\u3000\u3000}\n\u3000\u3000\u3000Uart_Send( hCom, buff, count, &amp;n, NULL );\n} \n<\/code><\/pre>\n<h2><span id=\"Includedefine\">\u5404\u7a2eInclude\u3001define\u306e\u8a2d\u5b9a<\/span><\/h2>\n<h3><span id=\"32bit\">\u30bf\u30fc\u30b2\u30c3\u30c8\u74b0\u5883\u3067\u306e\u7b26\u53f7\u7121\u305732bit\u306e\u578b\u540d\u6307\u5b9a<\/span><\/h3>\n<p><font color=\"Red\">\u901a\u5e38\u306f\u5909\u66f4\u4e0d\u8981\u3067\u3059\u3002<\/font>\u7b26\u53f7\u7121\u305732bit\u306e\u578b\u540d\u3092\u8a18\u8f09\u3057\u307e\u3059\u3002\u3082\u3057\u3053\u3061\u3089\u306e\u9805\u76ee\u3092\u5909\u66f4\u3057\u305f\u5834\u5408\u306f\u3001DT+Trace\u30a2\u30d7\u30ea\u5074\u306e\u8a2d\u5b9a\u3082\u5909\u66f4\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre><code>\/*=======================================================================*\/\n\/* Macro: DT_UINT                                                        *\/\n\/* Desc: Please change Test Point argument type for DT10 Project setting.*\/\n\/*=======================================================================*\/\n#define\u3000DT_UINT unsigned int \n<\/code><\/pre>\n<h3><span id=\"Inline\">\u95a2\u6570\u306eInline\u5316<\/span><\/h3>\n<p>\u30bf\u30fc\u30b2\u30c3\u30c8\u74b0\u5883\u306e\u95a2\u6570\u306eInline\u5316\u304c\u53ef\u80fd\u306a\u5834\u5408\u306f\u3001\u3053\u3053\u3067\u5b9a\u7fa9\u3057\u307e\u3059\u3002\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u306e\u524a\u6e1b\u306e\u70ba\u3001\u5404\u95a2\u6570\u3092Inline\u5316\u3057\u307e\u3059\u3002\u4e0d\u5fc5\u8981\u306a\u5834\u5408\u306f\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3057\u3066&quot;#define DT_INLINE static&quot;\u3092\u6709\u52b9\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre><code>\/*==========================================================================*\/\n\/* Macro: DT_INLINE                                                         *\/\n\/* Desc: Please use \u201cstatic\u201d instead of \u201cinline\u201d if \u201cinline\u201d cannot be used.*\/\n\/*==========================================================================*\/\n\/*#define\u3000DT_INLINE\u3000inline\n#define\u3000DT_INLINE\u3000_inline\u3000 \u3000\/* for Windows\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \u3000 \u3000\u3000*\/\n\/*#define\u3000DT_INLINE\u3000static\u3000\u3000\/* when \u201cinline\u201d cannot be used\u3000\u3000\u3000*\/ \n<\/code><\/pre>\n<h3><span id=\"i-2\">\u30bf\u30fc\u30b2\u30c3\u30c8\u306e\u30b3\u30f3\u30d1\u30a4\u30eb<\/span><\/h3>\n<p>\u304a\u4f7f\u3044\u306e\u958b\u767a\u74b0\u5883\u306b\u3001\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3057\u305f\u30c9\u30e9\u30a4\u30d0\u30d5\u30a1\u30a4\u30eb\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u3066\u3044\u305f\u3060\u304d\u3001\u554f\u984c\u306a\u304f\u30bf\u30fc\u30b2\u30c3\u30c8\u304c\u52d5\u4f5c\u3059\u308b\u304b\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>UART\u63a5\u7d9a\u306b\u304a\u3044\u3066\u3001\u901a\u5e38\u306e\u30c6\u30b9\u30c8\u30dd\u30a4\u30f3\u30c8\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306b\u3001\u30c9\u30e9\u30a4\u30d0\u30d5\u30a1\u30a4\u30eb\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059\u3002\u30b5\u30f3\u30d7\u30eb\u30c9\u30e9\u30a4\u30d0\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba \u30b5\u30f3\u30d7\u30eb\u30c9\u30e9\u30a4\u30d0\u306f\u3053\u3061\u3089\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u304f\u3060\u3055\u3044\u3002 \u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3044\u305f&#8230;<\/p>\n","protected":false},"author":6,"featured_media":0,"menu_order":1,"comment_status":"open","ping_status":"open","template":"","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","inline_featured_image":false,"footnotes":"","_links_to":"","_links_to_target":""},"qna_category":[33],"qna_tag":[48,45,46],"class_list":["post-257778","qna","type-qna","status-publish","hentry","qna_category-how-to","qna_tag-48","qna_tag-45","qna_tag-46"],"acf":[],"_links":{"self":[{"href":"https:\/\/hldc.co.jp\/support\/wp-json\/wp\/v2\/qna\/257778","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hldc.co.jp\/support\/wp-json\/wp\/v2\/qna"}],"about":[{"href":"https:\/\/hldc.co.jp\/support\/wp-json\/wp\/v2\/types\/qna"}],"author":[{"embeddable":true,"href":"https:\/\/hldc.co.jp\/support\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/hldc.co.jp\/support\/wp-json\/wp\/v2\/comments?post=257778"}],"version-history":[{"count":8,"href":"https:\/\/hldc.co.jp\/support\/wp-json\/wp\/v2\/qna\/257778\/revisions"}],"predecessor-version":[{"id":258325,"href":"https:\/\/hldc.co.jp\/support\/wp-json\/wp\/v2\/qna\/257778\/revisions\/258325"}],"wp:attachment":[{"href":"https:\/\/hldc.co.jp\/support\/wp-json\/wp\/v2\/media?parent=257778"}],"wp:term":[{"taxonomy":"qna_category","embeddable":true,"href":"https:\/\/hldc.co.jp\/support\/wp-json\/wp\/v2\/qna_category?post=257778"},{"taxonomy":"qna_tag","embeddable":true,"href":"https:\/\/hldc.co.jp\/support\/wp-json\/wp\/v2\/qna_tag?post=257778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}