Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 4:a263257f3a2b, committed 2021-03-24
- Comitter:
- KINU
- Date:
- Wed Mar 24 15:12:50 2021 +0000
- Parent:
- 3:e6d72c02e045
- Commit message:
- wwwwwww
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Mar 24 13:23:25 2021 +0000
+++ b/main.cpp Wed Mar 24 15:12:50 2021 +0000
@@ -41,28 +41,65 @@
//main関数内でコマンドが0x00の時にmainでbinary()を呼ぶと計算をしてuint_32型の値を返す
uint32_t Reg0_gen(int key,double calsat_freq,double human_freq )
{
+ //printf("%lf %lf\r\n",calsat_freq,human_freq);
uint32_t freq_bit;
- if(key == '1') {
- //printf("%lf %lf\r\n",calsat_freq,human_freq);
+
+ if(key == '0') {
+ printf("key = 0");
+ uint32_t tmp = 0;
+ tmp |= ( register_data_array[2] >> 27); //この行と次の行でレジスタのデータの部分を全て0にしている
+ tmp |= (tmp << 27);
+ printf("tmp = ");
+ for(int i = 27; i > 0; i--) {
+ if(tmp & (1 << (i - 1))) {
+ pc.printf("1");
+ } else {
+ pc.printf("0");
+ }
+ }
+ printf("\r\n");
freq_bit = binary(calsat_freq);
-
- //Shift_bit(_register, freq_bit, 23);
+ freq_bit = freq_bit<<4;
+ printf("freq_bit = ");
+ for(int i = 27; i > 0; i--) {
+ if(tmp & (1 << (i - 1))) {
+ pc.printf("1");
+ } else {
+ pc.printf("0");
+ }
+ }
+ printf("\r\n");
+ tmp |= freq_bit;
+ register_data_array[2] = tmp;
+ printf("reg2=");
+ for(int i = 27; i > 0; i--) {
+ if(tmp & (1 << (i - 1))) {
+ pc.printf("1");
+ } else {
+ pc.printf("0");
+ }
+ }
+ printf("\r\n");
+ } else if(key == '1') {
+
+ freq_bit = binary(calsat_freq);
+ freq_bit = freq_bit<<4;
} else if(key =='2') { //calsatから受けとる
freq_bit = binary(human_freq);
- // Shift_bit(_register, freq_bit, 23);//1の時calsat,2の時人
+ freq_bit = freq_bit<<4;
}
- /*else if(key == '3' || key == '0') {
+ /*else if(key == '3' ) {
uint32_t tmp = 0;
tmp |= ( register_data_array[2] >> 27); //この行と次の行でレジスタのデータの部分を全て0にしている
tmp |= (tmp << 27);
- if(key == 3){
+
Shift_bit(tmp, binary(human_freq), 4);//人間が入力した周波数の値を用いたレジスタを作成する
register_data_array[2] = tmp;//配列の中に格納する
show_all();
- }*/
+ */
else {}
- freq_bit = freq_bit<<4;
+
/* for(int i = 23; i > 0; i--) {
if(freq_bit & (1 << (i - 1))) {
@@ -121,8 +158,8 @@
pc.printf("0");
}
}
- printf("\r\n");
- size = 27;
+ printf("\r\n");
+ size = 27;
//テキストファイルから受け取った値を格納するとき
} else {
Shift_bit(_register, register_data, size);
@@ -149,9 +186,8 @@
/* ファイルのクローズ */
fclose(fp);
}
- uint32_t binary(double RFout)//char* command
+ uint32_t binary(double RFout)
{
- // = doppler(command);
double n = RFout * 2 / PFD;
Integer_N = (int)n;
double test = (n - (int)n);
@@ -215,7 +251,7 @@
a++;
if(_command[a-1] == 0xfd) {
calsat_freq = doppler(_command);
- Reg0_gen(1, calsat_freq, human_freq); //reg0をcalsatの値で更新
+ _register = Reg0_gen(0, calsat_freq, human_freq); //reg0をcalsatの値で更新
/*
for(int j = 0; j < a; j++)
printf("%02hhx",_command[j]);
@@ -251,6 +287,8 @@
//file読み込み、calsator人の更新
} else if(key == '3') //reg0を人にする
tmp.check(key,calsat_freq);
+ else if(key == '0') //reg0を人にする
+ tmp.check(key,calsat_freq);
}
}
}