00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "pic24_all.h"
00030 #include <stdio.h>
00031 #include "reflow_oven.h"
00032
00037 void debugPower(void) {
00038 uint8 u8_c;
00039 u8_c = 0;
00040 outString("\n");
00041 do {
00042 printf("Power: %d\n",u8_currPowerSetting);
00043 u8_c = inChar();
00044 if (u8_c == '-') decrementPower();
00045 if (u8_c == '+') incrementPower();
00046 } while ((u8_c == '-') || (u8_c == '+'));
00047 }
00048
00049
00050 void debugZeroCross(void) {
00051 uint8 u8_x;
00052 u8_x = ZEROCROSS;
00053 do {
00054 while ((u8_x == ZEROCROSS) && !isCharReady()) doHeartbeat();
00055 u8_x = !u8_x;
00056 DELAY_MS(2);
00057 if (u8_x) outChar('0');
00058 else outChar('1');
00059 } while (!isCharReady());
00060 inChar();
00061 }
00062
00063 void debugThermocouple(void) {
00064 float f_tempC,f_tempF;
00065 do {
00066 f_tempC = getCelsiusFloatTemp();
00067 f_tempF = f_tempC*9/5 + 32;
00068 printf("Temp is: %4.4f (C), %4.4f (F)\n", (double) f_tempC, (double) f_tempF);
00069 DELAY_MS(400);
00070 } while (!isCharReady());
00071 inChar();
00072 }
00073
00074 void doDebugMenu(void) {
00075 uint8 u8_c;
00076 printf("Debug menu:\n");
00077 printf(" 't' - read thermocouple, hit any key to exit\n");
00078 printf(" 'z' - read zerocross, hit any key to exit \n");
00079 printf(" 'p' - control power setting, '+' increments,'-' decrements, other exits.\n");
00080 printf(" 'x' - exit to main menu\n");
00081 printf("Enter character: ");
00082 u8_c = inCharEcho();
00083 if (u8_c == 't') debugThermocouple();
00084 else if (u8_c == 'z') debugZeroCross();
00085 else if (u8_c == 'p') debugPower();
00086 printf("\n");
00087 }
00088
00089