{"id":946,"date":"2009-05-22T18:53:49","date_gmt":"2009-05-22T09:53:49","guid":{"rendered":"http:\/\/physicom.digick.jp\/?p=946"},"modified":"2009-09-06T22:08:22","modified_gmt":"2009-09-06T13:08:22","slug":"pic18f2550%e3%81%a8gt-720fgps%e3%82%92%e6%8e%a5%e7%b6%9a%e3%81%99%e3%82%8b%ef%bc%88%e3%82%bd%e3%83%95%e3%83%88%e7%b7%a8%ef%bc%89","status":"publish","type":"post","link":"http:\/\/physicom.digick.jp\/?p=946","title":{"rendered":"PIC18F2550\u3068GT-720F(GPS)\u3092\u63a5\u7d9a\u3059\u308b\uff08\u30bd\u30d5\u30c8\u7de8\uff09"},"content":{"rendered":"<p>\u7d44\u307f\u7acb\u3066\u307e\u3067\u306f\u554f\u984c\u7121\u304b\u3063\u305f\u3051\u3069\u3001\u3053\u308c\u304b\u3089\u52d5\u304f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u304f\u306e\u306b\u82e6\u52b4\u3057\u305f\u3002<br \/>\nPIC18F2550\u306a\u306e\u3067\u3001C18\u3092\u4f7f\u3046\u3068USART\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u95a2\u6570\u304c\u3042\u308a\u3001\u305d\u3093\u306a\u306b\u554f\u984c\u306a\u3055\u3052\u3060\u3063\u305f\u3002<\/p>\n<pre>\/\/ \u30e1\u30a4\u30f3\u95a2\u6570\r\nvoid main(void)\r\n{\r\n    char res;\r\n    unsigned char c = 0, y = 1;\r\n    TRISB = 0;        \/\/ PORTB\u5168\u90e8\u51fa\u529b\r\n    lcd_init();\r\n    lcd_clear();\r\n    lcd_goto(0,0);\r\n    lcd_str(STARTMSG);\r\n    Delay10KTCYx(200);\r\n    OpenUSART(USART_TX_INT_OFF & USART_RX_INT_OFF &\r\n              USART_ASYNCH_MODE & USART_EIGHT_BIT &\r\n              USART_CONT_RX & USART_BRGH_HIGH, 129);\r\n    lcd_goto(0,0);\r\n    lcd_str(WAITMSG);\r\n    lcd_goto(y,0);\r\n    while (!DataRdyUSART());\r\n    while (1) {\r\n        while (DataRdyUSART()) {\r\n            res = ReadUSART();\r\n            if (c < 16) {\r\n                c++;\r\n                lcd_data(res);\r\n            } else {\r\n                c = 0;\r\n                if (y == 0) {\r\n                    y = 1;\r\n                } else {\r\n                    y = 0;\r\n                }\r\n                lcd_goto(y,0);\r\n            }\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<p>\u30e1\u30a4\u30f3\u30eb\u30fc\u30d7\u306f\u7d50\u679c\u304b\u3089\u3059\u308b\u3068\u3001\u57fa\u672c\u7684\u306b\u3053\u308c\u3067OK\u3060\u3063\u305f\u3051\u3069\u3001<code>OpenUSART<\/code>\u306e\u5f15\u6570\u306e\u6700\u5f8c\u306e<code>USART_BRGH_HIGH, 129<\/code>\u90e8\u5206\u304c\u554f\u984c\u3060\u3063\u305f\u3002<br \/>\n\u30b5\u30f3\u30d7\u30eb\u3068\u304b\u306f\u3053\u306e\u7d44\u307f\u5408\u308f\u305b\u304c\u591a\u304f\u3066\u3001\u89e3\u8aac\u672c\u3067\u3082\u3053\u306e\u7d44\u307f\u5408\u308f\u305b\u3060\u3063\u305f\u306e\u3067\u3001\u4f55\u306e\u7591\u554f\u3082\u3044\u3060\u304b\u306a\u304b\u3063\u305f\u3002<br \/>\n\u3053\u306e\u90e8\u5206\u306f\u901a\u4fe1\u306e\u30dc\u30fc\u30ec\u30fc\u30c8\u3092\u6307\u5b9a\u3059\u308b\u90e8\u5206\u3067\u3001PIC\u306e\u52d5\u4f5c\u30af\u30ed\u30c3\u30af\u3092\u5143\u306b\u8a08\u7b97\u3057\u3066\u6c42\u3081\u308b\u3002<br \/>\n\u305f\u3060\u3001\u4e00\u822c\u7684\u306a\u30af\u30ed\u30c3\u30af\uff0840MHz, 20MHz, 10MHz\u306e3\u3064\uff09\u306f\u3059\u3067\u306b\u8a08\u7b97\u3055\u308c\u305f\u8868\u304c\u3042\u3063\u3066\u3001\u8868\u304b\u3089\u76ee\u7684\u306e\u30dc\u30fc\u30ec\u30fc\u30c8\u3067\u5f15\u3051\u3070OK\u3002<br \/>\n\u3067\u3082\u3001PIC18F\u306f\u5916\u90e8\u30af\u30ed\u30c3\u30af\u306e4\u500d\u306e\u30af\u30ed\u30c3\u30af\u3067\u52d5\u304b\u3059\u3068\u304b\u306e\u6a5f\u80fd\u304c\u3042\u3063\u3066\u3001\u81ea\u5206\u306ePIC18F2550\u306b\u306f20MHz\u306e\u30bb\u30e9\u30ed\u30c3\u30af\u3092\u3064\u3051\u3066\u3044\u308b\u3051\u3069\u3001\u5b9f\u969b\u306b\u4f55MHz\u3067\u52d5\u3044\u3066\u3044\u308b\u306e\u304b\u3088\u304f\u308f\u304b\u3063\u3066\u306a\u304b\u3063\u305f\u3002<br \/>\n\u3068\u306f\u3044\u3048\u3001\u305d\u306e\u307e\u307e\u3067\u52d5\u304f\u3068\u601d\u3063\u3066\u3044\u305f\u306e\u3067\u5909\u306a\u6587\u5b57\uff08\u4ee5\u4e0b\u3001\u6587\u5b57\u5316\u3051\u3068\u8a18\u3057\u307e\u3059\uff09\u304c\u51fa\u3066\u304d\u305f\u6642\u306f\u30d1\u30cb\u30af\u3063\u305f\u3002<br \/>\n\u6587\u5b57\u5316\u3051\u306b\u306a\u308b\u306e\u306f\u30dc\u30fc\u30ec\u30fc\u30c8\u304c\u9055\u3063\u3066\u3044\u308b\u306e\u304c\u539f\u56e0\u3068\u3044\u3046\u306e\u306f\u3001RS-232C\u306e\u901a\u4fe1\u3068\u304b\u8abf\u3079\u3066\u3044\u308b\u6642\u306b\u8aad\u3093\u3060\u306e\u3067\u30dc\u30fc\u30ec\u30fc\u30c8\u304c\u9055\u3046\u3093\u3060\u308d\u3046\u3068\u601d\u3063\u305f\u3002<\/p>\n<p>\u8868\u3092\u898b\u3066\u300140MHz, 20MHz\u3068\u3044\u308d\u3044\u308d\u6570\u5024\u3092\u8a66\u3057\u3066\u307f\u305f\u3057\u3001\u3055\u3089\u306b<code>USART_BRGH_LOW<\/code>\u306b\u3057\u3066\u307f\u305f\u308a\u3057\u305f\u3051\u3069\u3001\u6587\u5b57\u5316\u3051\u306f\u76f4\u3089\u306a\u3044\u3002<br \/>\n\u300c\u3053\u308c\u306f\u3001\u30af\u30ed\u30c3\u30af\u3092\u3061\u3083\u3093\u3068\u8abf\u3079\u306a\u3044\u3068\u30c0\u30e1\u3060\u306a\u300d\u3068\u601d\u3044\u3001Config Bits\u306e\u3068\u3053\u308d\u3092\u8abf\u3079\u305f\u3002<\/p>\n<pre>#pragma config FOSC = HSPLL_HS\r\n#pragma config WDT = OFF\r\n#pragma config PLLDIV = 5\r\n#pragma config CPUDIV = OSC1_PLL2\r\n#pragma config USBDIV = 2\r\n#pragma config PWRT = ON\r\n#pragma config BOR = ON\r\n#pragma config BORV = 3\r\n#pragma config LVP = OFF\r\n#pragma config VREGEN = ON\r\n#pragma config MCLRE = ON\r\n#pragma config PBADEN = OFF\r\n<\/pre>\n<p>PIC18F2550+20MHz\u30bb\u30e9\u30ed\u30c3\u30af\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u3001\u4eca\u307e\u3067\u3053\u306e\u8a2d\u5b9a\u3067\u52d5\u3044\u3066\u3044\u305f\u3002<br \/>\n\u3067\u3082\u3001\u3044\u308d\u3044\u308d\u8abf\u3079\u3066\u307f\u308b\u3068PLL\u3067\u00d74\u3067\u52d5\u304b\u3059\u5834\u5408\u3001\u6700\u5927\u306710MHz\u307e\u3067\u3060\u305d\u3046\u3067\u300120MHz\u3092\u3064\u306a\u3044\u3067 <code>FOSC = HSPLL_HS<\/code> \u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u306f\u3044\u304f\u3064\u3067\u52d5\u304f\u306e\u304b\u308f\u304b\u3089\u306a\u3044\u3002<br \/>\n\u306a\u306e\u3067\u3068\u308a\u3042\u3048\u305a <code>FOSC = HS<\/code> \u306b\u3057\u306620MHz\u3067\u52d5\u304f\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u3066\u300120MHz\u7528\u8a2d\u5b9a\u5024 <code>USART_BRGH_HIGH, 129<\/code> \u306b\u8a2d\u5b9a\u3057\u3066\u307f\u305f\u3089\u52d5\u3044\u305f\u3002<\/p>\n<p>Config Bits\u306e\u8a2d\u5b9a\u306f\u3042\u307e\u308a\u3088\u304f\u308f\u304b\u3063\u3066\u306a\u3044\u306e\u3067\u3001\u4e00\u5ea6\u3061\u3083\u3093\u3068\u898b\u76f4\u3059\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7d44\u307f\u7acb\u3066\u307e\u3067\u306f\u554f\u984c\u7121\u304b\u3063\u305f\u3051\u3069\u3001\u3053\u308c\u304b\u3089\u52d5\u304f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u304f\u306e\u306b\u82e6\u52b4\u3057\u305f\u3002 PIC18F2550\u306a\u306e\u3067\u3001C18\u3092\u4f7f\u3046\u3068USART\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u95a2\u6570\u304c\u3042\u308a\u3001\u305d\u3093\u306a\u306b\u554f\u984c\u306a\u3055\u3052\u3060\u3063\u305f\u3002 \/\/ \u30e1\u30a4\u30f3\u95a2\u6570 void main(v &hellip; <a href=\"http:\/\/physicom.digick.jp\/?p=946\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[8,142],"tags":[174,157,169,173,214],"class_list":["post-946","post","type-post","status-publish","format-standard","hentry","category-pic","category-software","tag-c18","tag-pic18f2550","tag-rs-232c","tag-usart","tag-sourcecode"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/physicom.digick.jp\/index.php?rest_route=\/wp\/v2\/posts\/946","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/physicom.digick.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/physicom.digick.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/physicom.digick.jp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/physicom.digick.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=946"}],"version-history":[{"count":12,"href":"http:\/\/physicom.digick.jp\/index.php?rest_route=\/wp\/v2\/posts\/946\/revisions"}],"predecessor-version":[{"id":1362,"href":"http:\/\/physicom.digick.jp\/index.php?rest_route=\/wp\/v2\/posts\/946\/revisions\/1362"}],"wp:attachment":[{"href":"http:\/\/physicom.digick.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=946"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/physicom.digick.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=946"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/physicom.digick.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}