Exemplo n.º 1
0
void ButtonDown()
{
	//Not needed
	//Wait for sleep timer
	//while(INT_CLR0 & 0b01000000 == 0){}//Wait for posted sleep timer interrupt
	//Clear sleep timer interrupt
	//INT_CLR0 &= ~0b01000000;


	//Read switch input 3 times (debounce)
	if(PRT1DR & 0b00000001 == 0b00000001) //First read
	{
		if(PRT1DR & 0b00000001 == 0b00000001) //Second read
		{
			if(PRT1DR & 0b00000001 == 0b00000001) //Third read - Button has been pressed
			{
				while(PRT1DR & 0b00000001 == 0b00000001){}//Wait for button to be released
				//Decrement pulse width
				FanPWM_WritePulseWidth(FanPWM_bReadPulseWidth() - 1);
				//Update display
				LCD_Init();
				LCD_Position(0,0);
				LCD_PrCString("Pulse Width: ");
				LCD_Position(0,13);
				LCD_PrHexByte(FanPWM_bReadPulseWidth());
			}
		}
	}
}
Exemplo n.º 2
0
void main(void)
{
	M8C_EnableGInt; // Uncomment this line to enable Global Interrupts
	CPU_F |= 0b00000001;
	INT_MSK1 |= 0b00000001;
	//Insert your main routine code here.
	
	//Enable PWM
	PWM_Start();
	PWM_EnableInt();
	
	
	//Enable LCD for debugging
	LCD_Start();
	LCD_Init();
	
	
	while(1)//Control loop
	{
		LCD_Position(0,0);
		LCD_PrHexByte(PWM_bReadPulseWidth());
		LCD_Position(1,0);
		LCD_PrHexByte(ten_ms_counter);
		LCD_Position(0,6);
		LCD_PrHexByte(PWM_bReadCounter()); 
	}//End Control Loop
}
Exemplo n.º 3
0
/*******************************************************************************
* Function Name: main
********************************************************************************
*
* Summary:
*  Main function performs following functions:
*   1. Initialises the DMA to move data from ADC_SAR_1 work registers to the
*      PrISM pulse density registers.
*   2. Initialises the ISR connected to the DMA nrq terminal(DMA done).
*   3. Initialises the LCD.
*   4. Initialises the PrISM with 1Mhz clock.
*   5. Initialises the two SAR ADCs.
*   6. Displays the results of ADC_SAR_1 when DmaDone ISR rises.
*      The results are read from PrISM pulse density register.
*   7. Displays the results of ADC_SAR_2 when internal EOC ISR rises.
*
* Parameters:
*  None.
*
* Return:
*  None.
*
*******************************************************************************/
int main()
{
    char8 resultStr[16u];
    float res;


    /* Initializes the LCD. */
    LCD_Start();
    LCD_Position(1u,0u);
    LCD_PrintString("ADC2=      V");

    ADC_SAR_2_Start();
    ADC_SAR_2_IRQ_StartEx(ADC_SAR_2_ISR_LOC);
    ADC_SAR_2_StartConvert();

    CyGlobalIntEnable;

    for(;;)
    {

        /* Show ADC2 result on LCD*/
        if(dataReady != 0u)
        {
            res = ADC_SAR_2_CountsTo_Volts(result);
            sprintf((char *)resultStr,"%+1.2f",res);
            LCD_Position(1u,5u);
            LCD_PrintString(resultStr);
            dataReady = 0u;
        }
    }
}
Exemplo n.º 4
0
/*******************************************************************************
* Function Name: main
********************************************************************************
*
* Summary:
*  main() performs following functions:
*  1: Initializes the LCD
*  2: Starts ADC
*  3: Starts ADC converstion.
*  4: Gets the converted result and displays it in LCD.
*
* Parameters:
*  None.
*
* Return:
*  None.
*
*******************************************************************************/
int main()
{
    int16 output;

    /* Start the components */

    LCD_Start();
    ADC_DelSig_1_Start();

    /* Start the ADC conversion */
    ADC_DelSig_1_StartConvert();

    /* Display the value of ADC output on LCD */
    LCD_Position(0u, 0u);
    LCD_PrintString("ADC_Output");

    for(;;)
    {
        if(ADC_DelSig_1_IsEndConversion(ADC_DelSig_1_RETURN_STATUS))
        {
            output = ADC_DelSig_1_GetResult16();
            
            /* Saturate ADC result to positive numbers. */
            if(output < 0)
            {
                output = 0;
            }
            LCD_Position(1u, 0u);
            LCD_PrintInt16(output);
        }
    }
}
Exemplo n.º 5
0
void main(void)
{
	// Insert your main routine code here.
	LCD_Start();
	LCD_Init();
	LCD_Position(1,4);
	DBB00_WritePulseWidth(pulseWidth);
	DBB00_Start();
	DBB00_EnableInt();
	LCD_PrHexByte(DBB00_bReadPulseWidth());
	INT_MSK0 |= 0x40;
	M8C_EnableGInt;
	while(1){
		prt1 = PRT1DR;
		prt1 &= 0x01;
		if(prt1 == 0x01){
			dBounce++;
			if(dBounce == 3){
				pulseWidth--;
				DBB00_WritePulseWidth(pulseWidth);
				dBounce = 0;
			}
		}
		else
		{
			dBounce = 0;
		}

		LCD_Position(0,4);
		LCD_PrHexByte(dBounce);
		LCD_Position(1,4);
		LCD_PrHexByte(DBB00_bReadPulseWidth());
	}
}
Exemplo n.º 6
0
void ButtonDown()
{
	//Debounce by reading three times
	if( (PRT1DR & 0b00000001) == 0b00000001) //1
	{
		if( (PRT1DR & 0b00000001) == 0b00000001) //2
		{
			if( (PRT1DR & 0b00000001) == 0b00000001) //3 Button is really down
			{
				//LCD_Position(0,0);
				//LCD_PrCString("Down...      ");
			
				//Wait for release
				while( (PRT1DR & 0b00000001) == 0b00000001){}
				
				//Record the state of P0[0] by shifting it into the sequence
				//Shift the sequence by one bit
				sequence <<= 1;
				//Read in the current state P0[0]
				if( (PRT0DR & 0b00000001) == 0b00000001)
				{
					//Bit entered was 1
					sequence |= 0b00000001;
					LCD_Position(1,0);
					LCD_PrCString("1");
				}
				else
				{
					//Bit entered was 0
					sequence &= ~0b00000001;
					LCD_Position(1,0);
					LCD_PrCString("0");
				}
			}
		}
	}
	
	
	//If sequnce is correct
	if( (sequence & 0b00001111) == 0x0D)
	{
		//Let user known
		LCD_Position(0,0);
		LCD_PrCString("Correct!     ");
		//LCD_Position(1,0);
		//LCD_PrHexByte(sequence & 0b00001111);
	}
	else
	{
		LCD_Position(0,0);
		LCD_PrCString("Incorrect!    ");
		//LCD_Position(1,0);
		//LCD_PrHexByte(sequence & 0b00001111);
	}
	
}
Exemplo n.º 7
0
/************************************************
 * Method to calculate the heartrate based on 
 * the start and end values of a counter that
 * is driven by interrupts which are driven by
 * the heartbeat.
 * @return heartrate The last recorded heartrate
 ************************************************/
float Detect_heartrate(void) {
    LCD_Position(0,0);
    LCD_PrintString("Heartrate: ");
    LCD_PrintString("      ");
    LCD_Position(1,0);
    /* 600000 because the clock speed of the 
     heartrate is set to kHz */
    heartrate = (600000/(endCounts-startCounts));
    LCD_PrintU32Number(heartrate);
    LCD_PrintString("      ");
    return heartrate;
}
Exemplo n.º 8
0
/*******************************************************************************
* Function name: DisplayPrintfLoading
********************************************************************************
*
* print loading from position row = 1, column = 0
*
*******************************************************************************/
void DisplayLoading(uint32_t numLoad)
{
    if(numLoad == 0)
    {
        /*clear row 1*/
        LCD_Position(1,0);
        LCD_PrintString("             ");
    }
    if((numLoad > 0) && numLoad < 16)
    {
        LCD_Position(1,numLoad-1);
        LCD_PutChar(LCD_CUSTOM_4);
    }
}
Exemplo n.º 9
0
/*******************************************************************************
* Function name: DisplayPrintLastTimeSkier
********************************************************************************
*
* Summary:
*   print time last skier from position row = 1, column = 0
*
*******************************************************************************/
void DisplayLastSkierTime(uint32_t sec, uint16_t milisec)
{
    /*printf time in format mm:ss:msmsms*/
    sprintf(buff, "Result %02u:%02u:%03u",sec/60,sec%60, milisec);
    LCD_Position(0,0);
    LCD_PrintString(buff);
}
Exemplo n.º 10
0
void LCD_Spin ( uint8 row , uint8 col , uint8 speed , uint8 count ) {
    while (count-- > 0) {
        LCD_Position(row,col);
        LCD_PutChar('|');
        CyDelay(speed/4);
        LCD_Position(row,col);
        LCD_PutChar('/');
        CyDelay(speed/4);
        LCD_Position(row,col);
        LCD_PutChar('-');
        CyDelay(speed/4);
        LCD_Position(row,col);
        LCD_PutChar('\\');
        CyDelay(speed/4);
    }
}
Exemplo n.º 11
0
void matrix_illuminate ( uint8 row , uint8 col , uint8 color ) {
    uint8 off = 0x00, on = 0x01;
    if (SERIAL) {
        uint8 rows = 0b00000001 << row;
        uint8 reds = 0b00000001;
        uint8 grns = 0b00000001;
        uint8 blus = 0b00000001;
        switch (color) {
            case OFF:     reds   = off;
                          grns   = off;
                          blus   = off; break;
            case RED:     reds <<= col;
                          grns   = off;
                          blus   = off; break;
            case GREEN:   reds   = off;
                          grns <<= col;
                          blus   = off; break;
            case YELLOW:  reds <<= col;
                          grns <<= col;
                          blus   = off; break;
            case BLUE:    reds   = off;
                          grns   = off;
                          blus <<= col; break;
            case MAGENTA: reds <<= col;
                          grns   = off;
                          blus <<= col; break;
            case CYAN:    reds   = off;
                          grns <<= col;
                          blus <<= col; break;
            case WHITE:   reds <<= col;
                          grns <<= col;
                          blus <<= col; break;
            
            default: LCD_UpdateStatus("serial error");
                     LCD_UpdateMessage("color mismatch");
                     LCD_Position(1,14);
                     LCD_PrintInt8(color);
                     while (true);
        }
        
        rows = ~rows;
        reds = ~reds;
        grns = ~grns;
        blus = ~blus;
        
        Colors_Write(off);
        int i;
        for (i=0; i < 8 ;++i) {
            Row_Write(  (rows & (0b10000000 >> i)) ? on : off);
            Red_Write(  (reds & (0b10000000 >> i)) ? on : off);
            Green_Write((grns & (0b10000000 >> i)) ? on : off);
            Blue_Write( (blus & (0b10000000 >> i)) ? on : off);
            
            //generate a rising edge
            Shifter_Write(on);
            Shifter_Write(off);
        }
        Colors_Write(on);
    }
    else {
Exemplo n.º 12
0
/*Requires Delay after call*/
uint8 MagReadByte(uint8 registerAddress, uint8 *readPtr)
{
	/* Pointer to the register address */
    //uint8 *writePtr = &registerAddress;/* changed writeptr to &registerAddress*/
	uint8 i2c_status = I2C_MasterClearStatus();
	//LCD_ClearDisplay();
	LCD_Position(1,7);
	LCD_PrintInt8(i2c_status);
	
	I2C_MasterClearReadBuf();
	I2C_MasterClearWriteBuf();
	
    /* Start the I2C transmission for a read */
    uint8 status = I2C_MasterWriteBuf(SLAVE_ADDRESS, &registerAddress, 1, I2C_MODE_NO_STOP);
    /*wait for the tranmission to finish */
    while (I2C_MasterStatus() && !I2C_MSTAT_WR_CMPLT){}
    /* Needed because of some bug in the psoc I2C tramission */
    CyDelay(1);
	/* read a byte using I2C */
	//return I2C_MasterReadBuf(SLAVE_ADDRESS, readPtr, 1, I2C_MODE_REPEAT_START);
	
	//or TO ENSURE READ IS COMPLETE BEFORE ADDITIONAL CODE EXECUTED
	status |= I2C_MasterReadBuf(SLAVE_ADDRESS,readPtr , 1, I2C_MODE_REPEAT_START);
	while (I2C_MasterStatus() && !I2C_MSTAT_RD_CMPLT){}
    CyDelay(1); //Needed because of some bug in the psoc I2C tramission
	return status;
}
Exemplo n.º 13
0
void LCD_Spin ( int row, int col, int speed, int count ) {
    while (count-- > 0) {
        LCD_Position(row,col);
        LCD_PutChar('|');
        CyDelay(speed/4);
        LCD_Position(row,col);
        LCD_PutChar('/');
        CyDelay(speed/4);
        LCD_Position(row,col);
        LCD_PutChar('-');
        CyDelay(speed/4);
        LCD_Position(row,col);
        LCD_PutChar('\\');
        CyDelay(speed/4);
    }
}
Exemplo n.º 14
0
int main(void)
{    
    CyGlobalIntEnable; /* Enable global interrupts. */
    
    DisplayStart();
    Display("System init...");
    
    RTC_WDT_Init(); 
    InitNetwork();
    
    
    
    Display("Sync time...");

    uint8_t number = 0;
    while((result = NTPsync()) != TIME_SYNC_OK)
    {
        char buf[10];
        sprintf(buf, "Sync time -%d", number++);
        LCD_Position(0,0);
        LCD_PrintString(buf);
        CyDelay(500);
    }
    
    Display("Sync ok        ");
    CyDelay(4*TIMEOUT_USER_READ_INFO);
    
    for(;;)
    {
        DisplayRealTime();
        CyDelay(500);
    }
}
Exemplo n.º 15
0
void main(void)
{
	int result;
	float voltage;
	int status;
	
	M8C_EnableGInt ; // Uncomment this line to enable Global Interrupts
	// Insert your main routine code here.
	
	//Start PGA in high power mode
	PGA_Start(PGA_HIGHPOWER);
	
	//Start ADCINC in high power mode
	ADCINC_Start(ADCINC_HIGHPOWER);
	
	//Start LCD
	LCD_Start();
	
	//Run the ADC continuously
	ADCINC_GetSamples(0);
	
	SleepTimer_Start();
   	SleepTimer_SetInterval(SleepTimer_1_HZ);
   	SleepTimer_EnableInt();
	
	while (1)
	{
		SleepTimer_SyncWait(1, SleepTimer_WAIT_RELOAD);
		
		// Wait for data to be ready
		while (ADCINC_fIsDataAvailable() == 0);
		
		// Get Data and clear flag
		result=ADCINC_iClearFlagGetData();
		voltage = result * SCALE_FACTOR;
		
		LCD_Position(0, 0);
		LCD_PrCString("                ");
		LCD_Position(0, 0);
		LCD_PrHexInt(result);
		
		LCD_Position(1, 0);
		LCD_PrCString("                ");
		LCD_Position(1, 0);
		LCD_PrString(ftoa(voltage, &status));
	}
}
Exemplo n.º 16
0
void main(void)
{
    // M8C_EnableGInt ; // Uncomment this line to enable Global Interrupts
    // Insert your main routine code here.

    //Start LCD
    LCD_Start();
    LCD_Init();

    value = 0; //0b0000 0000 where last four bits are 0, PRT0DR[3],PRT0DR[2], PRT0DR[1]

    while(1)//Control loop
    {
        mask = PRT0DR;

        //Collect PRT0DR[3] value
        if( (mask & 0b00001000) == 0)
        {
            //PRT0DR[3] is low
            value &= ~0b00000100;
        }
        else
        {
            //PRT0DR[3] is high
            value |= 0b00000100;
        }

        //Collect PRT0DR[2] value
        if( (mask & 0b00000100) == 0)
        {
            //PRT0DR[2] is low
            value &= ~0b00000010;
        }
        else
        {
            //PRT0DR[2] is high
            value |= 0b00000010;
        }

        //Collect PRT0DR[1] value
        if( (mask & 0b00000010) == 0)
        {
            //PRT0DR[1] is low
            value &= ~0b00000001;
        }
        else
        {
            //PRT0DR[1] is high
            value |= 0b00000001;
        }

        //Print to LCD
        LCD_Position(0,0);
        LCD_PrHexByte(value);

    }//End control loop


}
Exemplo n.º 17
0
void updateLCD()
{
    //Clear LCD
    LCD_Init();

    //Print month
    if(blinkState == 0 && state == 2)
    {
        //Do not print
    }
    else
    {
        //Print month
        LCD_Position(0,0);
        LCD_PrHexByte(month);
    }
    LCD_Position(0,2);
    LCD_PrCString("/");

    //Print day
    if(blinkState == 0 && state == 3)
    {
        //Do not print
    }
    else
    {
        //Print day
        LCD_Position(0,3);
        LCD_PrHexByte(day);
    }
    LCD_Position(0,5);
    LCD_PrCString("/");

    //Print year
    if(blinkState == 0 && state == 4)
    {
        //Do not print
    }
    else
    {
        //Print year
        LCD_Position(0,6);
        LCD_PrHexByte(year);
    }
}
Exemplo n.º 18
0
void main()
{
    /* Place your initialization/startup code here (e.g. MyInst_Start()) */
    uint16 adc, compare;
    
    LCD_Start();
    ADC_Start();
    PWM_Start();
    
    

    /* CyGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */
    for(;;)
    {
        /* Place your application code here. */
//        LCD_ClearDisplay();
        LCD_Start();
        
        adc = 0;
        ADC_StartConvert();
        ADC_IsEndConversion(ADC_WAIT_FOR_RESULT);
        ADC_StopConvert();
        adc = ADC_GetResult16();
        
        if(adc > 255)
        {
            if(adc == 0xFFFF) /* underflow correction */
            {
                adc = 0x00;
            }
            else
            adc = 0xFF; /* Overflow correction */
        }    
        
        LCD_Position(0,0);
        LCD_PrintHexUint8(adc);
                
        compare = (uint16)(1000 + ((float)((float)((float)adc / (float)255) * (float)1000)));
        LCD_Position(1,0);
        LCD_PrintDecUint16(compare);
        
        PWM_WriteCompare(compare);
        PWM_WritePeriod(compare + 39999);
    }
}
Exemplo n.º 19
0
/*******************************************************************************
* Function name: DisplayPrintfRealTime
********************************************************************************
*
* Summary:
*   print real time from position row = 1, column = 0
*
*******************************************************************************/
void DisplayRealTime(void)
{
    uint32_t time;
    
    time = RTC_GetTime();
    sprintf(buff, "%02lu:%02lu:%02lu      ", RTC_GetHours(time),RTC_GetMinutes(time), RTC_GetSecond(time));
    LCD_Position(1,0);
    LCD_PrintString(buff);
}
Exemplo n.º 20
0
// Show shift register contents and flags
void show(void) {
    uint8       i;
    
    LCD_Position(0, 0);
    for (i = 0; i < 8; i++) {
        LCD_PrintInt8(v[i]);
    }
    LCD_Position(1, 0);
    if (SR1_Read() & 1) {
        LCD_PrintString("FULL ");
    } else {
        LCD_PrintString("     ");
    }
    if (SR1_Read() & 2) {
        LCD_PrintString("EMPTY ");
    } else {
        LCD_PrintString("      ");
    }
}
Exemplo n.º 21
0
void main(void) {
	setup();

	while(1) {
		if(gpioTick) {
			gpioTick = false;
		}
		
		if(timer8MainTick) {
			timer8MainTick = false;
			lcdUpdate++;
			
			if (lcdUpdate >= 499)
			{
				lcdUpdate = 0;		
				LCD_Control(0x01);
				LCD_PrString(lcdBuffer[0]);
				
				usDistance = (((46400-usRawTimerValue)/2) / 58);
				itoa(lcdBuffer[1], usDistance,10);
				
				itoa(lcdBuffer[1], start, 10);
				LCD_Position(0,10);
				LCD_PrString(lcdBuffer[1]);
				
				itoa(lcdBuffer[1], stop, 10);
				LCD_Position(1,10);
				LCD_PrString(lcdBuffer[1]);
				
				itoa(lcdBuffer[1], usDistance, 10);
				LCD_Position(1,0);
				LCD_PrString(lcdBuffer[1]);
				
			}
			
			if(timer8MainCount >= 99) {
				timer8MainCount = 0;
				usTrigSend();
			}
		}
	}
}
Exemplo n.º 22
0
void main(void)
{
	M8C_EnableGInt; 
	LCD_Start();																	// Start LCD
	
	LCD_Position(0,0); 
	LCD_PrCString("PSoC I2C Slave");
	
	EzI2Cs_SetRamBuffer(1, 1, (char *)&Wert);										// Start I²C Buffer, Size of 1 Byte, Allowing to Read/Write 1 Byte
	
	I2C_Init();
	
	while(1)
	{
		LCD_Position(1,0); 
		LCD_PrCString("Wert:");
		LCD_Position(2,0);
		LCD_PrHexInt(Wert);
	}
}
Exemplo n.º 23
0
// normalization function for Aileron (Timer1)
float EvaluateAileron(DWORD value)
{	
	// Check if pulsewidth data is available
	if(FlagsAileron & DATA_AVAILABLE_AILERON)
	{
#if (DEBUG_LCD)
		LCD_Position(0,0);
		LCD_PrHexInt(value);
#endif	
		// stick in center 
		if (Within(value, CENTER_AILERON, MARGIN_AILERON))
		{
#if (DEBUG_LCD)
			LCD_Position(0,5);
			LCD_PrCString("C");
#endif		
			return 0;
		}
		else if (value < CENTER_AILERON) // stick left
		{
#if (DEBUG_LCD)
			LCD_Position(0,5);
			LCD_PrCString("L");
#endif	
			return ((float)value - CENTER_AILERON) / (float)(MAX_AILERON - CENTER_AILERON);
		}
		else if (value > CENTER_AILERON) // stick right
		{			
#if (DEBUG_LCD)
			LCD_Position(0,5);
			LCD_PrCString("R");
#endif			
			return -(CENTER_AILERON - (float)value) / (float)(CENTER_AILERON - MIN_AILERON);
		}
		
		// action finished, clear flag to avoid doing it again
		FlagsAileron &= ~DATA_AVAILABLE_AILERON;
	}
	
	return 0;
}
Exemplo n.º 24
0
// normalization function for Elevator(Timer2)
float EvaluateElevator(DWORD value)
{
	// Check if pulsewidth data is available
	if(FlagsElevator & DATA_AVAILABLE_ELEVATOR)
	{
#if (DEBUG_LCD)
		LCD_Position(1,0);
		LCD_PrHexInt(value);
#endif 	
		// stick in center 
		if (Within(value, CENTER_ELEVATOR, MARGIN_ELEVATOR))
		{
#if (DEBUG_LCD)
			LCD_Position(1,5);
			LCD_PrCString("C");
#endif 	
			return 0;
		}
		else if (value > CENTER_ELEVATOR) // stick up
		{
#if (DEBUG_LCD)
			LCD_Position(1,5);
			LCD_PrCString("U");
#endif			
			return ((float)value - CENTER_ELEVATOR) / (float)(MAX_ELEVATOR - CENTER_ELEVATOR);
		}
		else if (value < CENTER_ELEVATOR) // stick down
		{			
#if (DEBUG_LCD)
			LCD_Position(1,5);
			LCD_PrCString("D");
#endif			
			return -(CENTER_ELEVATOR - (float)value) / (float)(CENTER_ELEVATOR - MIN_ELEVATOR);
		}
		
		// action finished, clear flag to avoid doing it again
		FlagsElevator &= ~DATA_AVAILABLE_ELEVATOR;
	}
	
	return 0;
}
Exemplo n.º 25
0
/*******************************************************************************
* Function name: DisplayPutIndicatorNetwork
********************************************************************************
*
* Summary:
*   print incator connect  from position row = 1, column = 15
*
* Parametrs:
*   state = CONNECT or state = DISCONNECT
*******************************************************************************/
void DisplayIndicatorNetwork(NetworkIndicator indicator)
{
    LCD_Position(1,14);
    if(indicator == CONNECT)
    {
        LCD_PutChar(LCD_CUSTOM_2);
    }
    else
    {
        LCD_PutChar(LCD_CUSTOM_3);
    }
}
Exemplo n.º 26
0
/*******************************************************************************
* Function name: DisplayPutIndicatorSD
********************************************************************************
*
* Summary:
*   print incator SD card from position row = 1, column = 15
*
* Parametrs:
*   state = SD_INSERT or state = SD_NO_INSERT
*******************************************************************************/
void DisplayIndicatorSD(SDindicator indicator)
{
    LCD_Position(1,15);
    if(indicator == SD_INSERT)
    {
        LCD_PutChar(LCD_CUSTOM_0);
    }
    else
    {
        LCD_PutChar(LCD_CUSTOM_1);
    }
}
Exemplo n.º 27
0
void DisplayTestMode(uint8_t state)
{
    LCD_Position(1,15);
    if(state == 1)
    {
        LCD_PutChar('t');
    }
    else
    {
        LCD_PutChar(' ');
    }
}
Exemplo n.º 28
0
void main_test_disp(){
    LCD_Start();					    // initialize lcd
    uint8 current;
    for (;;){
        LCD_ClearDisplay();
        
        LCD_Position(0,0); //move back to top row
        current = Pin0_Read(); //next, read a new value
        LCD_PrintString("P0: ");
        LCD_PrintNumber(current); //print value I am getting
        
        LCD_Position(1,0); //move to bot row
        current = Pin3_Read(); //next, read a new value
        LCD_PrintString("P3: ");
        LCD_PutChar(current); //print ascii value
        LCD_PrintString(" HEX: ");
        LCD_PrintNumber(current); //print value I am getting
        
        waiter(4);
    }
}
Exemplo n.º 29
0
void switchDown()
{
    //Gather current count
    currentCount = Timer_wReadTimerSaveCV();

    //3 seconds clocked at .0001 sec per cycles is 30000 timer ticks
    if(currentCount >= 30000)
    {
        //Reset timer
        Timer_WriteCompareValue(0);
    }
    else
    {
        //Check for previous values
        if(dataAvailable != 0)
        {
            //Data has been collected - collect second value
            time2 = currentCount;
            //Data is no longer available since the second value has been collected
            dataAvailable = 0;
            //Let user know
            LCD_Position(1,0);
            LCD_PrCString("2");
            //Reset the timer for next presses
            Timer_WriteCompareValue(0);
        }
        else
        {
            //Data has not been collected - collect first value
            time1 = currentCount;
            //Let user know
            LCD_Position(1,0);
            LCD_PrCString("1");
        }
    }

    //Write the difference in times to the LCD
    LCD_Position(0,0);
    LCD_PrHexInt(time1 - time2); //Down count so 1-2
}
Exemplo n.º 30
0
void LCD_Refresh(void)
{

#ifdef CONFIG_VIRTUAL_CONSOLE

    int loopx, loopy;

    for (loopy = 0; loopy < HEIGHT; loopy++) {
	LCD_Position(0, loopy);

	for (loopx = 0; loopx < WIDTH; loopx++)
	    LCD_WriteChar(Visible->screen[loopy][loopx]);
    }

    LCD_Position(Visible->xpos, Visible->ypos);

#else

    WriteChar(Visible, '\f');

#endif
}