Download Full report - ECE - Cornell University
Transcript
Microcontroller Control System for Heart Valve Bioreactor Kang Li (kl694) trtWait(SEM_INPUT); //load the values to corresponding variables sscanf(P_str, "%f", &P); sscanf(C_str, "%f", &C); sscanf(D_str, "%f", &D); sscanf(G_str, "%f", &G); sscanf(B_str, "%f", &B); sscanf(T_str, "%d", &T); trtSignal(SEM_INPUT); end if (cmd[0] == 's') // send the package to PC begin trtWait(SEM_SEND); fprintf(stdout, "%s", sendData); trtSignal(SEM_SEND) ; end if (cmd[0] == 'c') // check the current state of the whole system begin trtWait(SEM_INPUT); fprintf(stdout, "\rP_diff%fdP_MA%fdelta%fGain%fBias%fThres%d\n", P_diff, dP_MA, delta, Gain, Bias, thres); trtSignal(SEM_INPUT); end end end void initialize(void) begin CLKPR = (1 << CLKPCE); CLKPR = (1 << CLKPS0) | (1 << CLKPS1); // set divide by 8 //PINA is input DDRA = 0x00; PORTA = 0x00; //PIND is output DDRD = 0xff; PORTD = 0x00; //PINC is output DDRC = 0xff; PORTC = 0x00; ADMUX = (1<<REFS0) | (1<<ADLAR) + 0b00000; 27