エレキジャックweb mbed入門 mbed CWデコーダ課題12です。CQを受信した直後に”ホレ”を受信しても和文に切り替えない機能を追加します。デコーダ基板が必要です。

Dependencies:   mbed

Committer:
takeuchi
Date:
Mon Jul 16 06:28:18 2012 +0000
Revision:
0:3ffac5cf9402
???????web mbed?? mbed CW??????11????????????????????????(QTH)?????????????????????????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
takeuchi 0:3ffac5cf9402 1 // CW12
takeuchi 0:3ffac5cf9402 2 // BT AR taiou
takeuchi 0:3ffac5cf9402 3 // Wabun
takeuchi 0:3ffac5cf9402 4 // SW tuika
takeuchi 0:3ffac5cf9402 5 // hore taiou
takeuchi 0:3ffac5cf9402 6 // wabun (OUBUN) wabun
takeuchi 0:3ffac5cf9402 7 // CQ hore taiou
takeuchi 0:3ffac5cf9402 8
takeuchi 0:3ffac5cf9402 9 #include "mbed.h"
takeuchi 0:3ffac5cf9402 10 #include "TextLCD0420.h"
takeuchi 0:3ffac5cf9402 11
takeuchi 0:3ffac5cf9402 12 #define ON 1
takeuchi 0:3ffac5cf9402 13 #define OFF 0
takeuchi 0:3ffac5cf9402 14 #define XON 0
takeuchi 0:3ffac5cf9402 15 #define XOFF 1
takeuchi 0:3ffac5cf9402 16 #define XHI 0
takeuchi 0:3ffac5cf9402 17 #define XLOW 1
takeuchi 0:3ffac5cf9402 18 #define HI 1
takeuchi 0:3ffac5cf9402 19 #define LOW 0
takeuchi 0:3ffac5cf9402 20 #define OUBUN 1
takeuchi 0:3ffac5cf9402 21 #define WABUN 0
takeuchi 0:3ffac5cf9402 22 #define AUTO 1
takeuchi 0:3ffac5cf9402 23 #define MANUAL 0
takeuchi 0:3ffac5cf9402 24 #define KN 44
takeuchi 0:3ffac5cf9402 25 #define AS 33
takeuchi 0:3ffac5cf9402 26 #define CT 52
takeuchi 0:3ffac5cf9402 27 #define BT 48
takeuchi 0:3ffac5cf9402 28 #define AR 41
takeuchi 0:3ffac5cf9402 29 #define HH 255
takeuchi 0:3ffac5cf9402 30 #define VA 103
takeuchi 0:3ffac5cf9402 31 #define HORE 120
takeuchi 0:3ffac5cf9402 32
takeuchi 0:3ffac5cf9402 33 DigitalOut mled1(LED1);
takeuchi 0:3ffac5cf9402 34 DigitalOut mled2(LED2);
takeuchi 0:3ffac5cf9402 35 DigitalOut mled3(LED3);
takeuchi 0:3ffac5cf9402 36 DigitalOut mled4(LED4);
takeuchi 0:3ffac5cf9402 37 DigitalIn CW(p5);
takeuchi 0:3ffac5cf9402 38 DigitalIn SP_SELECT(p6);
takeuchi 0:3ffac5cf9402 39 DigitalIn GENGO_MODE(p7);
takeuchi 0:3ffac5cf9402 40 DigitalIn GENGO_SELECT(p8);
takeuchi 0:3ffac5cf9402 41
takeuchi 0:3ffac5cf9402 42 TextLCD lcd(p24, p25, p26, p27, p28, p29, p30,20,4); // rs, rw, e, d0, d1, d2, d3
takeuchi 0:3ffac5cf9402 43
takeuchi 0:3ffac5cf9402 44 int retu,gyou;
takeuchi 0:3ffac5cf9402 45 char g2[20],g3[20];
takeuchi 0:3ffac5cf9402 46 int init_flag=ON;
takeuchi 0:3ffac5cf9402 47 int min_ms,max_ms;
takeuchi 0:3ffac5cf9402 48
takeuchi 0:3ffac5cf9402 49 void lcd_scprintf(char pdata){
takeuchi 0:3ffac5cf9402 50 int i;
takeuchi 0:3ffac5cf9402 51
takeuchi 0:3ffac5cf9402 52 if(init_flag==ON){
takeuchi 0:3ffac5cf9402 53 if(gyou==1){
takeuchi 0:3ffac5cf9402 54 lcd.locate(retu,1);
takeuchi 0:3ffac5cf9402 55 lcd.printf("%c",pdata);
takeuchi 0:3ffac5cf9402 56 retu++;
takeuchi 0:3ffac5cf9402 57 if(retu==20){
takeuchi 0:3ffac5cf9402 58 gyou=2;
takeuchi 0:3ffac5cf9402 59 retu=0;
takeuchi 0:3ffac5cf9402 60 }
takeuchi 0:3ffac5cf9402 61 }
takeuchi 0:3ffac5cf9402 62 else if(gyou==2){
takeuchi 0:3ffac5cf9402 63 lcd.locate(retu,2);
takeuchi 0:3ffac5cf9402 64 lcd.printf("%c",pdata);
takeuchi 0:3ffac5cf9402 65 g2[retu]=pdata;
takeuchi 0:3ffac5cf9402 66 retu++;
takeuchi 0:3ffac5cf9402 67 if(retu==20){
takeuchi 0:3ffac5cf9402 68 retu=0;
takeuchi 0:3ffac5cf9402 69 gyou=3;
takeuchi 0:3ffac5cf9402 70 }
takeuchi 0:3ffac5cf9402 71 }
takeuchi 0:3ffac5cf9402 72 else if(gyou==3){
takeuchi 0:3ffac5cf9402 73 lcd.locate(retu,3);
takeuchi 0:3ffac5cf9402 74 lcd.printf("%c",pdata);
takeuchi 0:3ffac5cf9402 75 g3[retu]=pdata;
takeuchi 0:3ffac5cf9402 76 retu++;
takeuchi 0:3ffac5cf9402 77 if(retu==20){
takeuchi 0:3ffac5cf9402 78 retu=0;
takeuchi 0:3ffac5cf9402 79 gyou=1;
takeuchi 0:3ffac5cf9402 80 for(i=0;i<20;i++){
takeuchi 0:3ffac5cf9402 81 lcd.locate(i,1);
takeuchi 0:3ffac5cf9402 82 lcd.printf("%c",g2[i]);
takeuchi 0:3ffac5cf9402 83 }
takeuchi 0:3ffac5cf9402 84 for(i=0;i<20;i++){
takeuchi 0:3ffac5cf9402 85 lcd.locate(i,2);
takeuchi 0:3ffac5cf9402 86 lcd.printf("%c",g3[i]);
takeuchi 0:3ffac5cf9402 87 g2[i]=g3[i];
takeuchi 0:3ffac5cf9402 88 }
takeuchi 0:3ffac5cf9402 89 lcd.locate(0,3);
takeuchi 0:3ffac5cf9402 90 lcd.printf(" ");
takeuchi 0:3ffac5cf9402 91 init_flag=OFF;
takeuchi 0:3ffac5cf9402 92 }
takeuchi 0:3ffac5cf9402 93 }
takeuchi 0:3ffac5cf9402 94 }
takeuchi 0:3ffac5cf9402 95 if(init_flag==OFF){
takeuchi 0:3ffac5cf9402 96 gyou=3;
takeuchi 0:3ffac5cf9402 97 lcd.locate(retu,3);
takeuchi 0:3ffac5cf9402 98 lcd.printf("%c",pdata);
takeuchi 0:3ffac5cf9402 99 g3[retu]=pdata;
takeuchi 0:3ffac5cf9402 100 retu++;
takeuchi 0:3ffac5cf9402 101 if(retu==20){
takeuchi 0:3ffac5cf9402 102 for(i=0;i<20;i++){
takeuchi 0:3ffac5cf9402 103 lcd.locate(i,1);
takeuchi 0:3ffac5cf9402 104 lcd.printf("%c",g2[i]);
takeuchi 0:3ffac5cf9402 105 lcd.locate(i,2);
takeuchi 0:3ffac5cf9402 106 lcd.printf("%c",g3[i]);
takeuchi 0:3ffac5cf9402 107 g2[i]=g3[i];
takeuchi 0:3ffac5cf9402 108 }
takeuchi 0:3ffac5cf9402 109 lcd.locate(0,3);
takeuchi 0:3ffac5cf9402 110 lcd.printf(" ");
takeuchi 0:3ffac5cf9402 111 retu=0;
takeuchi 0:3ffac5cf9402 112 }
takeuchi 0:3ffac5cf9402 113 }
takeuchi 0:3ffac5cf9402 114 }
takeuchi 0:3ffac5cf9402 115
takeuchi 0:3ffac5cf9402 116 void set_speed(){
takeuchi 0:3ffac5cf9402 117 if(SP_SELECT==HI){
takeuchi 0:3ffac5cf9402 118 min_ms=30;
takeuchi 0:3ffac5cf9402 119 max_ms=90;
takeuchi 0:3ffac5cf9402 120 lcd.locate(5,0);
takeuchi 0:3ffac5cf9402 121 lcd.printf("H");
takeuchi 0:3ffac5cf9402 122 }
takeuchi 0:3ffac5cf9402 123 else if(SP_SELECT==LOW){
takeuchi 0:3ffac5cf9402 124 min_ms=70;
takeuchi 0:3ffac5cf9402 125 max_ms=210;
takeuchi 0:3ffac5cf9402 126 lcd.locate(5,0);
takeuchi 0:3ffac5cf9402 127 lcd.printf("L");
takeuchi 0:3ffac5cf9402 128 }
takeuchi 0:3ffac5cf9402 129 }
takeuchi 0:3ffac5cf9402 130
takeuchi 0:3ffac5cf9402 131 void lcd_manual(){
takeuchi 0:3ffac5cf9402 132 lcd.locate(6,0);
takeuchi 0:3ffac5cf9402 133 lcd.printf("M");
takeuchi 0:3ffac5cf9402 134 }
takeuchi 0:3ffac5cf9402 135
takeuchi 0:3ffac5cf9402 136 void lcd_auto(){
takeuchi 0:3ffac5cf9402 137 lcd.locate(6,0);
takeuchi 0:3ffac5cf9402 138 lcd.printf("A");
takeuchi 0:3ffac5cf9402 139 }
takeuchi 0:3ffac5cf9402 140
takeuchi 0:3ffac5cf9402 141 void lcd_alpha(){
takeuchi 0:3ffac5cf9402 142 lcd.locate(7,0);
takeuchi 0:3ffac5cf9402 143 lcd.printf("A");
takeuchi 0:3ffac5cf9402 144 }
takeuchi 0:3ffac5cf9402 145 void lcd_kana(){
takeuchi 0:3ffac5cf9402 146 lcd.locate(7,0);
takeuchi 0:3ffac5cf9402 147 lcd.printf("%c",0xb6);
takeuchi 0:3ffac5cf9402 148 }
takeuchi 0:3ffac5cf9402 149
takeuchi 0:3ffac5cf9402 150 int main() {
takeuchi 0:3ffac5cf9402 151
takeuchi 0:3ffac5cf9402 152 int i,j,k;
takeuchi 0:3ffac5cf9402 153 int code[8];
takeuchi 0:3ffac5cf9402 154 int scount;
takeuchi 0:3ffac5cf9402 155 char mj[115],mjj[121],c1,c2;
takeuchi 0:3ffac5cf9402 156 int cw_sum,tan_sum,tanten,cpm;
takeuchi 0:3ffac5cf9402 157 int gengo,wabun_temp;
takeuchi 0:3ffac5cf9402 158 char cw_class;
takeuchi 0:3ffac5cf9402 159
takeuchi 0:3ffac5cf9402 160 for(i=0;i<115;i++){
takeuchi 0:3ffac5cf9402 161 mj[i]=' ';
takeuchi 0:3ffac5cf9402 162 }
takeuchi 0:3ffac5cf9402 163 mj[5]='A';mj[16]='B';mj[20]='C';mj[8]='D';mj[1]='E';
takeuchi 0:3ffac5cf9402 164 mj[19]='F';mj[10]='G';mj[15]='H';mj[3]='I';mj[29]='J';
takeuchi 0:3ffac5cf9402 165 mj[12]='K';mj[17]='L';mj[6]='M';mj[4]='N';mj[14]='O';
takeuchi 0:3ffac5cf9402 166 mj[21]='P';mj[26]='Q';mj[9]='R';mj[7]='S';mj[2]='T';
takeuchi 0:3ffac5cf9402 167 mj[11]='U';mj[23]='V';mj[13]='W';mj[24]='X';mj[28]='Y';
takeuchi 0:3ffac5cf9402 168 mj[18]='Z';
takeuchi 0:3ffac5cf9402 169 mj[61]='1';mj[59]='2';mj[55]='3';mj[47]='4';mj[31]='5';
takeuchi 0:3ffac5cf9402 170 mj[32]='6';mj[34]='7';mj[38]='8';mj[46]='9';mj[62]='0';
takeuchi 0:3ffac5cf9402 171 mj[105]='.';mj[114]=',';mj[75]='?';mj[48]='=';mj[96]='-';
takeuchi 0:3ffac5cf9402 172 mj[70]=':';mj[93]='\'';mj[44]='(';mj[108]=')';mj[40]='/';
takeuchi 0:3ffac5cf9402 173 mj[85]='@';
takeuchi 0:3ffac5cf9402 174 //mj[41]='+';
takeuchi 0:3ffac5cf9402 175
takeuchi 0:3ffac5cf9402 176 for(i=0;i<121;i++){
takeuchi 0:3ffac5cf9402 177 mjj[i]=' ';
takeuchi 0:3ffac5cf9402 178 }
takeuchi 0:3ffac5cf9402 179 mjj[58]=0xb1;mjj[5]=0xb2;mjj[11]=0xb3;mjj[60]=0xb4;mjj[33]=0xb5;//a
takeuchi 0:3ffac5cf9402 180 mjj[17]=0xb6;mjj[36]=0xb7;mjj[23]=0xb8;mjj[28]=0xb9;mjj[30]=0xba;//ka
takeuchi 0:3ffac5cf9402 181 mjj[52]=0xbb;mjj[42]=0xbc;mjj[54]=0xbd;mjj[45]=0xbe;mjj[22]=0xbf;//sa
takeuchi 0:3ffac5cf9402 182 mjj[4]=0xc0;mjj[19]=0xc1;mjj[21]=0xc2;mjj[57]=0xc3;mjj[35]=0xc4;//ta
takeuchi 0:3ffac5cf9402 183 mjj[9]=0xc5;mjj[20]=0xc6;mjj[15]=0xc7;mjj[26]=0xc8;mjj[27]=0xc9;//na
takeuchi 0:3ffac5cf9402 184 mjj[16]=0xca;mjj[50]=0xcb;mjj[18]=0xcc;mjj[1]=0xcd;mjj[8]=0xce;//ha
takeuchi 0:3ffac5cf9402 185 mjj[24]=0xcf;mjj[51]=0xd0;mjj[2]=0xd1;mjj[48]=0xd2;mjj[40]=0xd3;//ma
takeuchi 0:3ffac5cf9402 186 mjj[13]=0xd4;mjj[56]=0xd5;mjj[6]=0xd6;//ya
takeuchi 0:3ffac5cf9402 187 mjj[7]=0xd7;mjj[10]=0xd8;mjj[44]=0xd9;mjj[14]=0xda;mjj[25]=0xdb;//ra
takeuchi 0:3ffac5cf9402 188 mjj[12]=0xdc;mjj[49]=0xb2;mjj[37]=0xb4;mjj[29]=0xa6;mjj[41]=0xdd;//wa
takeuchi 0:3ffac5cf9402 189 mjj[53]=0xb0;mjj[43]=0xdf;mjj[105]=',';
takeuchi 0:3ffac5cf9402 190 mjj[3]=0xde;mjj[73]=0xa3;
takeuchi 0:3ffac5cf9402 191 mjj[108]='(';mjj[81]=')';
takeuchi 0:3ffac5cf9402 192 mjj[61]='1';mjj[59]='2';mjj[55]='3';mjj[47]='4';mjj[31]='5';
takeuchi 0:3ffac5cf9402 193 mjj[32]='6';mjj[34]='7';mjj[38]='8';mjj[46]='9';mjj[62]='0';
takeuchi 0:3ffac5cf9402 194
takeuchi 0:3ffac5cf9402 195
takeuchi 0:3ffac5cf9402 196 lcd.cls();
takeuchi 0:3ffac5cf9402 197 lcd.printf("*CW12 ");
takeuchi 0:3ffac5cf9402 198
takeuchi 0:3ffac5cf9402 199 for(i=0;i<8;i++){
takeuchi 0:3ffac5cf9402 200 code[i]=0;
takeuchi 0:3ffac5cf9402 201 }
takeuchi 0:3ffac5cf9402 202
takeuchi 0:3ffac5cf9402 203 i=0;
takeuchi 0:3ffac5cf9402 204 tan_sum=0;
takeuchi 0:3ffac5cf9402 205 set_speed();
takeuchi 0:3ffac5cf9402 206 c1=' ',c2=' ';
takeuchi 0:3ffac5cf9402 207
takeuchi 0:3ffac5cf9402 208 while( i<5 ){//initialize
takeuchi 0:3ffac5cf9402 209 lcd.locate(8,0);
takeuchi 0:3ffac5cf9402 210 lcd.printf("%2d",5-i);
takeuchi 0:3ffac5cf9402 211 scount=0;
takeuchi 0:3ffac5cf9402 212 while(CW==XLOW){
takeuchi 0:3ffac5cf9402 213 }
takeuchi 0:3ffac5cf9402 214 mled1=ON;
takeuchi 0:3ffac5cf9402 215 while(CW==XHI){
takeuchi 0:3ffac5cf9402 216 scount++;
takeuchi 0:3ffac5cf9402 217 wait_ms(1);
takeuchi 0:3ffac5cf9402 218 }
takeuchi 0:3ffac5cf9402 219 mled1=OFF;
takeuchi 0:3ffac5cf9402 220 if(min_ms < scount && scount < max_ms){
takeuchi 0:3ffac5cf9402 221 tan_sum=tan_sum+scount;
takeuchi 0:3ffac5cf9402 222 i++;
takeuchi 0:3ffac5cf9402 223 }
takeuchi 0:3ffac5cf9402 224
takeuchi 0:3ffac5cf9402 225 }//while i
takeuchi 0:3ffac5cf9402 226
takeuchi 0:3ffac5cf9402 227 tanten=tan_sum/5;
takeuchi 0:3ffac5cf9402 228
takeuchi 0:3ffac5cf9402 229 j=0;
takeuchi 0:3ffac5cf9402 230 k=0;
takeuchi 0:3ffac5cf9402 231 tan_sum=0;
takeuchi 0:3ffac5cf9402 232 gyou=1,retu=0;
takeuchi 0:3ffac5cf9402 233 gengo=OUBUN;
takeuchi 0:3ffac5cf9402 234 wabun_temp=OUBUN;
takeuchi 0:3ffac5cf9402 235 while(1){
takeuchi 0:3ffac5cf9402 236 set_speed();
takeuchi 0:3ffac5cf9402 237
takeuchi 0:3ffac5cf9402 238 if(GENGO_MODE==MANUAL){// Manual mode
takeuchi 0:3ffac5cf9402 239 lcd_manual();
takeuchi 0:3ffac5cf9402 240 if(GENGO_SELECT==OUBUN){
takeuchi 0:3ffac5cf9402 241 gengo=OUBUN;
takeuchi 0:3ffac5cf9402 242 }
takeuchi 0:3ffac5cf9402 243 else if(GENGO_SELECT==WABUN){
takeuchi 0:3ffac5cf9402 244 gengo=WABUN;
takeuchi 0:3ffac5cf9402 245 wabun_temp=WABUN;
takeuchi 0:3ffac5cf9402 246 }
takeuchi 0:3ffac5cf9402 247 }
takeuchi 0:3ffac5cf9402 248 else if(GENGO_MODE==AUTO){// Auto mode
takeuchi 0:3ffac5cf9402 249 lcd_auto();
takeuchi 0:3ffac5cf9402 250 }
takeuchi 0:3ffac5cf9402 251
takeuchi 0:3ffac5cf9402 252 while(CW==XLOW){
takeuchi 0:3ffac5cf9402 253 }
takeuchi 0:3ffac5cf9402 254
takeuchi 0:3ffac5cf9402 255 scount=0;
takeuchi 0:3ffac5cf9402 256 mled1=ON;
takeuchi 0:3ffac5cf9402 257 while(CW==XHI){
takeuchi 0:3ffac5cf9402 258 wait_ms(1);
takeuchi 0:3ffac5cf9402 259 scount++;
takeuchi 0:3ffac5cf9402 260 }
takeuchi 0:3ffac5cf9402 261 mled1=OFF;
takeuchi 0:3ffac5cf9402 262
takeuchi 0:3ffac5cf9402 263 if(min_ms < scount && scount < max_ms){
takeuchi 0:3ffac5cf9402 264 //lcd.printf(".");
takeuchi 0:3ffac5cf9402 265 code[k]=1;
takeuchi 0:3ffac5cf9402 266 k++;
takeuchi 0:3ffac5cf9402 267 tan_sum=tan_sum+scount;
takeuchi 0:3ffac5cf9402 268 j++;
takeuchi 0:3ffac5cf9402 269 }
takeuchi 0:3ffac5cf9402 270
takeuchi 0:3ffac5cf9402 271 else if ( scount > tanten*2.0){
takeuchi 0:3ffac5cf9402 272 //lcd.printf("_");
takeuchi 0:3ffac5cf9402 273 code[k]=2;
takeuchi 0:3ffac5cf9402 274 k++;
takeuchi 0:3ffac5cf9402 275 tan_sum=tan_sum+scount/3;
takeuchi 0:3ffac5cf9402 276 j++;
takeuchi 0:3ffac5cf9402 277 }
takeuchi 0:3ffac5cf9402 278
takeuchi 0:3ffac5cf9402 279 lcd.locate(8,0);
takeuchi 0:3ffac5cf9402 280 lcd.printf("%2d",k);
takeuchi 0:3ffac5cf9402 281
takeuchi 0:3ffac5cf9402 282 scount=0;
takeuchi 0:3ffac5cf9402 283 while(CW==XLOW){
takeuchi 0:3ffac5cf9402 284 wait_ms(1);
takeuchi 0:3ffac5cf9402 285 scount++;
takeuchi 0:3ffac5cf9402 286 if(scount > tanten*10){
takeuchi 0:3ffac5cf9402 287 break;
takeuchi 0:3ffac5cf9402 288 }
takeuchi 0:3ffac5cf9402 289 }
takeuchi 0:3ffac5cf9402 290
takeuchi 0:3ffac5cf9402 291 if(k>8){
takeuchi 0:3ffac5cf9402 292 k=0;
takeuchi 0:3ffac5cf9402 293 lcd_scprintf('*');
takeuchi 0:3ffac5cf9402 294 for(i=0;i<=7;i++){
takeuchi 0:3ffac5cf9402 295 code[i]=0;
takeuchi 0:3ffac5cf9402 296 }
takeuchi 0:3ffac5cf9402 297 }
takeuchi 0:3ffac5cf9402 298
takeuchi 0:3ffac5cf9402 299 if(gengo==OUBUN && scount > tanten*2.0){
takeuchi 0:3ffac5cf9402 300 lcd_alpha();
takeuchi 0:3ffac5cf9402 301 cw_sum=0;
takeuchi 0:3ffac5cf9402 302 for(i=0;i<=7;i++){
takeuchi 0:3ffac5cf9402 303 cw_sum=cw_sum+code[i]*int(pow(2.0,i));
takeuchi 0:3ffac5cf9402 304 }
takeuchi 0:3ffac5cf9402 305
takeuchi 0:3ffac5cf9402 306 if(GENGO_MODE==AUTO && cw_sum==HORE ){// hore
takeuchi 0:3ffac5cf9402 307 lcd_scprintf('[');lcd_scprintf(0xce);lcd_scprintf( 0xda);lcd_scprintf(']');//ho re
takeuchi 0:3ffac5cf9402 308 if(c1=='C' && c2=='Q'){
takeuchi 0:3ffac5cf9402 309 //
takeuchi 0:3ffac5cf9402 310 }
takeuchi 0:3ffac5cf9402 311 else{
takeuchi 0:3ffac5cf9402 312 gengo=WABUN;
takeuchi 0:3ffac5cf9402 313 wabun_temp=WABUN;
takeuchi 0:3ffac5cf9402 314 cw_sum=0;
takeuchi 0:3ffac5cf9402 315 }
takeuchi 0:3ffac5cf9402 316 }
takeuchi 0:3ffac5cf9402 317 else if(cw_sum==BT){
takeuchi 0:3ffac5cf9402 318 lcd_scprintf('[');lcd_scprintf('B');lcd_scprintf('T');lcd_scprintf(']');
takeuchi 0:3ffac5cf9402 319 }
takeuchi 0:3ffac5cf9402 320 else if(cw_sum==KN){
takeuchi 0:3ffac5cf9402 321 lcd_scprintf('[');lcd_scprintf('K');lcd_scprintf('N');lcd_scprintf(']');
takeuchi 0:3ffac5cf9402 322 }
takeuchi 0:3ffac5cf9402 323 else if(cw_sum==AR){
takeuchi 0:3ffac5cf9402 324 lcd_scprintf('[');lcd_scprintf('A');lcd_scprintf('R');lcd_scprintf(']');
takeuchi 0:3ffac5cf9402 325 }
takeuchi 0:3ffac5cf9402 326 else if(cw_sum==HH){
takeuchi 0:3ffac5cf9402 327 lcd_scprintf('[');lcd_scprintf('H');lcd_scprintf('H');lcd_scprintf(']');
takeuchi 0:3ffac5cf9402 328 }
takeuchi 0:3ffac5cf9402 329 else if(cw_sum==AS){
takeuchi 0:3ffac5cf9402 330 lcd_scprintf('[');lcd_scprintf('A');lcd_scprintf('S');lcd_scprintf(']');
takeuchi 0:3ffac5cf9402 331 }
takeuchi 0:3ffac5cf9402 332 else if(cw_sum==CT){
takeuchi 0:3ffac5cf9402 333 lcd_scprintf('[');lcd_scprintf('C');lcd_scprintf('T');lcd_scprintf(']');
takeuchi 0:3ffac5cf9402 334 }
takeuchi 0:3ffac5cf9402 335 else if(cw_sum==VA){
takeuchi 0:3ffac5cf9402 336 lcd_scprintf('[');lcd_scprintf('V');lcd_scprintf('A');lcd_scprintf(']');
takeuchi 0:3ffac5cf9402 337 }
takeuchi 0:3ffac5cf9402 338 else if(cw_sum > 115){
takeuchi 0:3ffac5cf9402 339 lcd_scprintf('*');
takeuchi 0:3ffac5cf9402 340 cw_sum=0;
takeuchi 0:3ffac5cf9402 341 }
takeuchi 0:3ffac5cf9402 342 else {
takeuchi 0:3ffac5cf9402 343 lcd_scprintf(mj[cw_sum]);
takeuchi 0:3ffac5cf9402 344 c1=c2;
takeuchi 0:3ffac5cf9402 345 c2=mj[cw_sum];
takeuchi 0:3ffac5cf9402 346 }
takeuchi 0:3ffac5cf9402 347 k=0;
takeuchi 0:3ffac5cf9402 348 for(i=0;i<=7;i++){
takeuchi 0:3ffac5cf9402 349 code[i]=0;
takeuchi 0:3ffac5cf9402 350 }
takeuchi 0:3ffac5cf9402 351 }//if oubun
takeuchi 0:3ffac5cf9402 352
takeuchi 0:3ffac5cf9402 353 if(gengo==WABUN && scount > tanten*2.0){
takeuchi 0:3ffac5cf9402 354 lcd_kana();
takeuchi 0:3ffac5cf9402 355 cw_sum=0;
takeuchi 0:3ffac5cf9402 356 for(i=0;i<=7;i++){
takeuchi 0:3ffac5cf9402 357 cw_sum=cw_sum+code[i]*int(pow(2.0,i));
takeuchi 0:3ffac5cf9402 358 }
takeuchi 0:3ffac5cf9402 359
takeuchi 0:3ffac5cf9402 360 if(GENGO_MODE==AUTO && cw_sum==39){// ra ta
takeuchi 0:3ffac5cf9402 361 lcd_scprintf('[');lcd_scprintf(0xd7);lcd_scprintf(0xc0);lcd_scprintf(']');//ra ta
takeuchi 0:3ffac5cf9402 362 gengo=OUBUN;
takeuchi 0:3ffac5cf9402 363 wabun_temp=OUBUN;
takeuchi 0:3ffac5cf9402 364 }
takeuchi 0:3ffac5cf9402 365 if(cw_sum==81){// )
takeuchi 0:3ffac5cf9402 366 wabun_temp=WABUN;
takeuchi 0:3ffac5cf9402 367 lcd_kana();
takeuchi 0:3ffac5cf9402 368 }
takeuchi 0:3ffac5cf9402 369 else if(cw_sum > 121){
takeuchi 0:3ffac5cf9402 370 cw_sum=0;
takeuchi 0:3ffac5cf9402 371 lcd_scprintf(' ');
takeuchi 0:3ffac5cf9402 372 }
takeuchi 0:3ffac5cf9402 373
takeuchi 0:3ffac5cf9402 374 if(wabun_temp==WABUN){
takeuchi 0:3ffac5cf9402 375 lcd_scprintf(mjj[cw_sum]);
takeuchi 0:3ffac5cf9402 376 c1=c2;
takeuchi 0:3ffac5cf9402 377 c2=mjj[cw_sum];
takeuchi 0:3ffac5cf9402 378 }
takeuchi 0:3ffac5cf9402 379 else if(wabun_temp==OUBUN){
takeuchi 0:3ffac5cf9402 380 lcd_scprintf(mj[cw_sum]);
takeuchi 0:3ffac5cf9402 381 c1=c2;
takeuchi 0:3ffac5cf9402 382 c2=mj[cw_sum];
takeuchi 0:3ffac5cf9402 383 }
takeuchi 0:3ffac5cf9402 384
takeuchi 0:3ffac5cf9402 385 if(cw_sum==108){// (
takeuchi 0:3ffac5cf9402 386 wabun_temp=OUBUN;
takeuchi 0:3ffac5cf9402 387 lcd_alpha();
takeuchi 0:3ffac5cf9402 388 }
takeuchi 0:3ffac5cf9402 389
takeuchi 0:3ffac5cf9402 390 k=0;
takeuchi 0:3ffac5cf9402 391 for(i=0;i<=7;i++){
takeuchi 0:3ffac5cf9402 392 code[i]=0;
takeuchi 0:3ffac5cf9402 393 }
takeuchi 0:3ffac5cf9402 394 }//if wabun
takeuchi 0:3ffac5cf9402 395
takeuchi 0:3ffac5cf9402 396 if(scount > tanten*7){
takeuchi 0:3ffac5cf9402 397 lcd_scprintf(' ');
takeuchi 0:3ffac5cf9402 398 }
takeuchi 0:3ffac5cf9402 399
takeuchi 0:3ffac5cf9402 400 if(j==10){
takeuchi 0:3ffac5cf9402 401 tanten=tan_sum/10;
takeuchi 0:3ffac5cf9402 402 cpm=60000/(tanten*57)*5;
takeuchi 0:3ffac5cf9402 403 tan_sum=0;
takeuchi 0:3ffac5cf9402 404 j=0;
takeuchi 0:3ffac5cf9402 405 if(cpm > 100){
takeuchi 0:3ffac5cf9402 406 cw_class='P';
takeuchi 0:3ffac5cf9402 407 }
takeuchi 0:3ffac5cf9402 408 else if(cpm > 90){
takeuchi 0:3ffac5cf9402 409 cw_class='S';
takeuchi 0:3ffac5cf9402 410 }
takeuchi 0:3ffac5cf9402 411 else if(cpm > 65){
takeuchi 0:3ffac5cf9402 412 cw_class='1';
takeuchi 0:3ffac5cf9402 413 }
takeuchi 0:3ffac5cf9402 414 else if(cpm > 40){
takeuchi 0:3ffac5cf9402 415 cw_class='2';
takeuchi 0:3ffac5cf9402 416 }
takeuchi 0:3ffac5cf9402 417 else if(cpm > 30){
takeuchi 0:3ffac5cf9402 418 cw_class='3';
takeuchi 0:3ffac5cf9402 419 }
takeuchi 0:3ffac5cf9402 420 lcd.locate(11,0);
takeuchi 0:3ffac5cf9402 421 lcd.printf("%3dc(%c)",cpm,cw_class);
takeuchi 0:3ffac5cf9402 422 //lcd.printf("%3dc,%3dm",cpm,tanten);
takeuchi 0:3ffac5cf9402 423 }
takeuchi 0:3ffac5cf9402 424 }//while 1
takeuchi 0:3ffac5cf9402 425 }//main