å€ãã®å Žåãé£ç¶ã¹ããªãŒã ã§ããŒã¿ãããã¯ã転éããå¿ èŠãããå Žåã«ç¶æ³ãçºçããŸãã ãã®å ŽåãããŒã¿ã®ãããã¯ãå¥ã®ãããã¯ããåé¢ããæ¹æ³ã®åé¡ãåé¢ã«åºãŠããŸãã åé¡ã¯ãããŒã¿ããã€ããªã§éä¿¡ãããããã¹ãã§éä¿¡ããããšããèæ¯ã«ãªããŸãã ããã«å ããŠãå°ããªæªã¿ïŒæ倱ããŽããçžäºäœçšããããŒãã®ãšã©ãŒïŒãåŠçãç¶ããèœåãšãããŒã¿äŒéãã£ãã«ã®å¹ççãªå©çšã®å¿ èŠæ§ãè¿œå ããŸãã ãã®å Žåãã¿ã¹ã¯ã¯éããããªãœãŒã¹ã®ã·ã³ãã«ãªãã€ã¯ãã³ã³ãããŒã©ãŒã§è§£æ±ºããå¿ èŠããããŸãã
ãã®ãããªã¿ã¹ã¯ã¯ãããšãã°ããã¬ã¡ããªéä¿¡ããªã¢ãŒãæ©åšã®å¶åŸ¡ã§çºçããŸãã äžæ¹ã«ã¯ãéåžžãåçŽãªãã€ã¯ãã³ã³ãããŒã©ãŒããããä»æ¹ã«ã¯ãã³ã³ãã¥ãŒã¿ãŒããããŸãã ãããã®éã®éä¿¡ã¯ãå€ãè¯ãRS232ã§å®è¡ã§ããŸãã ããšãã°ãUARTãã€ã¯ãã³ã³ãããŒã©ã®åºåã802.11bã«å€æããããšãããã«å°é£ã«ãªãå¯èœæ§ããããŸãããç¡ç·ä¿¡å·ã¯ç¡ç·ãã¹ãã«äŒæããã€ãŒãµãããããµãŒããŒã«å±ããŸãã
ãã®ããŒãã§ç§ã®èªè»¢è»ãé¢çœãå Žåã¯ãç«ã«ããããã
ãŸããèŠä»¶ã決å®ããŸãã
- ãã£ã³ãã«ã¯ãã€ã§ãäœæã§ããŸãã
- ã³ã³ãããŒã©ãŒãšã³ã³ãã¥ãŒã¿ãŒã¯ãããŒã¿è»¢éã®éäžãå«ãããã€ã§ããã£ãã«ã«æ¥ç¶ã§ããŸãã
- ãã£ãã«ãæªãã§ããå Žåã察å¿ããããŒã¿ãããã¯ã¯ç Žæ£ããå¿ èŠããããŸãã
- 1ã€ã®ãã£ãã«ã«è€æ°ã®ããã€ã¹ãå«ããããšãã§ããŸãã
- ããŒã¿ãããã¯ã«ã¯ãä»»æã®ãã€ãã·ãŒã±ã³ã¹ãå«ããããšãã§ããä»»æã®é·ãã«ããããšãã§ããŸãã
- ãããã³ã«ããµããŒãããããã«å²ãåœãŠããããªãœãŒã¹ã¯éåžžã«éãããŠããŸãã
ãªã¢ãŒãã§UDPã«äŒŒãå®è£ ãå€æããŸããã
3ã€ã®æ°åã®ãã¹ãã¬ã¹ãã1ã€ã®ãããã¯ãšããŠè»¢éããä»ã®2ã€ã®æ°åãã枩床ããå¥ã®ãããã¯ãšããŠè»¢éããäŸã«ã€ããŠãããã€ãã®äžè¬çãªæ¹æ³ãæ€èšããŸãã
å€ãã®å Žåãããã¹ã圢åŒã§éä¿¡ããããã¹ãŠã®ããŒã¿ãå€æããæ¹è¡ã§ãããã¯ïŒãã±ããïŒãåé¢ããããšã«ããããã®åé¡ã®è§£æ±ºçããããŸãã
次ã®ããã«ãªããŸãã
V 1231ã2400ã-231
V 1333ã2100ã-232
T 36ã-40
Sprintfã䜿çšãããŸãïŒbufããVïŒ dãïŒ dãã...ïŒã
äŒéã®åé¡ïŒsprintfã¯ããªãã®éã®ã¹ã¿ãã¯ãããªãé·ãæé䜿çšããŸãã
åä¿¡ã®åé¡ïŒã³ã³ãããŒã©ãŒã§ã¯ãã-232ãæåã»ãããintã«å€æããã«ã¯è¿œå ã®ãªãœãŒã¹ãå¿ èŠã§ãã åå¶åŸ¡ãªãã100,500ãšã©ãŒãã§ãã¯æ¡ä»¶ã
ãã©ã¹ãšããŠ-人ã¯éä¿¡ããããã©ã¡ãŒã¿ãèçŒã§èŠãããšãã§ããŸãã
ãããžã§ã¯ãããã®ãããã³ã«ã§éçºãç¶ãããšããã°ãããããšãããç¶æããããšãäžå¯èœã«ãªãã人äœåæã®å©çšå¯èœæ§ãã倱ãããŸãã
10é²æ°ã§ã¯ãªã16é²æ°ãéä¿¡ããããšã§åé¡ãéšåçã«è§£æ±ºããããšãã§ããŸã-ããã¯åŠçãç°¡çŽ åããŸãããä»ã®åé¡ãä¿åããŸããã
å¶åŸ¡ãæ¹åããããã«ãéä¿¡ãããããŒã¿ãXMLã§ã©ããã§ããŸãã
<?xml version="1.0" encoding="UTF-8"?> <voltages> <voltage num=â1â>1231</voltage> <voltage num=â1â> 2400</voltage> <voltage num=â1â> -231</voltage> </voltages>
ãŸãã¯ãJSONã§ã©ããããããšãã§ããŸãã
{ âVoltagesâ: [1231, 2400, -231] }
ãããã³ã«ã¯ææžåãããŸãã ãããåæã«ãã³ã³ãã€ã«æ®µéã§ã¯åå¶åŸ¡ã¯ãŸã ãããŸããã ãŸããè¿œå ã§éä¿¡ãããããŒã¿ã®éãéå°ã«å€§ãããªããŸãã åæã«ãéããããªãœãŒã¹ã§æ°å€ãšããã¹ãã解æããåé¡ãæ®ããŸãã
ããŒãã®1ã€ãç¶ç¶çã«äœããéä¿¡ããå Žåã2çªç®ã®ããŒããæ¥ç¶ããç¬éã¯ãéä¿¡ãããããŒã¿ã®éäžã«ãªãå¯èœæ§ããããŸãã ã»ãšãã©ã®å Žåãæ°ããèµ·åããããŒãã§ããã±ãŒãžã®éå§ã確å®ã«å€æããããšã¯ã§ããªããããã©ã€ã³ãã£ãŒããåŸ ã€ããéã«é Œãå¿ èŠããããŸãã ããã«ãæ£ç¢ºãã®ããã®ãã±ããå¶åŸ¡ã¯ãããŸããïŒããšãã°ãè¿ãé·éšã®ããã1ãããã誀ã£ãŠéä¿¡ãããŸããïŒã ãããã®æ¬ ç¹ã¯ãNMEAãããã³ã«ãšåæ§ã®ã¢ãããŒãã䜿çšããŠè§£æ±ºã§ããŸãã
$ GNVLTã1231,2400ã-231 * 71
ããã§ã¯ãããã±ãŒãžã®å é ã¯åžžã«$ã§ãããã±ãŒãžã®æ«å°Ÿã¯ããã±ãŒãžããŒã¿ã®ã¢ã¹ã¿ãªã¹ã¯ãšCRCïŒ0x71ïŒã§ãã ããã«ãããäžæ£ãªããã±ãŒãžã®åé¡ã¯è§£æ±ºããŸãïŒããã§ã®å€å žçãªCRCã¯éåžžã«åçŽã§ã-XORïŒããããã±ãŒãžã®çš®é¡ã®ææžåãšå¶åŸ¡ã®åé¡ããŸã ãããŸãã
ããã¹ãã¹ããªãŒã ã䜿çšããå ŽåããªãŒããŒããããå€ããåã®å¶åŸ¡ããããã§ãããææžåãå°é£ã§ããããšãããããŸãã
ãã€ããªããŒã¿è»¢éãæ€èšããŠãã ããã ãã€ãã»ãããéä¿¡ããããããæ§é ã決å®ããå¿ èŠããããŸãã
typedef struct { int16_t supplyIn; int16_t supplyOut; int16_t groundPotential; }PackVoltages; typedef struct { int8_t internal; int8_t outside; }PackTemperature;
é»å§ã«ã¯6ãã€ãã枩床ã«ã¯2ãã€ãããããŸãã
ãããã®æ§é ã1ã€ã«çµã¿åãããããã«ãããã³ã«ãæ¡åŒµããããã«ããã«å¥ã®5ãã€ããè¿œå ããæ§é ã«éä¿¡ããŒã¿ã®ã¿ã€ããå ¥åã§ããŸãã
typedef struct{ char type; union { PackVoltages voltages; PackTemperature temperatures; }Data; char rezerv[5]; }FullPack;
16ãã€ãã®ãã±ããïŒã¢ã©ã€ã³ã¡ã³ããæ確ã§ãªãããïŒãåãåããŸããã12ãã€ãã§ã¯ãªãããã«èŠããŸãïŒãã®äŸã§ã¯ãããã¯åé¡ã§ã¯ãããŸããããã¢ã©ã€ã³ã¡ã³ããããšãã¯æ³šæãå¿ èŠã§ãïŒã ã¿ã€ããã€ããããã³ã°ã®ã³ã³ãã€ã©ãªãã·ã§ã³ãæå¹ã«ã§ããŸãããå¥ã®åé¡ãçºçããå¯èœæ§ããããŸã-äžéšã®ããã»ããµïŒARMã³ã¢äžïŒãã¢ã©ã€ã¡ã³ããããŠããªãããŒã¿ãèªã¿åãããšãã§ãããåå¿è ã®Jediããã®ãšã©ãŒãèŠã€ããã®ã¯ããã»ã©ç°¡åã§ã¯ãããŸããã
ããã«16ãã€ããåžžã«ãã£ãã«ã«è»¢éãããŸãã åä¿¡åŽã¯æ¬¡ã®16ãã€ããåŸ ã¡ã次ã®ãã±ãããåŠçããŸãã CRCããªãããšã¯ç°¡åã«ããããŸãã CRCãè¿œå ïŒ
typedef struct{ char type; union { PackVoltages voltages; PackTemperature temperatures; }Data; char rezerv[5]; char CRC; }FullPack;
ãã±ãããµã€ãºã¯16ãã€ãã®ãŸãŸã§ãã ããŒã¿ãéä¿¡ãããšãã¯ãããã±ãŒãžã®ã¿ã€ããèšé²ããèšç®ããŠCRCããã±ãŒãžã«å ¥ããŠãããåä¿¡ããããã±ãŒãžãéä¿¡ããå¿ èŠããããŸãã
ãã®ã¢ãããŒãã®å©ç¹ã¯ãããã±ãŒãžãåŠçãããšãã«ãã³ã³ãã€ã«æã«åå¶åŸ¡ã衚瀺ãããããšã§ãã æ°å€ãšããã¹ããšã®éã®äžèŠãªå€æã¯ãããŸããã ããŒã¿ã®åä¿¡éšåã¯åžžã«åããµã€ãºã§ã-äºåã«ã¡ã¢ãªãå²ãåœãŠããšäŸ¿å©ã§ãã
å€ãã®æ¬ ç¹ããããŸããéä¿¡ããŒã¿ã®é·ããå€§å¹ ã«ç°ãªãå Žåãå°ããªå€ããæ°ååãŸã§ã®ããŒã¿éä¿¡ã«ã¯äžèŠãªãªãŒããŒãããã³ã¹ãããããŸãã ãã®åææ¹æ³ã¯ãTCPãã£ãã«ãä»ããã¯ã©ã€ã¢ã³ããšãµãŒããŒã®å¯Ÿè©±ã«é©ããŠããŸããéäžã§å€±ããããã®ã¯ãªãããã±ããã®å é ã¯åžžã«èªèãããŠããŸãã åæåãããåŸã®ãã£ãã«ãžã®æ¥ç¶ã®ç¶æ³ã§ã¯ãæåã®æ°ãã€ããå°éããŠããªãç¶æ³ãèããããŸãã ãã®åŸãåä¿¡ãããã¹ãŠã®ãã±ããã¯ãã®ãã€ãæ°ã ãã·ããããããã®äžã®ããŒã¿ã¯åœç¶äžæ£ã«ãªããŸãã ãŸããCRCããããããããããããšãããŒããšã®æ¥ç¶ã¯ãªããªããŸãã 1/256ã®ç¢ºçã§ããå£ããããã±ãããèŠéãå¯èœæ§ããããŸãã ãã±ããã®ãéå§ãã®çœ²åãã€ããéä¿¡ããããšã§ãã®åé¡ã解決ããããšãã§ããŸããããã€ããªããŒã¿ãéä¿¡ãããšãåããã€ããããŒã¿èªäœã«ãçºçããå¯èœæ§ããããŸãã ãããã£ãŠããã±ããã®éå§ã確å®ã«å€æã§ãããšã¯éããŸããã å¥ã®åé¡ã¯ãå€æ°ã®ã¢ã©ã€ã¡ã³ãã§ãã ãã±ããããããŒããšã«1ãã€ããå¿ èŠã§ãã32ãããã®æ°å€ã¯ããŒã¿èªäœã«å«ãŸããŠããããšãå€ãã0ã2ãã€ãã®å®æçãªããŒã¿ã·ãããçºçããŸãã è¿·æãªè¿·æã¯ãç°ãªãã¿ã€ãã®ãã±ãããéä¿¡ãããšãã«CRCããæåã§ãèšç®ããå¿ èŠãããããšã§ãã
å¥ã®ãªãã·ã§ã³ã¯åã®ãã®ãšäŒŒãŠããŸãããã±ããã®å é ã§ãã€ãã転éãããªãŒããŒããããåæžããããã«ãå®éã®é·ããéä¿¡ãããŸãã ãã®ã¢ãããŒãã®åé¡ã¯ããã±ãããäºåã«å®å šã«ã«ãŠã³ãïŒã€ãŸããã¡ã¢ãªã«åãŸãïŒããŠããéä¿¡ããå¿ èŠãããããšã§ãã ããã¯ãç¹ã«å€§ããªããã±ãŒãžã®å Žåããã€ã¯ãã³ã³ãããŒã©ãŒã®éããããªãœãŒã¹ã§ã¯å°é£ãªã¿ã¹ã¯ã«ãªãå¯èœæ§ããããŸãã ããã«ãã©ã€ãã©ãªãããã±ãŒãžå šäœãåä¿¡ãããŸã§ã転éãéå§ã§ããããã£ãã«ã®åž¯åå¹ ãšé 延ã«æªåœ±é¿ãäžããå¯èœæ§ããããŸãã ãã®ä»ã®æ¬ ç¹ãšå©ç¹ã¯ãåã®ãªãã·ã§ã³ãšåæ§ã§ãã
ãããŠãæ€èšäžã®æåŸã®ã¡ãœããã¯ãç§ã®ã©ã€ãã©ãªã§ã䜿çšãããŠããŸãã æŽå²çãªååã¯ãbinãããã³ã«ãŸãã¯BINãããã³ã«ã§ãã
ãã€ããªããŒã¿ãéä¿¡ããå Žåãç¹å¥ã«å²ãåœãŠããããã€ãã§åºåãããšãã§ããŸãã åæã«ããã®ãã€ããããŒã¿å ã§èŠã€ãã£ãå Žåãå¥ã®ãã€ãã·ãŒã±ã³ã¹ã«çœ®ãæããŸãã åä¿¡ããããéã®æé ãå®è¡ããŸãã ãã®ã¡ãœããã¯ããã€ãã¹ã¿ããã£ã³ã°ããšåŒã°ããŸãïŒ Flexzãšããååã«æè¬ããŸã ïŒ
CRCã®ã«ãŠã³ãããã±ããã®éä¿¡ãå§ä»»ããŸãã
ç°ãªãå€æãæ©èœãããã«ã¯ã3ãã€ããäºçŽããå¿ èŠããããŸãã ããããããŸãäžè¬çã§ãªãããã«ããããéžæããããšãæåã§ãã ãã€ã眮æã«ãŒã«ïŒ
<å ±æ> = <å ±æ> <å ±æ>
<æçµ> = <å ±æ> <ãªãã·ã§ã³>
<ãªãã·ã§ã³> = <ãªãã·ã§ã³>
ããã¯ãããŒã¿ã¹ããªãŒã ã§<Final>ã宣èšã§ããªãããšã瀺ããŠããŸãã
ããã±ãŒãžã¯æ¬¡ã®æ¹æ³ã§äœæã§ããŸãã
<å ±æ> Protocol_Data <æçµ>
ä¿¡é Œæ§ãé«ãããå Žåã¯ã次ã®æ¹æ³ã§ããã±ãŒãžãäœæã§ããŸãã
<Final> <Separator> Protocol_Data <Separator> <Final>
2çªç®ã®åœ¢åŒã§ã¯ãæå·ããå°ããªãã±ããã®æåŠçãçŽ15ïŒ å¢å ããŸããããªãŒããŒãããã¯åã10-15ïŒ å¢å ããããããã以äžã¯èæ ®ãããŸããã
ãããã£ãŠããã±ãããåä¿¡ãããšããä»»æã®æç¹ã§æ¥ç¶ããŠããã å ±æãã·ã³ãã«ããã±ããã®åä¿¡ãéå§ããã®ãåŸ ã€ã ãã§ååã§ãã ãããŠã<Final>ãã€ããåä¿¡ããåŸã«ã®ã¿ããã±ããã®æ£ç¢ºæ§ã確èªããåŠçã®ããã«éä¿¡ããå¿ èŠããããŸãã
ããã§ããprotocol_dataãã®æ§æã確èªã§ããŸãã
ããããŒïŒ1ãã€ã-ãã±ããã¿ã€ãã1ãã€ãã®å®å ã¢ãã¬ã¹
ããŒã¿ïŒäžèšã®ã«ãŒã«ã«åŸã£ãŠåŠçãããããŒã¿èªäœ
CRCïŒ1ãã€ããäžèšã®ã«ãŒã«ã«åŸã£ãŠãåŠçãããŸã
ã€ãŸããä»»æã®ãã€ãæ°ãéä¿¡ã§ãããã±ããã®å é ãšæ«å°Ÿã®ããŒã«ãŒã§ã©ããããããã±ããã¿ã€ããå®å ã¢ãã¬ã¹ãããã³CRCãè¿œå ãããŸãã
ç§ãã¡ã®å Žåãããã¯ããŒã¿æ§é ã®å®çŸ©ã®ããã«ãªããŸãã
typedef struct { int16_t supplyIn; int16_t supplyOut; int16_t groundPotential; }PackVoltages; typedef struct { int8_t internal; int8_t outside; }PackTemperature;
ãããŠãæåã®æ§é ãèšå·ãVãã§ç€ºããã2çªç®ã®æ§é ããTãã§ç€ºããããšããç¥èã ãããã®ãã©ã¡ãŒã¿ã®è»¢éã¯ã3ã€ã®ãã©ã¡ãŒã¿ãæã€é¢æ°ã«ãã£ãŠå®è¡ãããŸããããã¯ããã±ããã®ã¿ã€ããéä¿¡ããŒã¿ã®å é ã®ã¢ãã¬ã¹ãããã³éä¿¡ããŒã¿ã®é·ãã§ãã
BP_SendMyPackïŒ 'T'ãïŒpackTemperatureãsizeofïŒPackTemperatureïŒïŒ;
ãããŠãäŒéãã£ãã«ã«ã¯ã次ã®ãããªã·ãŒã±ã³ã¹ããããŸãã
å°ããªããã±ãŒãžã§ã¯ãããªã倧ããªãªãŒããŒããããåŸãããŸãããããã±ãŒãžã®ãµã€ãºã倧ãããªããšèŠããªããªããŸãã
ç°è²ã¯éä¿¡ãããŠããå®éã®æ å ±ã瀺ããçœã¯å¿ èŠãªæå°éã®ãµããŒãæ å ±ã瀺ããé»è²ã¯binãããã³ã«ã®ãªãŒããŒãããã瀺ããŸãã
ãã®ã¢ãããŒãã®å©ç¹ã¯ããªãŒããŒããããã»ãšãã©ãªããä»»æã®æ¥ç¶ãåé¡ã«ãªãããé©åãªã¬ãã«ã®ããŒã¿æœè±¡åãããããšã§ããåãæ©èœã䜿çšããŠãç°ãªãããã€ã¹ãããã°ã©ã ããããã³ã«ã§éåä¿¡ã§ããŸãã ã³ã³ãã€ã«æ®µéã§é©åãªåå¶åŸ¡ãå®çŸã§ããŸãã ããŒã¿èªäœã¯ããã°ã©ã å ã§æ£ããæ¹æ³ã§èª¿æŽã§ããŸããããã«ããããã±ãããéä¿¡ãããšãã«äœåãªãã€ããè¿œå ãããããšã¯ãããŸããã
çæïŒãã±ããã®ã¿ã€ããšãã±ããã®ã¢ãã¬ã¹ã¯ç¹æ®æåãšåãã«ããããšã¯ã§ããã1ãã254ã®å€ããšãããšãã§ããŸããCRCãã€ãã¯1ã€ã ãã§ãããããå£ãããã±ãããæ¬ èœãã確çã¯1/256ã§ãã
ç°ãªãã¢ãŒããã¯ãã£éã§ãã©ã¡ãŒã¿ããã€ããªåœ¢åŒã§æž¡ãå Žåã ãã€ãé ãèæ ®ããå¿ èŠããããŸã ã éããçããå Žåã¯ããã€ãé ãå察ã«çœ®ãæããå€æé¢æ°ã䜿çšããå¿ èŠããããŸãã
ãããã³ã«ã®å®äŸãšããŠãQTã®å°ããªããã°ã©ã ãæ·»ä»ãããŠããŸãã èµ·åæã«ãããã°ã©ã ã¯TCPãœã±ãããéãããã®ãœã±ããã«æ¥ç¶ããããã®ãã©ã¡ãŒã¿ãŒã䜿çšããŠèªåèªèº«ãåèµ·åããŸãã ã€ãŸããããã°ã©ã ã®2ã€ã®ã»ãŒåäžã®ã€ã³ã¹ã¿ã³ã¹ãäœæãããTCPãœã±ãããä»ããŠçžäºæ¥ç¶ãããŸãã å¿ èŠã«å¿ããŠãå¿ èŠãªããŒããéå§ããŠãããã°ã©ã ã®ãµãŒããŒãŸãã¯ã¯ã©ã€ã¢ã³ããåå¥ã«å®è¡ã§ããŸãã
å©çšå¯èœãªããŒïŒ
-dedicated-ãµãŒããŒãäœæããæ¥ç¶ãã©ã¡ãŒã¿ãŒãã³ã³ãœãŒã«ã«è¡šç€ºããŸãã
-child-æå®ãããå±æ§ã«æ¥ç¶ããŸãïŒ
-AïŒ11.22.33.44 -IPæ¥ç¶ã¢ãã¬ã¹ïŒããã©ã«ãlocalhostïŒ
-PïŒ12345-æ¥ç¶ããŒã
ããŒãªã-ãµãŒããŒãšã¯ã©ã€ã¢ã³ããèµ·åããããããæ¥ç¶ããŸãã
ããã°ã©ã -ãã€ããªãããã³ã«ãä»ããŠãŠãŒã¶ãŒã¢ã¯ã·ã§ã³ããœã±ããã«å€æãããªã¿ãŒã³ãã£ãã«ããªãã¹ã³ããåä¿¡ããããŒã¿ã«åºã¥ããŠã¢ã¯ã·ã§ã³ãå®è¡ããŸãã
ããã°ã©ã ã§ã¯ãé»ãèæ¯äžã®ããŠã¹ãã¿ã³ã¯ããã¿ã³ãæŸããããŸã§æ¡å€§åãæããŸãã äžã®è¹ã®åž¯ãã¯ãªãã¯ãããšãçŸåšã®è²ãå€ãããŸãã 2å°ã®ç°ãªãã³ã³ãã¥ãŒã¿ãŒããèµ€ã¡ãããšãã¢ãæãã®ã¯ãšãŠã楜ããã§ã:)
ãã€ããªãããã³ã«ã䜿çšããããã®èª¬æã
MainWindowã¯ã©ã¹ã§ã¯ããã¹ãŠã®ãããã³ã«ãšTCPæ¥ç¶ã®çžäºäœçšãåéãããŸãïŒTCPã®ä»£ããã«ãä»ã®ãã®ã䜿çšã§ããŸãïŒã
ã³ã³ã¹ãã©ã¯ã¿ãŒMainWindow :: MainWindowã¯ããã©ã€ããŒãé¢æ°initBinProtocolïŒïŒãåŒã³åºããŸãã ãããã³ã«ãåæåããŸãã åãå Žæã§ããçºè¡ãã€ããglobalSendCharToExternalïŒïŒã®é¢æ°ã®ã¢ãã¬ã¹ããããã³ã«ã«æž¡ãããŸãã 次ã«ãTCPãœã±ããå ã®æåã®ã·ã°ãã«å°çã®ãã³ãã©ãŒãReadFromParentïŒïŒã«ã€ã³ã¹ããŒã«ãããæçµçã«æåããšã«ãã¹ãŠã®åä¿¡ãã€ãããããã³ã«ãã³ãã©ãŒã«è»¢éãããŸãã
TCPãæ¥ç¶ããåŸãå¥ã®ReadFromChildïŒïŒãã³ãã©ãŒãæ¥ç¶ãããã»ãã·ã§ã³ã§ãã³ã°ããŸããããã¯åæ§ã«ãåä¿¡ãããã¹ãŠã®ãã€ãããããã³ã«ãã³ãã©ãŒã«è»¢éããŸãã
PackTypes.hãã¡ã€ã«ã«ã¯ããã¹ãŠã®ã¿ã€ãã®éä¿¡ãã±ãããå«ãŸããŠããŸãã ããã¯å®éã«ã¯ãããã³ã«ã®èª¬æã§ãã ã¿ã€ãTPackAllTypesã¯ãã³ã³ãã¥ãŒã¿ãŒã§ã®åŠçã容æã«ããããã«å°å ¥ããããã®ã§ããã€ã¯ãã³ã³ãããŒã©ãŒã§ãã®ã¿ã€ãã䜿çšããå¿ èŠã¯ãããŸããã
PaintBoxã¯ã©ã¹ã«ã¯ããããã³ã«èªäœãå«ãŸããŠããŸãã ããã°ã©ã ã®ä»ã®ã€ã³ã¹ã¿ã³ã¹ããã®ããã±ãŒãžã¯ãã¿ã€ããŒã«ãã£ãŠ50ããªç§ããšã«ãã§ãã¯ãããŸãã å¿ èŠã«å¿ããŠããã±ããå šäœã®æåŸã®ãã€ããåä¿¡ããåŠçãå®è¡ã§ããŸãã
ã€ãã³ãã¯ãããŠã¹ãã¿ã³ãæŒãããŠé¢ããããšããããã³BP_SendMyPackïŒïŒé¢æ°ãä»ããŠãã¯ãªã¢ããã¿ã³ãæŒããããšãã«ãããã³ã«ã«éä¿¡ãããŸãã æåã«ããã€ããªãã©ã¡ãŒã¿å€ãæã€æ§é ãå ¥åããã次ã«éä¿¡ãããŸãã ã¯ãªãŒãã³ã°ã³ãã³ããéä¿¡ããã«ã¯-ããŒã¿ã¯äžèŠã§ãéä¿¡ãããã®ã¯ã³ãã³ããã€ãã®ã¿ã§ãã
PaintBox :: timerCheckPacksïŒïŒé¢æ°ã§ã¯ããããã³ã«ãããã¡ãŒå ã®æ¢åã®ã³ãã³ãïŒ BP_IsPackReceivedïŒïŒ ïŒãšãã®å®è¡ã«å¯ŸããŠå®æçãªãã§ãã¯ãå®è¡ãããŸãã
Types.hãã¡ã€ã«ã«ã¯ãç°ãªããã©ãããã©ãŒã çšã®ç°ãªãã³ã³ãã€ã©ãŒã«ããã¯ãã¹ã³ã³ãã€ã«ã®ããã®åæ§ã®åºæ¬ã¿ã€ãã®å®çŸ©ãå«ãŸããŠããŸããå Žåã«ãã£ãŠã¯ãç·šéããå¿ èŠããããŸãã
äžè¬ã«ãã³ãŒãã¯ææžåãããŠãããããææ¡ããã®ã¯é£ãããããŸããã
ã©ã€ãã©ãªã䜿çšããgithubãžã®ãªã³ã¯ïŒ
- gitïŒgit@github.comïŒElvish / microkern.git
- httpïŒ https : //github.com/Elvish/microkern
PSã ãããŠãã©ã®ããã«ã¹ããªãŒã ãæçã«åå²ããŸããïŒ è³ªåãããã°ãçããããšããŸãã ãããã¯ã«èå³ãããå Žåã¯ã次ã®èšäºã§ãæãåçŽãªã³ã³ãããŒã©ãŒïŒã»ãšãã©ãã¹ãŠã®å°ããªããã€ã¹ã®ãããã°ã«äžå¯æ¬ ãªãã®ïŒã®èªåè¿œå æ©èœãåããç°¡æã·ã§ã«ãçºè¡ã§ããŸãã
UPDã
Flexzã®å¥ã®ç²ç æ¹æ³ïŒ
ããšãã°ã Modbus-RTUãããã³ã«ã§äœ¿çšãããæ¹æ³ã ãã±ããã¯ãç¡é³ãã®ééã§åºåãããã©ã€ã³ã¯ããã€ãã®æåãéä¿¡ããã®ã«å¿ èŠãªæéãéã¢ã¯ãã£ãç¶æ ã§ä¿åãããŸãã ãã®å Žåããã€ãã¹ã¿ããã£ã³ã°ã解æããããã«åãã€ããåŠçããå¿ èŠã¯ãããŸããããã¡ãããDMAã¬ã·ãŒããŒã䜿çšå¯èœã§ããã°ãããã䜿çšã§ããŸãã
èè ããïŒç§ã®æèŠã§ã¯ãæéã®åå²ã¯ãè² è·ã®è»œãåç·ãŸãã¯éåžžã«æ£ç¢ºãªæéã§å¯èœã§ãã ç©çããŒã¿è»¢éã®ç£èŠãå°é£ãªç¶æ³ïŒããšãã°ãWiFiçµç±ã®äžç¶ïŒã ããã±ãŒãžã¯äºãã«çµã¿åãããããä»»æã«åå²ã§ããŸãã äžéšã®USB-RS232ã¢ããã¿ãŒã§ãããããåŒãèµ·ãããŸãã8ãã€ãã®ãã±ãããçµåããããããã¹ãŠã®ããŒããŠã§ã¢ãã¢ããã¿ãŒãä»ããŠæ©èœããããã§ã¯ãããŸããã
ãã±ããã®å é ãšæ«å°Ÿã«2ã€ã®ç°ãªããã€ããååšããããšã¯ããããã³ã«ã®å®å®æ§ãåäžãããã£ãã«ãå€§å¹ ã«å€±ãããããšã«é¢é£ããŠããŸãã åœåããããã³ã«ã¯ãå¯èŠæ§ãéåžžã«äœãã¢ãã€ã«æ©åšã§å€ä»£ã®ç¡ç·ã¢ãã ã«ãã£ãŠéä¿¡ãè¡ããããšãã«éçºãããŸããã 1ãã€ãã§ã¯ããããã³ã«ã¯ãã°ãã°ã1ã€ã®ãã±ããã®å§ãŸãïŒé信倱æïŒãšå¥ã®ãã±ããã®çµãããåä¿¡ãããšãã«ãã¹ãç¯ããŸããã