Example #1
0
void receiveCommands()
{
    if (usbComRxAvailable() && usbComTxAvailable() >= 64)
    {
        uint8 XDATA response[64];
        uint8 responseLength;
        uint8 byte, rand;
        byte = usbComRxReceiveByte();

        // By default, echo back the byte that was send.
        response[0] = byte;
        responseLength = 1;

        // By default, stop blinking the yellow LED because it will
        // affect the sequence of random numbers reported to the COM port.
        blinkYellow = 0;
        switch(byte)
        {
        case 'Y': blinkYellow = 1; break;
        case 's': randomSeedFromSerialNumber(); break;
        case 'a': randomSeedFromAdc(); break;
        case '0': randomSeed(0,0); break;
        case '1': randomSeed(0xFF, 0xFF); break;
        case '8': randomSeed(0x80, 0x03); break;
        case 'r':
            rand = randomNumber();

            // Wait for the NEXT random number to finish so we can read RNDH and RNDL.
            while(ADCCON1 & 0x0C);

            response[responseLength++] = ',';
            response[responseLength++] = nibbleToAscii(rand >> 4);
            response[responseLength++] = nibbleToAscii(rand);
            response[responseLength++] = ',';
            response[responseLength++] = (rand & 0x80) ? '1' : '0';
            response[responseLength++] = (rand & 0x40) ? '1' : '0';
            response[responseLength++] = (rand & 0x20) ? '1' : '0';
            response[responseLength++] = (rand & 0x10) ? '1' : '0';
            response[responseLength++] = (rand & 0x08) ? '1' : '0';
            response[responseLength++] = (rand & 0x04) ? '1' : '0';
            response[responseLength++] = (rand & 0x02) ? '1' : '0';
            response[responseLength++] = (rand & 0x01) ? '1' : '0';
            response[responseLength++] = ',';
            response[responseLength++] = nibbleToAscii(RNDH >> 4);
            response[responseLength++] = nibbleToAscii(RNDH);
            response[responseLength++] = nibbleToAscii(RNDL >> 4);
            response[responseLength++] = nibbleToAscii(RNDL);
            response[responseLength++] = '\r';
            response[responseLength++] = '\n';
            break;
        default: response[0] = '?'; break;
        }
        usbComTxSend(response, responseLength);
    }
Example #2
0
void handleOneWire(void)
{
    int i;
    int newtemp = 0;
    int air_temp_c = 0;
    unsigned int decimals;

    if (getMs() > ds1820_time + 1000) {
        air_temp_c = read_DS1820();
        newtemp++;
        start_DS1820();
        ds1820_time = getMs();
    }

    if ((newtemp || respondstr) && usbComTxAvailable() >= 64)
    {
        const char *cp;
        uint8 XDATA response[64];
        uint8 responseLength = 0;

        decimals = (air_temp_c & 0xf) * 100;
        responseLength = sprintf(response, "%d.%02d", air_temp_c / 16, decimals / 16);
        response[responseLength++] = ',';
        for (i = 0; i < 8; i++) {
            response[responseLength++] = nibbleToAscii(DS1820_addr[i] >> 4);
            response[responseLength++] = nibbleToAscii(DS1820_addr[i]);
        }
        response[responseLength++] = ',';
        i = sizeof(response) - responseLength - 2;

        if (respondstr) {
            for (cp = respondstr; *respondstr && i--; respondstr++) {
                response[responseLength++] = *cp;
            }
        }
        respondstr = NULL;
        response[responseLength++] = '\r';
        response[responseLength++] = '\n';
        usbComTxSend(response, responseLength);
    }
}
Example #3
0
void sendReportIfNeeded()
{
    static uint32 lastReport;
    uint8 i, bytesToSend;
    uint16 result[6];
    uint16 vddMillivolts;

    // Create reports.
    if (getMs() - lastReport >= param_report_period_ms && reportLength == 0)
    {
        lastReport = getMs();
        reportBytesSent = 0;

        vddMillivolts = adcReadVddMillivolts();
        adcSetMillivoltCalibration(vddMillivolts);

        for(i = 0; i < 6; i++)
        {
            result[i] = adcRead(i);
        }

        if (param_bar_graph)
        {
            printf("\x1B[0;0H");  // VT100 command for "go to 0,0"
            printBar("P0_0", result[0]);
            printBar("P0_1", result[1]);
            printBar("P0_2", result[2]);
            printBar("P0_3", result[3]);
            printBar("P0_4", result[4]);
            printBar("P0_5", result[5]);
            printf("VDD  %4d mV", vddMillivolts);
        }
        else
        {
            printf("A, %4d, %4d, %4d, %4d, %4d, %4d,\r\n",
                    adcConvertToMillivolts(result[0]),
                    adcConvertToMillivolts(result[1]),
                    adcConvertToMillivolts(result[2]),
                    adcConvertToMillivolts(result[3]),
                    adcConvertToMillivolts(result[4]),
                    adcConvertToMillivolts(result[5])
                    );
        }
    }

    // Send the report to USB in chunks.
    if (reportLength > 0)
    {
        bytesToSend = usbComTxAvailable();
        if (bytesToSend > reportLength - reportBytesSent)
        {
            // Send the last part of the report.
            usbComTxSend(report+reportBytesSent, reportLength - reportBytesSent);
            reportLength = 0;
        }
        else
        {
            usbComTxSend(report+reportBytesSent, bytesToSend);
            reportBytesSent += bytesToSend;
        }
    }

}
Example #4
0
void debugOutput() {
	responseLength = sprintf(response, "PERCFG=0x%02x\r\n", PERCFG);
	usbComTxSend(response, responseLength);

	responseLength = sprintf(response, "TIMIF=0x%02x\r\n", TIMIF);
	usbComTxSend(response, responseLength);

	responseLength = sprintf(response, "P0SEL=0x%02x\r\n", P0SEL);
	usbComTxSend(response, responseLength);

	responseLength = sprintf(response, "P1SEL=0x%02x\r\n", P1SEL);
	usbComTxSend(response, responseLength);
	
	responseLength = sprintf(response, "T1CNTH/L=0x%02x%02x\r\n", T1CNTH, T1CNTL);
	usbComTxSend(response, responseLength);

	responseLength = sprintf(response, "T1CTL=0x%02x\r\n", T1CTL);
	usbComTxSend(response, responseLength);

	responseLength = sprintf(response, "T1CCTL0=0x%02x\r\n", T1CCTL0);
	usbComTxSend(response, responseLength);

	responseLength = sprintf(response, "T1CC0H/L=0x%02x%02x\r\n", T1CC0H, T1CC0L);
	usbComTxSend(response, responseLength);

	responseLength = sprintf(response, "T1CCTL1=0x%02x\r\n", T1CCTL1);
	usbComTxSend(response, responseLength);

	responseLength = sprintf(response, "T1CC1H/L=0x%02x%02x\r\n", T1CC1H, T1CC1L);
	usbComTxSend(response, responseLength);

	responseLength = sprintf(response, "T1CCTL2=0x%02x\r\n", T1CCTL2);
	usbComTxSend(response, responseLength);

	responseLength = sprintf(response, "T1CC2H/L=0x%02x%02x\r\n", T1CC2H, T1CC2L);
	usbComTxSend(response, responseLength);
	
	responseLength = sprintf(response, "T3CNT=0x%02x\r\n", T3CNT);
	usbComTxSend(response, responseLength);

	responseLength = sprintf(response, "T3CTL=0x%02x\r\n", T3CTL);
	usbComTxSend(response, responseLength);

	responseLength = sprintf(response, "T3CCTL0=0x%02x\r\n", T3CCTL0);
	usbComTxSend(response, responseLength);

	responseLength = sprintf(response, "T3CC0=0x%02x\r\n", T3CC0);
	usbComTxSend(response, responseLength);

	responseLength = sprintf(response, "T3CCTL1=0x%02x\r\n", T3CCTL1);
	usbComTxSend(response, responseLength);

	responseLength = sprintf(response, "T3CC1=0x%02x\r\n", T3CC1);
	usbComTxSend(response, responseLength);
}
Example #5
0
void processByte(uint8 byteReceived)
{
    switch(byteReceived)
    {
    case '1':
	
		responseLength = sprintf(response, "NOTE=Initial settings\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1PreScaler(PRESCALER_128);
		responseLength = sprintf(response, "NOTE=setT1PreScaler(PRESCALER_128)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1PreScaler(PRESCALER_32);
		responseLength = sprintf(response, "NOTE=setT1PreScaler(PRESCALER_32)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1PreScaler(PRESCALER_8);
		responseLength = sprintf(response, "NOTE=setT1PreScaler(PRESCALER_8)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1PreScaler(PRESCALER_1);
		responseLength = sprintf(response, "NOTE=setT1PreScaler(PRESCALER_1)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1IoLocation(IO_LOC_ALT_2);
		responseLength = sprintf(response, "NOTE=setT1IoLocation(IO_LOC_ALT_2)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelFunction(CHANNEL0, PERIPHERAL);
		responseLength = sprintf(response, "NOTE=setT1ChannelFunction(CHANNEL0, PERIPHERAL)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT1ChannelFunction(CHANNEL0, GPIO);
		responseLength = sprintf(response, "NOTE=setT1ChannelFunction(CHANNEL0, GPIO)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelFunction(CHANNEL1, PERIPHERAL);
		responseLength = sprintf(response, "NOTE=setT1ChannelFunction(CHANNEL1, PERIPHERAL)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT1ChannelFunction(CHANNEL1, GPIO);
		responseLength = sprintf(response, "NOTE=setT1ChannelFunction(CHANNEL1, GPIO)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelFunction(CHANNEL2, PERIPHERAL);
		responseLength = sprintf(response, "NOTE=setT1ChannelFunction(CHANNEL2, PERIPHERAL)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT1ChannelFunction(CHANNEL2, GPIO);
		responseLength = sprintf(response, "NOTE=setT1ChannelFunction(CHANNEL2, GPIO)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT1IoLocation(IO_LOC_ALT_1);
		responseLength = sprintf(response, "NOTE=setT1IoLocation(IO_LOC_ALT_1)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelFunction(CHANNEL0, PERIPHERAL);
		responseLength = sprintf(response, "NOTE=setT1ChannelFunction(CHANNEL0, PERIPHERAL)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT1ChannelFunction(CHANNEL0, GPIO);
		responseLength = sprintf(response, "NOTE=setT1ChannelFunction(CHANNEL0, GPIO)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelFunction(CHANNEL1, PERIPHERAL);
		responseLength = sprintf(response, "NOTE=setT1ChannelFunction(CHANNEL1, PERIPHERAL)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT1ChannelFunction(CHANNEL1, GPIO);
		responseLength = sprintf(response, "NOTE=setT1ChannelFunction(CHANNEL1, GPIO)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelFunction(CHANNEL2, PERIPHERAL);
		responseLength = sprintf(response, "NOTE=setT1ChannelFunction(CHANNEL2, PERIPHERAL)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT1ChannelFunction(CHANNEL2, GPIO);
		responseLength = sprintf(response, "NOTE=setT1ChannelFunction(CHANNEL2, GPIO)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		t1Mode(MODE_FREE);
		responseLength = sprintf(response, "NOTE=t1Mode(MODE_FREE)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t1Start();
		responseLength = sprintf(response, "NOTE=t1Start()\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t1Stop();
		responseLength = sprintf(response, "NOTE=t1Stop()\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		t1Mode(MODE_MODULO);
		responseLength = sprintf(response, "NOTE=t1Mode(MODE_MODULO)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t1Start();
		responseLength = sprintf(response, "NOTE=t1Start()\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t1Stop();
		responseLength = sprintf(response, "NOTE=t1Stop()\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		t1Mode(MODE_UPDOWN);
		responseLength = sprintf(response, "NOTE=t1Mode(MODE_UPDOWN)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t1Start();
		responseLength = sprintf(response, "NOTE=t1Start()\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t1Stop();
		responseLength = sprintf(response, "NOTE=t1Stop()\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT1ChannelMode(CHANNEL0, COMPARE_MODE);
		responseLength = sprintf(response, "NOTE=setT1ChannelMode(CHANNEL0, COMPARE_MODE)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT1ChannelMode(CHANNEL0, CAPTURE_MODE);
		responseLength = sprintf(response, "NOTE=setT1ChannelMode(CHANNEL0, CAPTURE_MODE)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelMode(CHANNEL1, COMPARE_MODE);
		responseLength = sprintf(response, "NOTE=setT1ChannelMode(CHANNEL1, COMPARE_MODE)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT1ChannelMode(CHANNEL1, CAPTURE_MODE);
		responseLength = sprintf(response, "NOTE=setT1ChannelMode(CHANNEL1, CAPTURE_MODE)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT1ChannelMode(CHANNEL2, COMPARE_MODE);
		responseLength = sprintf(response, "NOTE=setT1ChannelMode(CHANNEL2, COMPARE_MODE)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT1ChannelMode(CHANNEL2, CAPTURE_MODE);
		responseLength = sprintf(response, "NOTE=setT1ChannelMode(CHANNEL2, CAPTURE_MODE)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelCompareMode(CHANNEL0, CLR_ON_COMP_UP);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL0, CLR_ON_COMP_UP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelCompareMode(CHANNEL0, SET_ON_COMP_UP);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL0, SET_ON_COMP_UP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelCompareMode(CHANNEL0, TOGGLE_ON_COMP);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL0, TOGGLE_ON_COMP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelCompareMode(CHANNEL0, CLR_ON_COMP);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL0, CLR_ON_COMP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelCompareMode(CHANNEL0, SET_ON_COMP);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL0, SET_ON_COMP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelCompareMode(CHANNEL1, DSM_MODE_ENABLE);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL1, DSM_MODE_ENABLE)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelCompareMode(CHANNEL1, CLR_SET);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL1, CLR_SET)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelCompareMode(CHANNEL1, SET_CLR);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL1, SET_CLR)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT1ChannelCompareMode(CHANNEL1, CLR_ON_COMP_UP);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL1, CLR_ON_COMP_UP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT1ChannelCompareMode(CHANNEL1, SET_ON_COMP_UP);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL1, SET_ON_COMP_UP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelCompareMode(CHANNEL1, TOGGLE_ON_COMP);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL1, TOGGLE_ON_COMP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelCompareMode(CHANNEL1, CLR_ON_COMP);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL1, CLR_ON_COMP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelCompareMode(CHANNEL1, SET_ON_COMP);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL1, SET_ON_COMP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelCompareMode(CHANNEL2, CLR_SET);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL2, CLR_SET)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelCompareMode(CHANNEL2, SET_CLR);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL2, SET_CLR)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT1ChannelCompareMode(CHANNEL2, CLR_ON_COMP_UP);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL2, CLR_ON_COMP_UP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT1ChannelCompareMode(CHANNEL2, SET_ON_COMP_UP);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL2, SET_ON_COMP_UP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelCompareMode(CHANNEL2, TOGGLE_ON_COMP);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL2, TOGGLE_ON_COMP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelCompareMode(CHANNEL2, CLR_ON_COMP);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL2, CLR_ON_COMP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT1ChannelCompareMode(CHANNEL2, SET_ON_COMP);
		responseLength = sprintf(response, "NOTE=setT1ChannelCompareMode(CHANNEL2, SET_ON_COMP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
        break;
    case '3':
	
		responseLength = sprintf(response, "NOTE=Initial settings\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3PreScaler(PRESCALER_128);
		responseLength = sprintf(response, "NOTE=setT3PreScaler(PRESCALER_128)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3PreScaler(PRESCALER_64);
		responseLength = sprintf(response, "NOTE=setT3PreScaler(PRESCALER_64)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3PreScaler(PRESCALER_32);
		responseLength = sprintf(response, "NOTE=setT3PreScaler(PRESCALER_32)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3PreScaler(PRESCALER_16);
		responseLength = sprintf(response, "NOTE=setT3PreScaler(PRESCALER_16)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3PreScaler(PRESCALER_8);
		responseLength = sprintf(response, "NOTE=setT3PreScaler(PRESCALER_8)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3PreScaler(PRESCALER_4);
		responseLength = sprintf(response, "NOTE=setT3PreScaler(PRESCALER_4)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3PreScaler(PRESCALER_2);
		responseLength = sprintf(response, "NOTE=setT3PreScaler(PRESCALER_2)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3PreScaler(PRESCALER_1);
		responseLength = sprintf(response, "NOTE=setT3PreScaler(PRESCALER_1)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3IoLocation(IO_LOC_ALT_2);
		responseLength = sprintf(response, "NOTE=setT3IoLocation(IO_LOC_ALT_2)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3ChannelFunction(CHANNEL0, PERIPHERAL);
		responseLength = sprintf(response, "NOTE=setT3ChannelFunction(CHANNEL0, PERIPHERAL)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT3ChannelFunction(CHANNEL0, GPIO);
		responseLength = sprintf(response, "NOTE=setT3ChannelFunction(CHANNEL0, GPIO)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3ChannelFunction(CHANNEL1, PERIPHERAL);
		responseLength = sprintf(response, "NOTE=setT3ChannelFunction(CHANNEL1, PERIPHERAL)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT3ChannelFunction(CHANNEL1, GPIO);
		responseLength = sprintf(response, "NOTE=setT3ChannelFunction(CHANNEL1, GPIO)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT3IoLocation(IO_LOC_ALT_1);
		responseLength = sprintf(response, "NOTE=setT3IoLocation(IO_LOC_ALT_1)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3ChannelFunction(CHANNEL0, PERIPHERAL);
		responseLength = sprintf(response, "NOTE=setT3ChannelFunction(CHANNEL0, PERIPHERAL)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT3ChannelFunction(CHANNEL0, GPIO);
		responseLength = sprintf(response, "NOTE=setT3ChannelFunction(CHANNEL0, GPIO)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3ChannelFunction(CHANNEL1, PERIPHERAL);
		responseLength = sprintf(response, "NOTE=setT3ChannelFunction(CHANNEL1, PERIPHERAL)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT3ChannelFunction(CHANNEL1, GPIO);
		responseLength = sprintf(response, "NOTE=setT3ChannelFunction(CHANNEL1, GPIO)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t3Mode(MODE_FREE);
		responseLength = sprintf(response, "NOTE=t3Mode(MODE_FREE)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t3Start();
		responseLength = sprintf(response, "NOTE=t3Start()\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t3Stop();
		responseLength = sprintf(response, "NOTE=t3Stop()\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		t3Mode(MODE_DOWN);
		responseLength = sprintf(response, "NOTE=t3Mode(MODE_DOWN)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t3Start();
		responseLength = sprintf(response, "NOTE=t3Start()\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t3Stop();
		responseLength = sprintf(response, "NOTE=t3Stop()\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t3Mode(MODE_MODULO);
		responseLength = sprintf(response, "NOTE=t3Mode(MODE_MODULO)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t3Start();
		responseLength = sprintf(response, "NOTE=t3Start()\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t3Stop();
		responseLength = sprintf(response, "NOTE=t3Stop()\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t3Mode(MODE_UPDOWN);
		responseLength = sprintf(response, "NOTE=t3Mode(MODE_UPDOWN)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t3Start();
		responseLength = sprintf(response, "NOTE=t3Start()\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		t3Stop();
		responseLength = sprintf(response, "NOTE=t3Stop()\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3ChannelMode(CHANNEL0, ENABLE);
		responseLength = sprintf(response, "NOTE=setT3ChannelMode(CHANNEL0, ENABLE)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT3ChannelMode(CHANNEL0, DISABLE);
		responseLength = sprintf(response, "NOTE=setT3ChannelMode(CHANNEL0, DISABLE)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3ChannelMode(CHANNEL1, ENABLE);
		responseLength = sprintf(response, "NOTE=setT3ChannelMode(CHANNEL1, ENABLE)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT3ChannelMode(CHANNEL1, DISABLE);
		responseLength = sprintf(response, "NOTE=setT3ChannelMode(CHANNEL1, DISABLE)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();


		setT3ChannelCompareMode(CHANNEL0, CLR_SET);
		responseLength = sprintf(response, "NOTE=setT3ChannelCompareMode(CHANNEL0, CLR_SET)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3ChannelCompareMode(CHANNEL0, SET_CLR);
		responseLength = sprintf(response, "NOTE=setT3ChannelCompareMode(CHANNEL0, SET_CLR)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT3ChannelCompareMode(CHANNEL0, CLR_ON_COMP_UP);
		responseLength = sprintf(response, "NOTE=setT3ChannelCompareMode(CHANNEL0, CLR_ON_COMP_UP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT3ChannelCompareMode(CHANNEL0, SET_ON_COMP_UP);
		responseLength = sprintf(response, "NOTE=setT3ChannelCompareMode(CHANNEL0, SET_ON_COMP_UP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3ChannelCompareMode(CHANNEL0, TOGGLE_ON_COMP);
		responseLength = sprintf(response, "NOTE=setT3ChannelCompareMode(CHANNEL0, TOGGLE_ON_COMP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3ChannelCompareMode(CHANNEL0, CLR_ON_COMP);
		responseLength = sprintf(response, "NOTE=setT3ChannelCompareMode(CHANNEL0, CLR_ON_COMP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3ChannelCompareMode(CHANNEL0, SET_ON_COMP);
		responseLength = sprintf(response, "NOTE=setT3ChannelCompareMode(CHANNEL0, SET_ON_COMP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3ChannelCompareMode(CHANNEL1, CLR_SET);
		responseLength = sprintf(response, "NOTE=setT3ChannelCompareMode(CHANNEL1, CLR_SET)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3ChannelCompareMode(CHANNEL1, SET_CLR);
		responseLength = sprintf(response, "NOTE=setT3ChannelCompareMode(CHANNEL1, SET_CLR)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT3ChannelCompareMode(CHANNEL1, CLR_ON_COMP_UP);
		responseLength = sprintf(response, "NOTE=setT3ChannelCompareMode(CHANNEL1, CLR_ON_COMP_UP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		setT3ChannelCompareMode(CHANNEL1, SET_ON_COMP_UP);
		responseLength = sprintf(response, "NOTE=setT3ChannelCompareMode(CHANNEL1, SET_ON_COMP_UP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3ChannelCompareMode(CHANNEL1, TOGGLE_ON_COMP);
		responseLength = sprintf(response, "NOTE=setT3ChannelCompareMode(CHANNEL1, TOGGLE_ON_COMP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3ChannelCompareMode(CHANNEL1, CLR_ON_COMP);
		responseLength = sprintf(response, "NOTE=setT3ChannelCompareMode(CHANNEL1, CLR_ON_COMP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();

		setT3ChannelCompareMode(CHANNEL1, SET_ON_COMP);
		responseLength = sprintf(response, "NOTE=setT3ChannelCompareMode(CHANNEL1, SET_ON_COMP)\r\n");
		usbComTxSend(response, responseLength);
		debugOutput();
		
		break;
	}
}