반응형
unsigned char String[6];
unsigned char String_1[6];
unsigned char String_2[6];
unsigned char String_3[6];

void sprint(unsigned char Num, unsigned char ucLen, unsigned int ucValue)		
{
	unsigned char iOffset;
	
	iOffset = ucLen;
	
	while(iOffset--)		
	{
		if((0 == ucValue) && (iOffset != ucLen - 1))		
		{
			if(Num == 0) 		{String[iOffset] = ' ';}
			else if(Num == 1)	{String_1[iOffset] = ' ';}
			else if(Num == 2)	{String_2[iOffset] = ' ';}
			else if(Num == 3)	{String_3[iOffset] = ' ';}
		}
		else
		{
			if(Num == 0) 		{String[iOffset] = (ucValue % 10) + 48;}				
			else if(Num == 1)	{String_1[iOffset] = (ucValue % 10) + 48;}				
			else if(Num == 2)	{String_2[iOffset] = (ucValue % 10) + 48;}				
			else if(Num == 3)	{String_3[iOffset] = (ucValue % 10) + 48;}						
		}
		ucValue /= 10;		
	}	
}
반응형

'개발모듈 > 펌웨어 모듈' 카테고리의 다른 글

- AVR Flash 사용하기  (0) 2017.05.26
- [AVR Studio] EEPROM 읽고 쓰기  (0) 2017.05.26
- [IAR] ATmega8 - 타이머카운터 (CTC모드)  (0) 2017.02.20
- Key Control 2  (0) 2016.12.01
- Key Control  (0) 2016.06.07
Posted by 메가아재
,