teste de publish

Dependencies:   DS1820 HighSpeedAnalogIn devices mbed

Committer:
brunofgc
Date:
Tue Jul 11 11:55:56 2017 +0000
Revision:
7:ae9c47f62946
Parent:
6:d4ebbaaba295
Child:
20:da1b8d80ba00
Vers?o UCSal piloto 1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
brunofgc 0:1c0a769988ee 1 #include "IRPack.h"
brunofgc 0:1c0a769988ee 2 //bool dataIn[maxBytesMsg*8];
brunofgc 0:1c0a769988ee 3 uint16_t bits[maxBitsMsg*2][2];
brunofgc 5:7801f913384e 4 int indexIr=0,botao;
brunofgc 0:1c0a769988ee 5 int startBitAlto=0, startBitBaixo=0, bitBaixo[maxBitsMsg], bitAlto[maxBitsMsg], i;
brunofgc 0:1c0a769988ee 6 //unsigned char byte=0,msg[maxBytesMsg],msgBytes=0;
brunofgc 0:1c0a769988ee 7
brunofgc 0:1c0a769988ee 8 Timer IrTmr;
brunofgc 0:1c0a769988ee 9 Timer IrDetect;
brunofgc 0:1c0a769988ee 10 bool irInAntes=1;
brunofgc 0:1c0a769988ee 11 CircularBuffer bufIROut(maxBitsMsg*2*4);
brunofgc 0:1c0a769988ee 12
brunofgc 0:1c0a769988ee 13 //PwmOut IrOut(P1_18);
brunofgc 0:1c0a769988ee 14 DigitalIn IrIn(P1_24); //Não utilizado na placa
brunofgc 0:1c0a769988ee 15
brunofgc 0:1c0a769988ee 16 int round(float in){
brunofgc 0:1c0a769988ee 17 int x = floor(in);
brunofgc 0:1c0a769988ee 18 float y = in-x;
brunofgc 0:1c0a769988ee 19 if(y>=0.5){
brunofgc 0:1c0a769988ee 20 x++;
brunofgc 0:1c0a769988ee 21 }
brunofgc 0:1c0a769988ee 22 return x;
brunofgc 0:1c0a769988ee 23 }
brunofgc 0:1c0a769988ee 24
brunofgc 0:1c0a769988ee 25 uint16_t pulseDuration_us(bool high,DigitalIn pin,unsigned long int timeout){
brunofgc 0:1c0a769988ee 26 unsigned long int duration;
brunofgc 0:1c0a769988ee 27 IrTmr.reset();
brunofgc 0:1c0a769988ee 28 IrTmr.start();
brunofgc 0:1c0a769988ee 29
brunofgc 0:1c0a769988ee 30 do{
brunofgc 0:1c0a769988ee 31 duration = IrTmr.read_us();
brunofgc 0:1c0a769988ee 32 }while((duration < timeout) && (pin==high));
brunofgc 0:1c0a769988ee 33
brunofgc 0:1c0a769988ee 34
brunofgc 0:1c0a769988ee 35 IrTmr.stop();
brunofgc 0:1c0a769988ee 36 if(duration < timeout){
brunofgc 0:1c0a769988ee 37 return duration;
brunofgc 0:1c0a769988ee 38 }
brunofgc 0:1c0a769988ee 39 else{
brunofgc 0:1c0a769988ee 40 return 65535;
brunofgc 0:1c0a769988ee 41 }
brunofgc 0:1c0a769988ee 42 }
brunofgc 0:1c0a769988ee 43
brunofgc 0:1c0a769988ee 44
brunofgc 0:1c0a769988ee 45
brunofgc 6:d4ebbaaba295 46 void enviaComandoIR(uint8_t freq,uint8_t port){
brunofgc 0:1c0a769988ee 47 float sd1Duty = SD1.read();
brunofgc 0:1c0a769988ee 48 float sd2Duty = SD2.read();
brunofgc 0:1c0a769988ee 49 float sd3Duty = SD3.read();
brunofgc 0:1c0a769988ee 50 float sd4Duty = SD4.read();
brunofgc 0:1c0a769988ee 51 float sd5Duty = SD5.read();
brunofgc 5:7801f913384e 52 float sd6Duty = SD6.read();
brunofgc 5:7801f913384e 53 float frequencia = freq*1000.0;
brunofgc 6:d4ebbaaba295 54 float periodo = 1000000.0/frequencia;
brunofgc 6:d4ebbaaba295 55 PwmOut *SD;
brunofgc 0:1c0a769988ee 56 switch(port){
brunofgc 0:1c0a769988ee 57 case 0:
brunofgc 0:1c0a769988ee 58 SD = &SD1;
brunofgc 0:1c0a769988ee 59 break;
brunofgc 0:1c0a769988ee 60 case 1:
brunofgc 0:1c0a769988ee 61 SD = &SD2;
brunofgc 0:1c0a769988ee 62 break;
brunofgc 0:1c0a769988ee 63 case 2:
brunofgc 0:1c0a769988ee 64 SD = &SD3;
brunofgc 0:1c0a769988ee 65 break;
brunofgc 0:1c0a769988ee 66 case 3:
brunofgc 0:1c0a769988ee 67 SD = &SD4;
brunofgc 0:1c0a769988ee 68 break;
brunofgc 0:1c0a769988ee 69 case 4:
brunofgc 0:1c0a769988ee 70 SD = &SD5;
brunofgc 0:1c0a769988ee 71 break;
brunofgc 0:1c0a769988ee 72 case 5:
brunofgc 0:1c0a769988ee 73 SD = &SD6;
brunofgc 0:1c0a769988ee 74 break;
brunofgc 0:1c0a769988ee 75 }
brunofgc 0:1c0a769988ee 76
brunofgc 0:1c0a769988ee 77 SD1.write(0.0f);
brunofgc 0:1c0a769988ee 78 SD2.write(0.0f);
brunofgc 0:1c0a769988ee 79 SD3.write(0.0f);
brunofgc 0:1c0a769988ee 80 SD4.write(0.0f);
brunofgc 0:1c0a769988ee 81 SD5.write(0.0f);
brunofgc 0:1c0a769988ee 82 SD6.write(0.0f);
brunofgc 0:1c0a769988ee 83
brunofgc 6:d4ebbaaba295 84 //pc.printf("Enviando o pacote IR na porta %lu com periodo %f e frequencia %f.\r\n",port,periodo,frequencia);
brunofgc 5:7801f913384e 85
brunofgc 5:7801f913384e 86 //SD->period(1.0/(freq*1000.0));
brunofgc 6:d4ebbaaba295 87 SD->period_us(periodo);
brunofgc 5:7801f913384e 88
brunofgc 5:7801f913384e 89 pc.printf("Iniciando o envio IR.\r\n");
brunofgc 5:7801f913384e 90
brunofgc 6:d4ebbaaba295 91 /*SD->write(0.5);
brunofgc 0:1c0a769988ee 92 if(startBitAlto!=65535){wait_us(startBitAlto);}
brunofgc 0:1c0a769988ee 93 SD->write(0.0);
brunofgc 6:d4ebbaaba295 94 if(startBitBaixo!=65535){wait_us(startBitBaixo);}*/
brunofgc 5:7801f913384e 95 for(i=0;i<indexIr;i++){
brunofgc 0:1c0a769988ee 96 SD->write(0.5);
brunofgc 0:1c0a769988ee 97 if(bitAlto[i]!=65535){wait_us(bits[i][0]);}
brunofgc 0:1c0a769988ee 98 SD->write(0.0);
brunofgc 0:1c0a769988ee 99 if(bitBaixo[i]!=65535){wait_us(bits[i][1]);}
brunofgc 0:1c0a769988ee 100 }
brunofgc 6:d4ebbaaba295 101
brunofgc 5:7801f913384e 102 pc.printf("Finalizado o envio IR.\r\n");
brunofgc 0:1c0a769988ee 103 SD1.period_us(pwmPeriod);
brunofgc 0:1c0a769988ee 104 SD1.write(sd1Duty);
brunofgc 0:1c0a769988ee 105 SD2.write(sd2Duty);
brunofgc 0:1c0a769988ee 106 SD3.write(sd3Duty);
brunofgc 0:1c0a769988ee 107 SD4.write(sd4Duty);
brunofgc 0:1c0a769988ee 108 SD5.write(sd5Duty);
brunofgc 6:d4ebbaaba295 109 SD6.write(sd6Duty);
brunofgc 6:d4ebbaaba295 110
brunofgc 0:1c0a769988ee 111 }
brunofgc 0:1c0a769988ee 112
brunofgc 0:1c0a769988ee 113
brunofgc 5:7801f913384e 114 /*static const long hextable[] = {
brunofgc 0:1c0a769988ee 115 [0 ... 255] = -1, // bit aligned access into this table is considerably
brunofgc 0:1c0a769988ee 116 ['0'] = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // faster for most modern processors,
brunofgc 0:1c0a769988ee 117 ['A'] = 10, 11, 12, 13, 14, 15, // for the space conscious, reduce to
brunofgc 0:1c0a769988ee 118 ['a'] = 10, 11, 12, 13, 14, 15 // signed char.
brunofgc 5:7801f913384e 119 };*/
brunofgc 5:7801f913384e 120
brunofgc 5:7801f913384e 121 uint8_t hextable(char c){
brunofgc 5:7801f913384e 122 uint8_t ret=0;
brunofgc 5:7801f913384e 123 if(c>='a'){
brunofgc 5:7801f913384e 124 ret = c-87;
brunofgc 5:7801f913384e 125 }else if(c>='A'){
brunofgc 5:7801f913384e 126 ret = c-55;
brunofgc 5:7801f913384e 127 }else{
brunofgc 5:7801f913384e 128 ret = c-48;
brunofgc 5:7801f913384e 129 }
brunofgc 5:7801f913384e 130 return ret;
brunofgc 5:7801f913384e 131 }
brunofgc 0:1c0a769988ee 132
brunofgc 0:1c0a769988ee 133 uint16_t hexdec(char *hex,uint16_t tam) {
brunofgc 0:1c0a769988ee 134 uint16_t ret = 0;
brunofgc 7:ae9c47f62946 135 //uint8_t auxHex=0;
brunofgc 5:7801f913384e 136 uint16_t i;
brunofgc 0:1c0a769988ee 137 for(i=0;i<tam;i++){
brunofgc 5:7801f913384e 138 //ret += hextable[hex[i]] << (i*4);
brunofgc 5:7801f913384e 139 ret += hextable(hex[i]) << (i*4);
brunofgc 5:7801f913384e 140 //pc.printf("%c",hex[i]);
brunofgc 5:7801f913384e 141 }
brunofgc 5:7801f913384e 142 //pc.printf("\r\n");
brunofgc 0:1c0a769988ee 143 return ret;
brunofgc 0:1c0a769988ee 144 }
brunofgc 0:1c0a769988ee 145
brunofgc 0:1c0a769988ee 146
brunofgc 5:7801f913384e 147 void deserializaPacoteIR(char *strIr){
brunofgc 5:7801f913384e 148 uint16_t len;
brunofgc 0:1c0a769988ee 149 uint16_t i;
brunofgc 5:7801f913384e 150
brunofgc 5:7801f913384e 151 len = strlen(strIr);
brunofgc 0:1c0a769988ee 152 len = len/4; //Separando de quatro em quatro pra formar um uint16_t
brunofgc 7:ae9c47f62946 153
brunofgc 0:1c0a769988ee 154 for(i=0;i<len;i++){
brunofgc 5:7801f913384e 155 bits[i/2][(i%2)]=hexdec(strIr,4);
brunofgc 5:7801f913384e 156 strIr = strIr+4;
brunofgc 5:7801f913384e 157 }
brunofgc 7:ae9c47f62946 158 indexIr = len/2;
brunofgc 0:1c0a769988ee 159 }
brunofgc 0:1c0a769988ee 160
brunofgc 0:1c0a769988ee 161 void serializaPacoteIR(uint8_t connectionID){
brunofgc 2:55b7b466e742 162 char aux[50];
brunofgc 0:1c0a769988ee 163 uint32_t length;
brunofgc 0:1c0a769988ee 164 char *ptr;
brunofgc 0:1c0a769988ee 165 uint16_t i;
brunofgc 0:1c0a769988ee 166 union{
brunofgc 0:1c0a769988ee 167 char c[2];
brunofgc 0:1c0a769988ee 168 uint16_t v;
brunofgc 0:1c0a769988ee 169 }u;
brunofgc 2:55b7b466e742 170 sdCardBuf.del();
brunofgc 5:7801f913384e 171 for(i=0;i<indexIr;i++){
brunofgc 0:1c0a769988ee 172 u.v = bits[i][0];
brunofgc 0:1c0a769988ee 173 sprintf(aux,"%01X%01X%01X%01X"
brunofgc 0:1c0a769988ee 174 ,u.c[0]&0xF
brunofgc 0:1c0a769988ee 175 ,u.c[0]>>4
brunofgc 0:1c0a769988ee 176 ,u.c[1]&0xF
brunofgc 0:1c0a769988ee 177 ,u.c[1]>>4
brunofgc 0:1c0a769988ee 178 );
brunofgc 0:1c0a769988ee 179 sdCardBuf.fill(aux,strlen(aux));
brunofgc 0:1c0a769988ee 180
brunofgc 0:1c0a769988ee 181 u.v = bits[i][1];
brunofgc 0:1c0a769988ee 182 sprintf(aux,"%01X%01X%01X%01X"
brunofgc 0:1c0a769988ee 183 ,u.c[0]&0xF
brunofgc 0:1c0a769988ee 184 ,u.c[0]>>4
brunofgc 0:1c0a769988ee 185 ,u.c[1]&0xF
brunofgc 0:1c0a769988ee 186 ,u.c[1]>>4
brunofgc 0:1c0a769988ee 187 );
brunofgc 0:1c0a769988ee 188 sdCardBuf.fill(aux,strlen(aux));
brunofgc 0:1c0a769988ee 189 }
brunofgc 0:1c0a769988ee 190 length = sdCardBuf.getLength();
brunofgc 0:1c0a769988ee 191 ptr = sdCardBuf.get();
brunofgc 0:1c0a769988ee 192 modemCom::cipSend(connID,ptr,length);
brunofgc 2:55b7b466e742 193 //pc.printf("Conteudo de sdCardBuf <%s>.\r\n",ptr);
brunofgc 0:1c0a769988ee 194 }
brunofgc 0:1c0a769988ee 195
brunofgc 0:1c0a769988ee 196 bool detectaIRIn(){
brunofgc 0:1c0a769988ee 197 bool detectado=0;
brunofgc 0:1c0a769988ee 198 if((irInAntes!=IrIn) && (!IrIn)){
brunofgc 0:1c0a769988ee 199 bits[0][0] = pulseDuration_us(0,IrIn,10000);
brunofgc 0:1c0a769988ee 200 bits[0][1] = pulseDuration_us(1,IrIn,10000);
brunofgc 0:1c0a769988ee 201 if((bits[0][0]>1000)&&(bits[0][1]>1000)){
brunofgc 5:7801f913384e 202 indexIr = 1;
brunofgc 0:1c0a769988ee 203 do{
brunofgc 5:7801f913384e 204 bits[indexIr][0] = pulseDuration_us(0,IrIn,10000);
brunofgc 5:7801f913384e 205 bits[indexIr][1] = pulseDuration_us(1,IrIn,10000);
brunofgc 5:7801f913384e 206 indexIr++;
brunofgc 0:1c0a769988ee 207
brunofgc 5:7801f913384e 208 }while((bits[indexIr-1][0]!=65535)&&(bits[indexIr-1][1]!=65535));
brunofgc 0:1c0a769988ee 209 detectado=1;
brunofgc 0:1c0a769988ee 210 }
brunofgc 0:1c0a769988ee 211 }
brunofgc 0:1c0a769988ee 212 irInAntes = IrIn;
brunofgc 7:ae9c47f62946 213 ledUsoGeral = !IrIn;
brunofgc 0:1c0a769988ee 214 return detectado;
brunofgc 0:1c0a769988ee 215 }
brunofgc 0:1c0a769988ee 216
brunofgc 0:1c0a769988ee 217 void pesquisaIRIn(){
brunofgc 0:1c0a769988ee 218 if((irInAntes!=IrIn) && (!IrIn)){
brunofgc 0:1c0a769988ee 219 startBitAlto = pulseDuration_us(0,IrIn,10000);
brunofgc 0:1c0a769988ee 220 startBitBaixo = pulseDuration_us(1,IrIn,10000);
brunofgc 0:1c0a769988ee 221 if((startBitAlto>1000)&&(startBitBaixo>1000)){
brunofgc 5:7801f913384e 222 indexIr = 0;
brunofgc 0:1c0a769988ee 223 do{
brunofgc 5:7801f913384e 224 bitAlto[indexIr] = pulseDuration_us(0,IrIn,10000);
brunofgc 5:7801f913384e 225 bitBaixo[indexIr] = pulseDuration_us(1,IrIn,10000);
brunofgc 5:7801f913384e 226 //dataIn[indexIr] = (bitBaixo[indexIr] > 1000);
brunofgc 5:7801f913384e 227 indexIr++;
brunofgc 0:1c0a769988ee 228
brunofgc 5:7801f913384e 229 }while((bitAlto[indexIr-1]!=(-1))&&(bitBaixo[indexIr-1]!=(-1)));
brunofgc 0:1c0a769988ee 230
brunofgc 5:7801f913384e 231 pc.printf("Capturado um quadro com %lu bits. sbH %ld, sbL %ld <",indexIr,startBitAlto, startBitBaixo);
brunofgc 5:7801f913384e 232 for(i=0;i<(indexIr);i++){
brunofgc 0:1c0a769988ee 233 pc.printf("[H%ld L%ld] ",bitAlto[i],bitBaixo[i]);
brunofgc 0:1c0a769988ee 234 }
brunofgc 0:1c0a769988ee 235 pc.printf(">.\n\n");
brunofgc 0:1c0a769988ee 236
brunofgc 5:7801f913384e 237 /*pc.printf("%lu bits 0b",indexIr);
brunofgc 5:7801f913384e 238 for(i=0;i<indexIr;i++){
brunofgc 0:1c0a769988ee 239 pc.printf("%u",dataIn[i]);
brunofgc 0:1c0a769988ee 240 }
brunofgc 0:1c0a769988ee 241 pc.printf("\n\n");*/
brunofgc 0:1c0a769988ee 242
brunofgc 0:1c0a769988ee 243 /*//Montando os bytes;
brunofgc 0:1c0a769988ee 244 byte=0;
brunofgc 0:1c0a769988ee 245 msgBytes=0;
brunofgc 5:7801f913384e 246 for(i=0;i<=indexIr;i++){
brunofgc 0:1c0a769988ee 247 if((i!=0)&&((i%8) == 0)){
brunofgc 0:1c0a769988ee 248 msg[msgBytes]=byte;
brunofgc 0:1c0a769988ee 249 msgBytes++;
brunofgc 0:1c0a769988ee 250 byte=0;
brunofgc 0:1c0a769988ee 251 }
brunofgc 0:1c0a769988ee 252 byte+= dataIn[i]<<(i%8);
brunofgc 0:1c0a769988ee 253
brunofgc 0:1c0a769988ee 254 }
brunofgc 0:1c0a769988ee 255
brunofgc 0:1c0a769988ee 256 //Exibindo pacote
brunofgc 0:1c0a769988ee 257 pc.printf("Resultado 0x");
brunofgc 0:1c0a769988ee 258 for(i=0;i<msgBytes;i++){
brunofgc 0:1c0a769988ee 259 pc.printf("%02X",msg[i]);
brunofgc 0:1c0a769988ee 260 }
brunofgc 0:1c0a769988ee 261 pc.printf("\n\n");
brunofgc 0:1c0a769988ee 262
brunofgc 0:1c0a769988ee 263 //Atuando nos leds
brunofgc 0:1c0a769988ee 264 botao=0;
brunofgc 0:1c0a769988ee 265 for(i=0;i<msgBytes;i++){
brunofgc 0:1c0a769988ee 266 botao+=msg[i]<<(8*i);
brunofgc 0:1c0a769988ee 267
brunofgc 0:1c0a769988ee 268 }
brunofgc 0:1c0a769988ee 269 //pc.printf("Botao pressionado %X\n",botao);
brunofgc 0:1c0a769988ee 270 switch(botao){
brunofgc 0:1c0a769988ee 271 case 0xfb040707: //1
brunofgc 0:1c0a769988ee 272 led2=1;
brunofgc 0:1c0a769988ee 273 break;
brunofgc 0:1c0a769988ee 274 case 0xfa050707: //2
brunofgc 0:1c0a769988ee 275 led3=1;
brunofgc 0:1c0a769988ee 276 break;
brunofgc 0:1c0a769988ee 277 case 0xf9060707: //3
brunofgc 0:1c0a769988ee 278 led4=1;
brunofgc 0:1c0a769988ee 279 break;
brunofgc 0:1c0a769988ee 280 case 0xf7080707: //4
brunofgc 0:1c0a769988ee 281 led2=0;
brunofgc 0:1c0a769988ee 282 break;
brunofgc 0:1c0a769988ee 283 case 0xf6090707: //5
brunofgc 0:1c0a769988ee 284 led3=0;
brunofgc 0:1c0a769988ee 285 break;
brunofgc 0:1c0a769988ee 286 case 0xf50a0707: //6
brunofgc 0:1c0a769988ee 287 led4=0;
brunofgc 0:1c0a769988ee 288 break;
brunofgc 0:1c0a769988ee 289 }*/
brunofgc 0:1c0a769988ee 290 //descritorPacoteIR(int startBitAlto, int startBitBaixo, int *bitAlto, int *bitBaixo, int numBits)
brunofgc 5:7801f913384e 291 //descritorPacoteIR(startBitAlto,startBitBaixo,bitAlto,bitBaixo,indexIr);
brunofgc 0:1c0a769988ee 292 }
brunofgc 0:1c0a769988ee 293 }
brunofgc 0:1c0a769988ee 294 irInAntes = IrIn;
brunofgc 7:ae9c47f62946 295 ledUsoGeral = !IrIn;
brunofgc 0:1c0a769988ee 296 }
brunofgc 0:1c0a769988ee 297
brunofgc 0:1c0a769988ee 298 /*
brunofgc 0:1c0a769988ee 299
brunofgc 0:1c0a769988ee 300 float razaoBit(int iH, int iL){
brunofgc 0:1c0a769988ee 301 float H=(float)iH,L=(float)iL;
brunofgc 0:1c0a769988ee 302 float razao = L/H;
brunofgc 0:1c0a769988ee 303
brunofgc 0:1c0a769988ee 304 if(razao>=1){
brunofgc 0:1c0a769988ee 305 return (float) round(razao);
brunofgc 0:1c0a769988ee 306 }else if(razao>=0.5){
brunofgc 0:1c0a769988ee 307 return 0.5;
brunofgc 0:1c0a769988ee 308 }else if(razao>=0.25){
brunofgc 0:1c0a769988ee 309 return 0.25;
brunofgc 0:1c0a769988ee 310 }else if(razao>=0.125){
brunofgc 0:1c0a769988ee 311 return 0.125;
brunofgc 0:1c0a769988ee 312 }else{
brunofgc 0:1c0a769988ee 313 return -1;
brunofgc 0:1c0a769988ee 314 }
brunofgc 0:1c0a769988ee 315
brunofgc 0:1c0a769988ee 316 }
brunofgc 0:1c0a769988ee 317
brunofgc 0:1c0a769988ee 318 void descritorPacoteIR(int startBitAlto, int startBitBaixo, int *bitAlto, int *bitBaixo, int numBits){
brunofgc 0:1c0a769988ee 319 unsigned int razao_maiorQue4=0;
brunofgc 0:1c0a769988ee 320 unsigned int razao_4=0;
brunofgc 0:1c0a769988ee 321 unsigned int razao_3=0;
brunofgc 0:1c0a769988ee 322 unsigned int razao_2=0;
brunofgc 0:1c0a769988ee 323 unsigned int razao_1=0;
brunofgc 0:1c0a769988ee 324 unsigned int razao_0_5=0;
brunofgc 0:1c0a769988ee 325 unsigned int razao_0_25=0;
brunofgc 0:1c0a769988ee 326 unsigned int razao_0_125=0;
brunofgc 0:1c0a769988ee 327 unsigned int razao_menorQue_0_125=0;
brunofgc 0:1c0a769988ee 328
brunofgc 0:1c0a769988ee 329 //Indice 0 ALto, 1 Baixo;
brunofgc 0:1c0a769988ee 330 unsigned long int bitRazao_maiorQue4[2]= {0,0};
brunofgc 0:1c0a769988ee 331 unsigned long int bitRazao_4[2]= {0,0};
brunofgc 0:1c0a769988ee 332 unsigned long int bitRazao_3[2]= {0,0};
brunofgc 0:1c0a769988ee 333 unsigned long int bitRazao_2[2]= {0,0};
brunofgc 0:1c0a769988ee 334 unsigned long int bitRazao_1[2]= {0,0};
brunofgc 0:1c0a769988ee 335 unsigned long int bitRazao_0_5[2]= {0,0};
brunofgc 0:1c0a769988ee 336 unsigned long int bitRazao_0_25[2]= {0,0};
brunofgc 0:1c0a769988ee 337 unsigned long int bitRazao_0_125[2]= {0,0};
brunofgc 0:1c0a769988ee 338 unsigned long int bitRazao_menorQue_0_125[2]= {0,0};
brunofgc 0:1c0a769988ee 339
brunofgc 0:1c0a769988ee 340 unsigned long int indiceMaiorNEventos[2] = {0,0};
brunofgc 0:1c0a769988ee 341 unsigned long int indiceSegundoMaiorNEventos[2] = {0,0};
brunofgc 0:1c0a769988ee 342
brunofgc 0:1c0a769988ee 343
brunofgc 0:1c0a769988ee 344
brunofgc 0:1c0a769988ee 345 unsigned int bitAlto_H=0;
brunofgc 0:1c0a769988ee 346 unsigned int bitAlto_L=0;
brunofgc 0:1c0a769988ee 347 unsigned int bitBaixo_H=0;
brunofgc 0:1c0a769988ee 348 unsigned int bitBaixo_L=0;
brunofgc 0:1c0a769988ee 349
brunofgc 0:1c0a769988ee 350 unsigned int stopBitAlto = bitAlto[numBits-1];
brunofgc 0:1c0a769988ee 351
brunofgc 0:1c0a769988ee 352 int i;
brunofgc 0:1c0a769988ee 353
brunofgc 0:1c0a769988ee 354 //printf("startBitAlto %d, startBitBaixo %d, stopBitAlto %d, stopBitBaixo %d numBits %d\n",startBitAlto,startBitBaixo,bitAlto[numBits-1],bitBaixo[numBits-1],numBits);
brunofgc 0:1c0a769988ee 355
brunofgc 0:1c0a769988ee 356 //Despresando o stopBit pois esse já sabemos como faz
brunofgc 0:1c0a769988ee 357 for(i=0;i<numBits-1;i++){
brunofgc 0:1c0a769988ee 358 //printf("Razao entre [L %05d e H %05d]=%1.2f\n",bitBaixo[i],bitAlto[i],razaoBit(bitAlto[i],bitBaixo[i]));
brunofgc 0:1c0a769988ee 359 //Detecção de padroes
brunofgc 0:1c0a769988ee 360 if(razaoBit(bitAlto[i],bitBaixo[i])>=4){
brunofgc 0:1c0a769988ee 361 razao_maiorQue4++;
brunofgc 0:1c0a769988ee 362 bitRazao_maiorQue4[0]+= bitAlto[i];
brunofgc 0:1c0a769988ee 363 bitRazao_maiorQue4[1]+=bitBaixo[i];
brunofgc 0:1c0a769988ee 364
brunofgc 0:1c0a769988ee 365 }else if(razaoBit(bitAlto[i],bitBaixo[i])==4){
brunofgc 0:1c0a769988ee 366 razao_4++;
brunofgc 0:1c0a769988ee 367 bitRazao_4[0]+= bitAlto[i];
brunofgc 0:1c0a769988ee 368 bitRazao_4[1]+=bitBaixo[i];
brunofgc 0:1c0a769988ee 369 }else if(razaoBit(bitAlto[i],bitBaixo[i])==3){
brunofgc 0:1c0a769988ee 370 razao_3++;
brunofgc 0:1c0a769988ee 371 bitRazao_3[0]+= bitAlto[i];
brunofgc 0:1c0a769988ee 372 bitRazao_3[1]+=bitBaixo[i];
brunofgc 0:1c0a769988ee 373 }else if(razaoBit(bitAlto[i],bitBaixo[i])==2){
brunofgc 0:1c0a769988ee 374 razao_2++;
brunofgc 0:1c0a769988ee 375 bitRazao_2[0]+= bitAlto[i];
brunofgc 0:1c0a769988ee 376 bitRazao_2[1]+=bitBaixo[i];
brunofgc 0:1c0a769988ee 377 }else if(razaoBit(bitAlto[i],bitBaixo[i])==1){
brunofgc 0:1c0a769988ee 378 razao_1++;
brunofgc 0:1c0a769988ee 379 bitRazao_1[0]+= bitAlto[i];
brunofgc 0:1c0a769988ee 380 bitRazao_1[1]+=bitBaixo[i];
brunofgc 0:1c0a769988ee 381 }else if(razaoBit(bitAlto[i],bitBaixo[i])==0.5){
brunofgc 0:1c0a769988ee 382 razao_0_5++;
brunofgc 0:1c0a769988ee 383 bitRazao_0_5[0]+= bitAlto[i];
brunofgc 0:1c0a769988ee 384 bitRazao_0_5[1]+=bitBaixo[i];
brunofgc 0:1c0a769988ee 385 }else if(razaoBit(bitAlto[i],bitBaixo[i])==0.25){
brunofgc 0:1c0a769988ee 386 razao_0_25++;
brunofgc 0:1c0a769988ee 387 bitRazao_0_25[0]+= bitAlto[i];
brunofgc 0:1c0a769988ee 388 bitRazao_0_25[1]+=bitBaixo[i];
brunofgc 0:1c0a769988ee 389 }else if(razaoBit(bitAlto[i],bitBaixo[i])==0.125){
brunofgc 0:1c0a769988ee 390 razao_0_125++;
brunofgc 0:1c0a769988ee 391 bitRazao_0_125[0]+= bitAlto[i];
brunofgc 0:1c0a769988ee 392 bitRazao_0_125[1]+=bitBaixo[i];
brunofgc 0:1c0a769988ee 393 }else {
brunofgc 0:1c0a769988ee 394 razao_menorQue_0_125++;
brunofgc 0:1c0a769988ee 395 bitRazao_menorQue_0_125[0]+= bitAlto[i];
brunofgc 0:1c0a769988ee 396 bitRazao_menorQue_0_125[1]+=bitBaixo[i];
brunofgc 0:1c0a769988ee 397 }
brunofgc 0:1c0a769988ee 398
brunofgc 0:1c0a769988ee 399 }
brunofgc 0:1c0a769988ee 400 printf("Razoes <0.125 = %d\n 0.125 = %d\n 0.25 = %d\n 0.5 = %d\n 1 = %d\n 2 = %d\n 3 = %d\n 4 = %d\n maior que 4 = %d\n"
brunofgc 0:1c0a769988ee 401 ,razao_menorQue_0_125
brunofgc 0:1c0a769988ee 402 ,razao_0_125
brunofgc 0:1c0a769988ee 403 ,razao_0_25
brunofgc 0:1c0a769988ee 404 ,razao_0_5
brunofgc 0:1c0a769988ee 405 ,razao_1
brunofgc 0:1c0a769988ee 406 ,razao_2
brunofgc 0:1c0a769988ee 407 ,razao_3
brunofgc 0:1c0a769988ee 408 ,razao_4
brunofgc 0:1c0a769988ee 409 ,razao_maiorQue4
brunofgc 0:1c0a769988ee 410 );
brunofgc 0:1c0a769988ee 411
brunofgc 0:1c0a769988ee 412 //Buscando os dois maiores em numero de eventos por Indice;
brunofgc 0:1c0a769988ee 413 //Buscando o primeiro
brunofgc 0:1c0a769988ee 414 for(i=0;i<9;i++){
brunofgc 0:1c0a769988ee 415 //Buscando nos indices maior numero eventos
brunofgc 0:1c0a769988ee 416 switch(i){
brunofgc 0:1c0a769988ee 417 case 0:
brunofgc 0:1c0a769988ee 418 if(razao_maiorQue4>indiceMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 419 indiceMaiorNEventos[0] = razao_maiorQue4;
brunofgc 0:1c0a769988ee 420 indiceMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 421 }
brunofgc 0:1c0a769988ee 422 break;
brunofgc 0:1c0a769988ee 423
brunofgc 0:1c0a769988ee 424 case 1:
brunofgc 0:1c0a769988ee 425 if(razao_4>indiceMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 426 indiceMaiorNEventos[0] = razao_4;
brunofgc 0:1c0a769988ee 427 indiceMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 428 }
brunofgc 0:1c0a769988ee 429 break;
brunofgc 0:1c0a769988ee 430 case 2:
brunofgc 0:1c0a769988ee 431 if(razao_3>indiceMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 432 indiceMaiorNEventos[0] = razao_3;
brunofgc 0:1c0a769988ee 433 indiceMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 434 }
brunofgc 0:1c0a769988ee 435 break;
brunofgc 0:1c0a769988ee 436 case 3:
brunofgc 0:1c0a769988ee 437 if(razao_2>indiceMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 438 indiceMaiorNEventos[0] = razao_2;
brunofgc 0:1c0a769988ee 439 indiceMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 440 }
brunofgc 0:1c0a769988ee 441 break;
brunofgc 0:1c0a769988ee 442 case 4:
brunofgc 0:1c0a769988ee 443 if(razao_1>indiceMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 444 indiceMaiorNEventos[0] = razao_1;
brunofgc 0:1c0a769988ee 445 indiceMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 446 }
brunofgc 0:1c0a769988ee 447 break;
brunofgc 0:1c0a769988ee 448 case 5:
brunofgc 0:1c0a769988ee 449 if(razao_0_5>indiceMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 450 indiceMaiorNEventos[0] = razao_0_5;
brunofgc 0:1c0a769988ee 451 indiceMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 452 }
brunofgc 0:1c0a769988ee 453 break;
brunofgc 0:1c0a769988ee 454 case 6:
brunofgc 0:1c0a769988ee 455 if(razao_0_25>indiceMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 456 indiceMaiorNEventos[0] = razao_0_25;
brunofgc 0:1c0a769988ee 457 indiceMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 458 }
brunofgc 0:1c0a769988ee 459 break;
brunofgc 0:1c0a769988ee 460 case 7:
brunofgc 0:1c0a769988ee 461 if(razao_0_125>indiceMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 462 indiceMaiorNEventos[0] = razao_0_125;
brunofgc 0:1c0a769988ee 463 indiceMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 464 }
brunofgc 0:1c0a769988ee 465 break;
brunofgc 0:1c0a769988ee 466 case 8:
brunofgc 0:1c0a769988ee 467 if(razao_menorQue_0_125>indiceMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 468 indiceMaiorNEventos[0] = razao_menorQue_0_125;
brunofgc 0:1c0a769988ee 469 indiceMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 470 }
brunofgc 0:1c0a769988ee 471 break;
brunofgc 0:1c0a769988ee 472
brunofgc 0:1c0a769988ee 473 }
brunofgc 0:1c0a769988ee 474 }
brunofgc 0:1c0a769988ee 475
brunofgc 0:1c0a769988ee 476 //Buscando o segundo
brunofgc 0:1c0a769988ee 477 //Buscando o primeiro
brunofgc 0:1c0a769988ee 478 for(i=0;i<9;i++){
brunofgc 0:1c0a769988ee 479 //Buscando nos indices maior numero eventos
brunofgc 0:1c0a769988ee 480 if(i!=indiceMaiorNEventos[1]){
brunofgc 0:1c0a769988ee 481 switch(i){
brunofgc 0:1c0a769988ee 482 case 0:
brunofgc 0:1c0a769988ee 483 if(razao_maiorQue4>indiceSegundoMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 484 indiceSegundoMaiorNEventos[0] = razao_maiorQue4;
brunofgc 0:1c0a769988ee 485 indiceSegundoMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 486 }
brunofgc 0:1c0a769988ee 487 break;
brunofgc 0:1c0a769988ee 488
brunofgc 0:1c0a769988ee 489 case 1:
brunofgc 0:1c0a769988ee 490 if(razao_4>indiceSegundoMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 491 indiceSegundoMaiorNEventos[0] = razao_4;
brunofgc 0:1c0a769988ee 492 indiceSegundoMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 493 }
brunofgc 0:1c0a769988ee 494 break;
brunofgc 0:1c0a769988ee 495 case 2:
brunofgc 0:1c0a769988ee 496 if(razao_3>indiceSegundoMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 497 indiceSegundoMaiorNEventos[0] = razao_3;
brunofgc 0:1c0a769988ee 498 indiceSegundoMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 499 }
brunofgc 0:1c0a769988ee 500 break;
brunofgc 0:1c0a769988ee 501 case 3:
brunofgc 0:1c0a769988ee 502 if(razao_2>indiceSegundoMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 503 indiceSegundoMaiorNEventos[0] = razao_2;
brunofgc 0:1c0a769988ee 504 indiceSegundoMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 505 }
brunofgc 0:1c0a769988ee 506 break;
brunofgc 0:1c0a769988ee 507 case 4:
brunofgc 0:1c0a769988ee 508 if(razao_1>indiceSegundoMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 509 indiceSegundoMaiorNEventos[0] = razao_1;
brunofgc 0:1c0a769988ee 510 indiceSegundoMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 511 }
brunofgc 0:1c0a769988ee 512 break;
brunofgc 0:1c0a769988ee 513 case 5:
brunofgc 0:1c0a769988ee 514 if(razao_0_5>indiceSegundoMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 515 indiceSegundoMaiorNEventos[0] = razao_0_5;
brunofgc 0:1c0a769988ee 516 indiceSegundoMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 517 }
brunofgc 0:1c0a769988ee 518 break;
brunofgc 0:1c0a769988ee 519 case 6:
brunofgc 0:1c0a769988ee 520 if(razao_0_25>indiceSegundoMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 521 indiceSegundoMaiorNEventos[0] = razao_0_25;
brunofgc 0:1c0a769988ee 522 indiceSegundoMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 523 }
brunofgc 0:1c0a769988ee 524 break;
brunofgc 0:1c0a769988ee 525 case 7:
brunofgc 0:1c0a769988ee 526 if(razao_0_125>indiceSegundoMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 527 indiceSegundoMaiorNEventos[0] = razao_0_125;
brunofgc 0:1c0a769988ee 528 indiceSegundoMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 529 }
brunofgc 0:1c0a769988ee 530 break;
brunofgc 0:1c0a769988ee 531 case 8:
brunofgc 0:1c0a769988ee 532 if(razao_menorQue_0_125>indiceSegundoMaiorNEventos[0]){
brunofgc 0:1c0a769988ee 533 indiceSegundoMaiorNEventos[0] = razao_menorQue_0_125;
brunofgc 0:1c0a769988ee 534 indiceSegundoMaiorNEventos[1] = i;
brunofgc 0:1c0a769988ee 535 }
brunofgc 0:1c0a769988ee 536 break;
brunofgc 0:1c0a769988ee 537
brunofgc 0:1c0a769988ee 538 }
brunofgc 0:1c0a769988ee 539 }
brunofgc 0:1c0a769988ee 540 }
brunofgc 0:1c0a769988ee 541
brunofgc 0:1c0a769988ee 542
brunofgc 0:1c0a769988ee 543 //printf("Indice de maior aparecimento foi o de %d.\nIndice de segundo maior aparecimento foi o de %d.\n",indiceMaiorNEventos[1],indiceSegundoMaiorNEventos[1]);
brunofgc 0:1c0a769988ee 544
brunofgc 0:1c0a769988ee 545 //Calculando bitAlto
brunofgc 0:1c0a769988ee 546 switch(indiceMaiorNEventos[1]){
brunofgc 0:1c0a769988ee 547 case 0:
brunofgc 0:1c0a769988ee 548 bitAlto_H = round(bitRazao_maiorQue4[0]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 549 bitAlto_L = round(bitRazao_maiorQue4[1]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 550 break;
brunofgc 0:1c0a769988ee 551 case 1:
brunofgc 0:1c0a769988ee 552 bitAlto_H = round(bitRazao_4[0]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 553 bitAlto_L = round(bitRazao_4[1]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 554 break;
brunofgc 0:1c0a769988ee 555 case 2:
brunofgc 0:1c0a769988ee 556 bitAlto_H = round(bitRazao_3[0]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 557 bitAlto_L = round(bitRazao_3[1]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 558 break;
brunofgc 0:1c0a769988ee 559 case 3:
brunofgc 0:1c0a769988ee 560 bitAlto_H = round(bitRazao_2[0]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 561 bitAlto_L = round(bitRazao_2[1]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 562 break;
brunofgc 0:1c0a769988ee 563 case 4:
brunofgc 0:1c0a769988ee 564 bitAlto_H = round(bitRazao_1[0]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 565 bitAlto_L = round(bitRazao_1[1]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 566 break;
brunofgc 0:1c0a769988ee 567 case 5:
brunofgc 0:1c0a769988ee 568 bitAlto_H = round(bitRazao_0_5[0]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 569 bitAlto_L = round(bitRazao_0_5[1]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 570 break;
brunofgc 0:1c0a769988ee 571 case 6:
brunofgc 0:1c0a769988ee 572 bitAlto_H = round(bitRazao_0_25[0]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 573 bitAlto_L = round(bitRazao_0_25[1]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 574 break;
brunofgc 0:1c0a769988ee 575 case 7:
brunofgc 0:1c0a769988ee 576 bitAlto_H = round(bitRazao_0_125[0]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 577 bitAlto_L = round(bitRazao_0_125[1]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 578 break;
brunofgc 0:1c0a769988ee 579 case 8:
brunofgc 0:1c0a769988ee 580 bitAlto_H = round(bitRazao_menorQue_0_125[0]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 581 bitAlto_L = round(bitRazao_menorQue_0_125[1]/indiceMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 582 break;
brunofgc 0:1c0a769988ee 583 }
brunofgc 0:1c0a769988ee 584
brunofgc 0:1c0a769988ee 585 //Calculando bitBaixo
brunofgc 0:1c0a769988ee 586 switch(indiceSegundoMaiorNEventos[1]){
brunofgc 0:1c0a769988ee 587 case 0:
brunofgc 0:1c0a769988ee 588 bitBaixo_H = round(bitRazao_maiorQue4[0]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 589 bitBaixo_L = round(bitRazao_maiorQue4[1]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 590 break;
brunofgc 0:1c0a769988ee 591 case 1:
brunofgc 0:1c0a769988ee 592 bitBaixo_H = round(bitRazao_4[0]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 593 bitBaixo_L = round(bitRazao_4[1]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 594 break;
brunofgc 0:1c0a769988ee 595 case 2:
brunofgc 0:1c0a769988ee 596 bitBaixo_H = round(bitRazao_3[0]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 597 bitBaixo_L = round(bitRazao_3[1]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 598 break;
brunofgc 0:1c0a769988ee 599 case 3:
brunofgc 0:1c0a769988ee 600 bitBaixo_H = round(bitRazao_2[0]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 601 bitBaixo_L = round(bitRazao_2[1]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 602 break;
brunofgc 0:1c0a769988ee 603 case 4:
brunofgc 0:1c0a769988ee 604 bitBaixo_H = round(bitRazao_1[0]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 605 bitBaixo_L = round(bitRazao_1[1]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 606 break;
brunofgc 0:1c0a769988ee 607 case 5:
brunofgc 0:1c0a769988ee 608 bitBaixo_H = round(bitRazao_0_5[0]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 609 bitBaixo_L = round(bitRazao_0_5[1]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 610 break;
brunofgc 0:1c0a769988ee 611 case 6:
brunofgc 0:1c0a769988ee 612 bitBaixo_H = round(bitRazao_0_25[0]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 613 bitBaixo_L = round(bitRazao_0_25[1]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 614 break;
brunofgc 0:1c0a769988ee 615 case 7:
brunofgc 0:1c0a769988ee 616 bitBaixo_H = round(bitRazao_0_125[0]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 617 bitBaixo_L = round(bitRazao_0_125[1]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 618 break;
brunofgc 0:1c0a769988ee 619 case 8:
brunofgc 0:1c0a769988ee 620 bitBaixo_H = round(bitRazao_menorQue_0_125[0]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 621 bitBaixo_L = round(bitRazao_menorQue_0_125[1]/indiceSegundoMaiorNEventos[0]);
brunofgc 0:1c0a769988ee 622 break;
brunofgc 0:1c0a769988ee 623 }
brunofgc 0:1c0a769988ee 624
brunofgc 0:1c0a769988ee 625 printf("\n\nFinalmente.\n");
brunofgc 0:1c0a769988ee 626 printf("startBitAlto = %ld, startBitBaixo = %ld\n", startBitAlto,startBitBaixo);
brunofgc 0:1c0a769988ee 627 printf("bitAlto_H = %ld bitAlto_l = %ld\n",bitAlto_H,bitAlto_L);
brunofgc 0:1c0a769988ee 628 printf("bitBaixo_H = %ld bitBaixo_l = %ld\n",bitBaixo_H,bitBaixo_L);
brunofgc 0:1c0a769988ee 629 printf("stopBitAlto = %ld\n",stopBitAlto);
brunofgc 0:1c0a769988ee 630
brunofgc 0:1c0a769988ee 631 return;
brunofgc 0:1c0a769988ee 632 }*/