/*
*------------------------------------------------------------------------------
* void DDR_loadDigit(UINT8 digit, UINT8 data)
*
* Summary	: Write one byte data on the bus
*
* Input		: UINT8 digit - digit number to write the data
*			  UINT8 dataByte - data byte for the digit
*
* Output	: None
*------------------------------------------------------------------------------
*/
void DDR_loadDigit(UINT8 digit, UINT8 data)
{
    /*
    	if( digit >=64 )
    	{
    		digit+=128;
    	}
    */
    DISABLE_TMR1_INTERRUPT();
    DISPLAY_CONTROL = DISPLAY_DISABLE;	//disable the display
    DIGIT_PORT = digit;					//set the address
    DATA_PORT = (~LED_MAP[data]) | 0X80;  // write data
    DISPLAY_CONTROL = DISPLAY_ENABLE;	//enable the display
    Delay10us(50);						//delay for the data to stabilize
    DISPLAY_CONTROL = DISPLAY_DISABLE;	//disable it again
    ENABLE_TMR1_INTERRUPT();
}
Example #2
0
void MMD_task(void)
{
	UINT8 i , j , k;
	UINT8 curSymbol,curRowData;



	for( i = 0; i < MMD_MAX_SEGMENTS ; i++)
	{
		if( mmdSegment[i].scrollSpeed != SCROLL_SPEED_NONE)
		{
			--mmdSegment[i].speedCount;
			if( mmdSegment[i].speedCount > 0)	
				continue;
		}
		mmdSegment[i].speedCount = mmdSegment[i].scrollSpeed;

		DISABLE_TMR1_INTERRUPT();
		if( mmdSegment[i].switchBuffer == 0 )
		{
			mmdSegment[i].curShiftBuffer = ( mmdSegment[i].curDispBuffer == 0 )? 1 : 0;
				
		}
		if(mmdSegment[i].switchBuffer == 1 )
		{
			ENABLE_TMR1_INTERRUPT();
		 	continue;
		}
	
		ENABLE_TMR1_INTERRUPT();
	

		if( mmdSegment[i].scrollSpeed == SCROLL_SPEED_NONE)
		{/*
			for( j = 0; j < ROWS_PER_SYMBOL; j++)
			{
				for( k = 0; k < mmdSegment[i].length; k++)
				{
					mmdSegment[i].DispBuffer[mmdSegment[i].curShiftBuffer][j][k] = mmdSegment[i].DispDataBuffer[j][k];
				}
			}
		*/
		}
		else
		{
			
			for( j = 0; j < ROWS_PER_SYMBOL; j++)
			{
				for( k = 1; k < mmdSegment[i].length; k++)
				{
					mmdSegment[i].DispDataBuffer[j][k-1] <<= 1;
					
					if( getBit(mmdSegment[i].DispDataBuffer[j][k],7) == 1 )
						setBit(&mmdSegment[i].DispDataBuffer[j][k-1] , 8-COLUMNS_PER_CHARACTER);
					else
						clearBit(&mmdSegment[i].DispDataBuffer[j][k-1],8-COLUMNS_PER_CHARACTER);
					mmdSegment[i].DispBuffer[mmdSegment[i].curShiftBuffer][j][k-1] = mmdSegment[i].DispDataBuffer[j][k-1];
				}
					
				mmdSegment[i].DispDataBuffer[j][k-1] <<= 1;
				curSymbol = mmdSegment[i].symbolBuffer[mmdSegment[i].curSymbolIndex]-32;
	
				curRowData	 = FontTable5x7[curSymbol][j];
				if( getBit(curRowData,7-mmdSegment[i].shiftCount) == 1 )
				{
					setBit(&(mmdSegment[i].DispDataBuffer[j][k-1]) , 8-COLUMNS_PER_CHARACTER);
				}
				else
				{
					clearBit(&(mmdSegment[i].DispDataBuffer[j][k-1]),8-COLUMNS_PER_CHARACTER);
				}

				mmdSegment[i].DispBuffer[mmdSegment[i].curShiftBuffer][j][k-1] = mmdSegment[i].DispDataBuffer[j][k-1];
			}
			++mmdSegment[i].shiftCount;

			if( mmdSegment[i].shiftCount >= COLUMNS_PER_CHARACTER)
			{
				mmdSegment[i].curSymbolIndex++;
				if( mmdSegment[i].curSymbolIndex >= mmdSegment[i].symbolCount)
				{
					mmdSegment[i].curSymbolIndex = 0;
				}
				
				mmdSegment[i].shiftCount = 0;
				
			}
			
		}

		DISABLE_TMR1_INTERRUPT();
		mmdSegment[i].switchBuffer = 1;
		ENABLE_TMR1_INTERRUPT();
	}



}