//----- Begin Code ------------------------------------------------------------ int main(void) { // initialize our libraries // initialize the UART (serial port) uartInit(); uartSetBaudRate(115200); // make all rprintf statements use uart for output rprintfInit(uartSendByte); // initialize the timer system timerInit(); // initialize vt100 terminal vt100Init(); timerPause(100); // print welcome message vt100ClearScreen(); vt100SetCursorPos(1,0); rprintfProgStrM("\r\nWelcome to the MMC Test Suite!\r\n"); timerPause(1000); mmcTest(); return 0; }
//------------------------------------------------------------------------------------ void sp5K_stackFunction(void) { // Funcion de debug que muestra el estado de los stacks de c/tarea. if (xSemaphoreTake( sem_CmdUart, MSTOTAKECMDUARTSEMPH ) == pdTRUE ) { vt100ClearScreen(CMD_UART); snprintf_P( cmd_printfBuff,CHAR128,PSTR("Control: [%lu | %d]\r\n\0"), tkControl_uxHighWaterMark, tkControl_STACK_SIZE ); rprintfStr(CMD_UART, cmd_printfBuff ); snprintf_P( cmd_printfBuff,CHAR128,PSTR("Digital: [%lu | %d]\r\n\0"), tkDigitalIn_uxHighWaterMark, tkDigitalIn_STACK_SIZE ); rprintfStr(CMD_UART, cmd_printfBuff ); snprintf_P( cmd_printfBuff,CHAR128,PSTR("Data: [%lu | %d]\r\n\0"), tkData_uxHighWaterMark, tkData_STACK_SIZE ); rprintfStr(CMD_UART, cmd_printfBuff ); snprintf_P( cmd_printfBuff,CHAR128,PSTR("Cmd: [%lu | %d]\r\n\0"), tkCmd_uxHighWaterMark, tkCmd_STACK_SIZE ); rprintfStr(CMD_UART, cmd_printfBuff ); snprintf_P( cmd_printfBuff,CHAR128,PSTR("Gprs: [%lu | %d]\r\n\0"),tkGprs_uxHighWaterMark, tkGprs_STACK_SIZE ); rprintfStr(CMD_UART, cmd_printfBuff ); xSemaphoreGive( sem_CmdUart ); } }
void gpsNmeaTest(void) { // set the baud rate of UART 1 for NMEA uartSetBaudRate(1,4800); // clear screen vt100ClearScreen(); // initialize gps library gpsInit(); // initialize gps packet decoder nmeaInit(); // begin gps packet processing loop while(1) { // process received gps packets until receive buffer is exhausted while( nmeaProcess(uartGetRxBuffer(1)) ); // set cursor position to top left of screen vt100SetCursorPos(0,0); // print/dump current formatted GPS data gpsInfoPrint(); // print UART 1 overflow status to verify that we're processing packets // fast enough and that our receive buffer is large enough rprintf("Uart1RxOvfl: %d\r\n",uartRxOverflow[1]); // pause for 100ms timerPause(100); } }
void CommandLine(void) { u08 c; /* Variable to Run or stop program */ Run = TRUE; /* Clears the screen and sets the cursor under the Title */ vt100ClearScreen(); vt100SetCursorPos(1,0); rprintfProgStrM("\r\n\t\t\tStepper Motor Driver - Serial Console\r\n"); cmdlineInit(); cmdlineSetOutputFunc(uartSendByte); cmdlineAddCommand("quit", quitCommandLine); cmdlineAddCommand("help", helpDisplay); cmdlineAddCommand("step", runMotor); cmdlineInputFunc('\r'); while(Run) { while( uartReceiveByte(&c) ) cmdlineInputFunc(c); cmdlineMainLoop(); } rprintfCRLF(); rprintf("Program halted."); }
//----- Begin Code ------------------------------------------------------------ int main(void) { // initialize our libraries // initialize the UART (serial port) uartInit(); // set the baud rate of UART 0 for our debug/reporting output uartSetBaudRate(0,9600); // set uart0SendByte as the output for all rprintf statements rprintfInit(uart0SendByte); // initialize the timer system timerInit(); // initialize vt100 library vt100Init(); // print a little intro message so we know things are working vt100ClearScreen(); rprintf("\r\nWelcome to GPS Test!\r\n"); // run example gps processing loop // (pick the one appropriate for your GPS packet format) // gpsTsipTest(); gpsNmeaTest(); return 0; }
//----- Begin Code ------------------------------------------------------------ int main(void) { // initialize our libraries // initialize the UART (serial port) uartInit(); // set the baud rate of the UART for our debug/reporting output uartSetBaudRate(9600); // initialize the timer system timerInit(); // initialize rprintf system // - use uartSendByte as the output for all rprintf statements // this will cause all rprintf library functions to direct their // output to the uart // - rprintf can be made to output to any device which takes characters. // You must write a function which takes an unsigned char as an argument // and then pass this to rprintfInit like this: rprintfInit(YOUR_FUNCTION); rprintfInit(uartSendByte); // initialize vt100 library vt100Init(); // clear the terminal screen vt100ClearScreen(); // run the test rprintfTest(); return 0; }
//----- Begin Code ------------------------------------------------------------ int main(void) { u16 a=0; u08 i=0; // initialize our libraries // initialize the UART (serial port) uartInit(); // make all rprintf statements use uart for output rprintfInit(uartSendByte); // initialize the timer system timerInit(); // turn on and initialize A/D converter a2dInit(); // print a little intro message so we know things are working vt100ClearScreen(); vt100SetCursorPos(1,1); rprintf("Welcome to the a2d test!\r\n"); // configure a2d port (PORTA) as input // so we can receive analog signals DDRA = 0x00; // make sure pull-up resistors are turned off PORTA = 0x00; // set the a2d prescaler (clock division ratio) // - a lower prescale setting will make the a2d converter go faster // - a higher setting will make it go slower but the measurements // will be more accurate // - other allowed prescale values can be found in a2d.h a2dSetPrescaler(ADC_PRESCALE_DIV32); // set the a2d reference // - the reference is the voltage against which a2d measurements are made // - other allowed reference values can be found in a2d.h a2dSetReference(ADC_REFERENCE_AVCC); // use a2dConvert8bit(channel#) to get an 8bit a2d reading // use a2dConvert10bit(channel#) to get a 10bit a2d reading while(1) { // sample all a2d channels and print them to the terminal vt100SetCursorPos(2,1); for(i=0; i<8; i++) { rprintf("Channel %d: %d \r\n", i, a2dConvert8bit(i)); } // print the sample number so far rprintf("Sample # : %d \r\n", a++); } return 0; }
void init_uart(void) { // initialize our libraries // initialize the UART (serial port) uartInit(); // set the baud rate of the UART for our debug/reporting output uartSetBaudRate(9600); // set uartSendByte as the output for all rprintf statements rprintfInit(uartSendByte); // initialize the timer system timerInit(); // initialize vt100 library vt100Init(); vt100ClearScreen(); // print a little intro message so we know things are working rprintf("\r\nServo tester\r\n"); rprintf("Sebastien CELLES\r\n"); rprintf("IUT de Poitiers\r\n"); rprintf("Genie Thermique et Energie\r\n"); }
void goCmdline(void) { u08 c; // print welcome message vt100ClearScreen(); vt100SetCursorPos(1,0); rprintfProgStrM("\r\nWelcome to the Command Line Test Suite!\r\n"); // initialize cmdline system cmdlineInit(); // direct cmdline output to uart (serial port) cmdlineSetOutputFunc(uartSendByte); // add commands to the command database cmdlineAddCommand("exit", exitFunction); cmdlineAddCommand("help", helpFunction); cmdlineAddCommand("dumpargs1", dumpArgsStr); cmdlineAddCommand("dumpargs2", dumpArgsInt); cmdlineAddCommand("dumpargs3", dumpArgsHex); // send a CR to cmdline input to stimulate a prompt cmdlineInputFunc('\r'); // set state to run Run = TRUE; // main loop while(Run) { // pass characters received on the uart (serial port) // into the cmdline processor while(uartReceiveByte(&c)) cmdlineInputFunc(c); // run the cmdline execution functions cmdlineMainLoop(); } rprintfCRLF(); rprintf("Exited program!\r\n"); }
//----- Begin Code ------------------------------------------------------------ int main(void) { // initialize our libraries // initialize the UART (serial port) uartInit(); uartSetBaudRate(115200); // make all rprintf statements use uart for output rprintfInit(uartSendByte); // initialize the timer system timerInit(); // clear terminal screen vt100ClearScreen(); vt100SetCursorPos(1,1); // print a little intro message so we know things are working rprintf("\r\nWelcome to ADS7828 test!\r\n"); // run tests ads7828test(); return 0; }
//----- Begin Code ------------------------------------------------------------ int main(void) { // initialize our libraries // initialize the UART (serial port) uartInit(); // set the baud rate of the UART for our debug/reporting output uartSetBaudRate(9600); // set uartSendByte as the output for all rprintf statements rprintfInit(uartSendByte); // initialize the timer system timerInit(); // initialize vt100 library vt100Init(); vt100ClearScreen(); // print a little intro message so we know things are working rprintf("\r\nWelcome to Servo Test!\r\n"); // begin servo test servoTest(); return 0; }
//----- Begin Code ------------------------------------------------------------ int main(void) { // initialize our libraries // initialize the UART (serial port) uartInit(); // set the baud rate of the UART for our debug/reporting output uartSetBaudRate(9600); // initialize the timer system timerInit(); // initialize rprintf system rprintfInit(uartSendByte); // initialize vt100 library vt100Init(); // clear the terminal screen vt100ClearScreen(); // run the test encoderTest(); return 0; }
void tkCmd(void * pvParameters) { u08 c; ( void ) pvParameters; // !!! Requiere que este inicializado el FRTOS porque usa semaforos. MCP_init(); // IO ports for hardware vTaskDelay( (portTickType)( 1000 / portTICK_RATE_MS ) ); initDebugRtc(); initBlueTooth(); vt100ClearScreen(CMD_UART); // Inicializo los parametros de trabajo ( leo la internal EE ). loadSystemParams(); // Inicializo la memoria. Leo el estado de los punteros ( leo la external EE). BD_init(); // vTaskDelay( (portTickType)( 100 / portTICK_RATE_MS ) ); snprintf_P( cmd_printfBuff,CHAR128,PSTR("\r\n.INIT EEmem BD: wrPtr=%d, rdPtr=%d, recUsed=%d, recFree=%d\r\n\0"), BD_getWRptr(), BD_getRDptr(), BD_getRcsUsed(), BD_getRcsFree() ); logPrintStr(LOG_NONE, cmd_printfBuff); switch (mcpDevice) { case MCP23008: #ifdef CHANNELS_3 snprintf_P( cmd_printfBuff,CHAR128,PSTR("System: 3 analogIn,2 digitalIn\r\n\0")); #endif #ifdef CHANNELS_8 snprintf_P( cmd_printfBuff,CHAR128,PSTR("System: 8 analogIn,2 digitalIn\r\n\0")); #endif break; case MCP23018: snprintf_P( cmd_printfBuff,CHAR128,PSTR("System: 3 analogIn,2 digitalIn,4 valves\r\n\0")); break; default: snprintf_P( cmd_printfBuff,CHAR128,PSTR("ERROR !! No analog system detected\r\n\0")); break; } logPrintStr(LOG_NONE, cmd_printfBuff); // Inicializo el sistema de consignas. initConsignas(); switch (systemVars.consigna.tipo) { case CONS_NONE: snprintf_P( cmd_printfBuff,CHAR128,PSTR("Init consignas: none\r\n\0")); break; case CONS_DOBLE: snprintf_P( cmd_printfBuff,CHAR128,PSTR("Init consignas: doble\r\n\0")); break; default: snprintf_P( cmd_printfBuff,CHAR128,PSTR("Init consignas: ERROR\r\n\0")); break; } logPrintStr(LOG_NONE, cmd_printfBuff); // // Init Banner. snprintf_P( cmd_printfBuff,CHAR128,PSTR("\r\nSpymovil %s %s"), SP5K_MODELO, SP5K_VERSION); logPrintStr(LOG_NONE, cmd_printfBuff); snprintf_P( cmd_printfBuff,CHAR128,PSTR(" %d-%s-%s"), NRO_CHANNELS, EE_TYPE, FTYPE); logPrintStr(LOG_NONE, cmd_printfBuff); snprintf_P( cmd_printfBuff,CHAR128,PSTR(" %s %s\r\n\0"), SP5K_REV, SP5K_DATE ); logPrintStr(LOG_NONE, cmd_printfBuff); #ifdef MEMINFO snprintf_P( &cmd_printfBuff,CHAR128,PSTR("HE_Uart0TxQueue=%lu\r\n\0"), HE_Uart0TxQueue ); logPrintStr(LOG_NONE, &cmd_printfBuff); snprintf_P( &cmd_printfBuff,CHAR128,PSTR("HE_Uart1RxQueue=%lu\r\n\0"), HE_Uart1RxQueue ); logPrintStr(LOG_NONE, &cmd_printfBuff); snprintf_P( &cmd_printfBuff,CHAR128,PSTR("HE_Uart1TxQueue=%lu\r\n\0"), HE_Uart1TxQueue ); logPrintStr(LOG_NONE, &cmd_printfBuff); snprintf_P( &cmd_printfBuff,CHAR128,PSTR("HE_I2Cbus=%lu\r\n\0"), HE_I2Cbus ); logPrintStr(LOG_NONE, &cmd_printfBuff); snprintf_P( &cmd_printfBuff,CHAR128,PSTR("HE_CmdUart=%lu\r\n\0"), HE_CmdUart ); logPrintStr(LOG_NONE, &cmd_printfBuff); snprintf_P( &cmd_printfBuff,CHAR128,PSTR("HE_GprsUart=%lu\r\n\0"), HE_GprsUart ); logPrintStr(LOG_NONE, &cmd_printfBuff); snprintf_P( &cmd_printfBuff,CHAR128,PSTR("HE_digitalIn=%lu\r\n\0"), HE_digitalIn ); logPrintStr(LOG_NONE, &cmd_printfBuff); snprintf_P( &cmd_printfBuff,CHAR128,PSTR("HE_systemVars=%lu\r\n\0"), HE_systemVars ); logPrintStr(LOG_NONE, &cmd_printfBuff); snprintf_P( &cmd_printfBuff,CHAR128,PSTR("HE_BD=%lu\r\n\0"), HE_BD ); logPrintStr(LOG_NONE, &cmd_printfBuff); snprintf_P( &cmd_printfBuff,CHAR128,PSTR("HE_tkCmd=%lu\r\n\0"), HE_tkCmd ); logPrintStr(LOG_NONE, &cmd_printfBuff); snprintf_P( &cmd_printfBuff,CHAR128,PSTR("HE_tkDigitalIn=%lu\r\n\0"), HE_tkDigitalIn ); logPrintStr(LOG_NONE, &cmd_printfBuff); snprintf_P( &cmd_printfBuff,CHAR128,PSTR("HE_tkData=%lu\r\n\0"), HE_tkData ); logPrintStr(LOG_NONE, &cmd_printfBuff); snprintf_P( &cmd_printfBuff,CHAR128,PSTR("HE_tkControl=%lu\r\n\0"), HE_tkControl ); logPrintStr(LOG_NONE, &cmd_printfBuff); snprintf_P( &cmd_printfBuff,CHAR128,PSTR("HE_tkGprs=%lu\r\n\0"), HE_tkGprs ); logPrintStr(LOG_NONE, &cmd_printfBuff); #endif // Habilito al resto del sistema a arrancar if (xSemaphoreTake( sem_systemVars, MSTOTAKESYSTEMVARSSEMPH ) == pdTRUE ) { systemVars.initStatus = TRUE; xSemaphoreGive( sem_systemVars ); } for( ;; ) { // Para medir el uso del stack tkCmd_uxHighWaterMark = uxTaskGetStackHighWaterMark( NULL ); clearWdg(WDG_CMD); while(xUartGetChar(CMD_UART, &c, (50 / portTICK_RATE_MS ) ) ) { cmdlineInputFunc(c); // Cada caracer recibido reinicio el timer. restartTimerTerminal(); } /* run the cmdline execution functions */ cmdlineMainLoop(); } }
/******************************************************************* * rprintf_test *******************************************************************/ void rprintf_test(void) { u16 val; u08 mydata; u08 mystring[10]; double b; u08 small; u16 medium; u32 big; // initialize the UART (serial port) uartInit(); // set the baud rate of the UART for our debug/reporting output uartSetBaudRate(38400); // initialize rprintf system // - use uartSendByte as the output for all rprintf statements // this will cause all rprintf library functions to direct their // output to the uart // - rprintf can be made to output to any device which takes characters. // You must write a function which takes an unsigned char as an argument // and then pass this to rprintfInit like this: rprintfInit(YOUR_FUNCTION); rprintfInit(uartSendByte); // initialize vt100 library vt100Init(); // clear the terminal screen vt100ClearScreen(); while (!(getkey() == 1)) //do the folling block until enter is pressed { // print a little intro message so we know things are working rprintf("\r\nWelcome to rprintf Test!\r\n"); // print single characters rprintfChar('H'); rprintfChar('e'); rprintfChar('l'); rprintfChar('l'); rprintfChar('o'); // print a constant string stored in FLASH rprintfProgStrM(" World!"); // print a carriage return, line feed combination rprintfCRLF(); // note that using rprintfCRLF() is more memory-efficient than // using rprintf("\r\n"), especially if you do it repeatedly mystring[0] = 'A'; mystring[1] = ' '; mystring[2] = 'S'; mystring[3] = 't'; mystring[4] = 'r'; mystring[5] = 'i'; mystring[6] = 'n'; mystring[7] = 'g'; mystring[8] = '!'; mystring[9] = 0; // null termination // print a null-terminated string from RAM rprintfStr(mystring); rprintfCRLF(); // print a section of a string from RAM // - start at index 2 // - print 6 characters rprintfStrLen(mystring, 2, 6); rprintfCRLF(); val = 24060; mydata = 'L'; // print a decimal number rprintf("This is a decimal number: %d\r\n", val); // print a hex number rprintf("This is a hex number: %x\r\n", mydata); // print a character rprintf("This is a character: %c\r\n", mydata); // print hex numbers small = 0x12; // a char medium = 0x1234; // a short big = 0x12345678; // a long rprintf("This is a 2-digit hex number (char) : "); rprintfu08(small); rprintfCRLF(); rprintf("This is a 4-digit hex number (short): "); rprintfu16(medium); rprintfCRLF(); rprintf("This is a 8-digit hex number (long) : "); rprintfu32(big); rprintfCRLF(); // print a formatted decimal number // - use base 10 // - use 8 characters // - the number is signed [TRUE] // - pad with '.' periods rprintf("This is a formatted decimal number: "); rprintfNum(10, 8, TRUE, '.', val); rprintfCRLF(); b = 1.23456; // print a floating point number // use 10-digit precision // NOTE: TO USE rprintfFloat() YOU MUST ENABLE SUPPORT IN global.h // use the following in your global.h: #define RPRINTF_FLOAT rprintf("This is a floating point number: "); rprintfFloat(8, b); rprintfCRLF(); } }
/***************************************************************************** * Balance - *****************************************************************************/ void balance(void) { unsigned long TimerMsWork; long int g_bias = 0; double x_offset = 532; //offset value 2.56V * 1024 / 4.93V = 4254 double q_m = 0.0; double int_angle = 0.0; double x = 0.0; double tilt = 0.0; int pwm; InitADC(); init_pwm(); // initialize the UART (serial port) uartInit(); // set the baud rate of the UART for our debug/reporting output uartSetBaudRate(115200); // initialize rprintf system rprintfInit(uartSendByte); // initialize vt100 library vt100Init(); // clear the terminal screen vt100ClearScreen(); TimerMsWork = TimerMsCur(); DDRB |= (1 << PB0); // Make B0 an output for LED /* as a 1st step, a reference measurement of the angular rate sensor is * done. This value is used as offset compensation */ for (int i=1 ; i<=200; i++) // determine initial value for bias of gyro { g_bias = g_bias + GetADC(gyro_sensor); } g_bias = g_bias / 200; while (!(getkey() == 1)) { /* insure loop runs at specified Hz */ while (!TimerCheck(TimerMsWork, (dt_PARAM * 1000) -1)) ; TimerMsWork = TimerMsCur(); // toggle pin B0 for oscilloscope timings. PORTB = PINB ^ (1 << PB0); // get rate gyro reading and convert to deg/sec // q_m = (GetADC(gyro_sensor) - g_bias) / -3.072; // -3.07bits/deg/sec (neg. because forward is CCW) q_m = (GetADC(gyro_sensor) - g_bias) * -0.3255; // each bit = 0.3255 /deg/sec (neg. because forward is CCW) state_update(q_m); // get Accelerometer reading and convert to units of gravity. // x = (GetADC(accel_sensor) - x_offset) / 204.9; // (205 bits/G) x = (GetADC(accel_sensor) - x_offset) * 0.00488; // each bit = 0.00488/G // x is measured in multiples of earth gravitation g // therefore x = sin (tilt) or tilt = arcsin(x) // for small angles in rad (not deg): arcsin(x)=x // Calculation of deg from rad: 1 deg = 180/pi = 57.29577951 tilt = 57.29577951 * (x); kalman_update(tilt); int_angle += angle * dt_PARAM; rprintf(" x:"); rprintfFloat(8, x); rprintf(" angle:"); rprintfFloat(8, angle); rprintf(" rate:"); rprintfFloat(8, rate); // Balance. The most important line in the entire program. // balance_torque = Kp * (current_angle - neutral) + Kd * current_rate; // rprintf("bal_torq: "); // rprintfFloat(8, balance_torque); // rprintfCRLF(); //steer_knob = 0; // change from current angle to something proportional to speed // should this be the abs val of the cur speed or just curr speed? //double steer_cmd = (1.0 / (1.0 + Ksteer2 * fabs(current_angle))) * (Ksteer * steer_knob); //double steer_cmd = 0.0; // Get current rate of turn //double current_turn = left_speed - right_speed; //<-- is this correct //double turn_accel = current_turn - prev_turn; //prev_turn = current_turn; // Closed-loop turn rate PID //double steer_cmd = KpTurn * (current_turn - steer_desired) // + KdTurn * turn_accel; // //+ KiTurn * turn_integrated; // Possibly optional //turn_integrated += current_turn - steer_cmd; // Differential steering //left_motor_torque = balance_torque + steer_cmd; //+ cur_speed + steer_cmd; //right_motor_torque = balance_torque - steer_cmd; //+ cur_speed - steer_cmd; // Limit extents of torque demand //left_motor_torque = flim(left_motor_torque, -MAX_TORQUE, MAX_TORQUE); // if (left_motor_torque < -MAX_TORQUE) left_motor_torque = -MAX_TORQUE; // if (left_motor_torque > MAX_TORQUE) left_motor_torque = MAX_TORQUE; //right_motor_torque = flim(right_motor_torque, -MAX_TORQUE, MAX_TORQUE); // if (right_motor_torque < -MAX_TORQUE) right_motor_torque = -MAX_TORQUE; // if (right_motor_torque > MAX_TORQUE) right_motor_torque = MAX_TORQUE; pwm = (int) ((angle -3.5) * Kp) + (rate * Kd); // + (int_angle * Ki); rprintf(" pwm:%d\r\n", pwm); // Set PWM values for both motors SetLeftMotorPWM(pwm); SetRightMotorPWM(pwm); } SetLeftMotorPWM(0); SetRightMotorPWM(0); }
int main(void) { avr_init(); u08 even; // u16 i; //u08 temp; command = 45; // actualTemp = 85; // u16 temp; for(;;) { // Tasks here. // Command line reception of commands... // pass characters received on the uart (serial port) // into the cmdline processor // while(uartReceiveByte(&c)){ // vt100SetCursorPos(1, 0); // uartSendByte(c); // cmdlineInputFunc(c); // // } // bounce the character, keep to the top 3 rows... // run the cmdline execution functions vt100SetCursorPos(3, 0); cmdlineMainLoop(); // Command line reception ends here if (APP_STATUS_REG & BV(DO_SAMPLE)) { readMAX6675(&tempData); // get data to tempData variable CLEAR_SAMPLE_FLAG; //debug, invert pin PIND ^= BV(PD5); //update PID // output = pid_Controller(command, tempData, &PID_data); //invert PID // output = PHASE_ANGLE_LIMIT_HIGH - output; } if(APP_STATUS_REG & BV(DO_PID)) { #ifdef REG_PID //update PID output = pid_Controller(command, tempData, &PID_data); #ifndef CMDLINE #ifndef RX_DBG rprintf("PID raw: "); rprintfNum(10, 6, TRUE, ' ', output); rprintfCRLF(); #endif //invert & limit PID if(output > 29700) output = 700; //output = PHASE_ANGLE_LIMIT_HIGH - output; #ifndef RX_DBG rprintf("PID scaled: "); rprintfNum(10, 6, TRUE, ' ', output); rprintfCRLF(); #endif #endif #endif #ifdef REG_PD #endif // actualTemp +=10; // OCR0A = output; CLEAR_PID_FLAG; // } /* if((temp = 0xFFFF-output) > 30000) { temp = 30000;} else if (temp < 1000) { temp = 1000;} */ // Limit to within 1 half-phase: if((output > PHASE_ANGLE_LIMIT_HIGH) || (output < 0)){ #ifndef CMDLINE #ifndef RX_DBG rprintf("Max out");rprintfCRLF(); #endif #endif output = PHASE_ANGLE_LIMIT_HIGH; // don't fire the triac at all! SET_HOLD_FIRE; // set flag to not fire triac } else { CLEAR_HOLD_FIRE; // set flag to fire triac } if ((output < PHASE_ANGLE_LIMIT_LOW)){ // || (output < 0)) #ifndef CMDLINE #ifndef RX_DBG rprintf("Min out");rprintfCRLF(); #endif #endif output = PHASE_ANGLE_LIMIT_LOW; // fire the triac at zerocrozz to get complete halfwave } #ifndef WALK_PHASEANGLE OCR1A = output; #endif //OCR1A = PHASE_ANGLE_LIMIT_LOW; //OCR1A = PHASE_ANGLE_LIMIT_HIGH; } #ifdef DEBUG_SER // uartPrintfNum(10, 6, TRUE, ' ', 1234); --> " +1234" // uartPrintfNum(16, 6, FALSE, '.', 0x5AA5); --> "..5AA5" // rprintfNum(10, 4, FALSE, ' ', tempData);// rprintfCRLF(); #ifndef CMDLINE #ifndef RX_DBG if(sensorDisconnected) { rprintfProgStrM("Disconnected Probe!\r\n"); } else { rprintf("Process Value: "); rprintfNum(10, 4, FALSE, ' ', tempData); rprintfCRLF(); rprintf("Target Value: "); rprintfNum(10, 4, FALSE, ' ', command); rprintfCRLF(); // rprintf("PID Phaselimit: "); // rprintfNum(10, 6, TRUE, ' ', output); rprintfCRLF(); rprintf("OCR1A: "); rprintfNum(10, 6, FALSE, ' ', OCR1A); rprintfCRLF(); //----------- // rprintf("dummy: "); // rprintfNum(10, 6, TRUE, ' ', _DUMMY); rprintfCRLF(); rprintf("E "); rprintfNum(10, 4, TRUE, ' ', _ERROR); rprintfCRLF(); rprintf("P "); rprintfNum(10, 8, TRUE, ' ', _PTERM); rprintfCRLF(); rprintf("I "); rprintfNum(10, 8, TRUE, ' ', _ITERM); rprintfCRLF(); rprintf("D "); rprintfNum(10, 8, TRUE, ' ', _DTERM); rprintfCRLF(); //----------- } vt100SetCursorPos(3, 0); if(even++ == 10){ vt100ClearScreen(); vt100SetCursorPos(3,0); even = 0; } #endif //#ifndef RX_DBG #endif //#ifndef CMDLINE #endif //#ifdef DEBUG_SER } return(0); }