当前位置: 首页>>代码示例>>C++>>正文


C++ UART_OutChar函数代码示例

本文整理汇总了C++中UART_OutChar函数的典型用法代码示例。如果您正苦于以下问题:C++ UART_OutChar函数的具体用法?C++ UART_OutChar怎么用?C++ UART_OutChar使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了UART_OutChar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UART_InUHex

//---------------------UART_InUHex----------------------------------------
// Accepts ASCII input in unsigned hexadecimal (base 16) format
// Input: none
// Output: 32-bit unsigned number
// No '$' or '0x' need be entered, just the 1 to 8 hex digits
// It will convert lower case a-f to uppercase A-F
//     and converts to a 16 bit unsigned number
//     value range is 0 to FFFFFFFF
// If you enter a number above FFFFFFFF, it will return an incorrect value
// Backspace will remove last digit typed
uint32_t UART_InUHex(void){
uint32_t number=0, digit, length=0;
char character;
  character = UART_InChar();
  while(character != CR){
    digit = 0x10; // assume bad
    if((character>='0') && (character<='9')){
      digit = character-'0';
    }
    else if((character>='A') && (character<='F')){
      digit = (character-'A')+0xA;
    }
    else if((character>='a') && (character<='f')){
      digit = (character-'a')+0xA;
    }
// If the character is not 0-9 or A-F, it is ignored and not echoed
    if(digit <= 0xF){
      number = number*0x10+digit;
      length++;
      UART_OutChar(character);
    }
// Backspace outputted and return value changed if a backspace is inputted
    else if((character==BS) && length){
      number /= 0x10;
      length--;
      UART_OutChar(character);
    }
    character = UART_InChar();
  }
  return number;
}
开发者ID:SoajanII,项目名称:ESP8266_TM4C123,代码行数:41,代码来源:UART.c

示例2: fputc

// Print a character to UART.
int fputc(int ch, FILE *f){
  if((ch == 10) || (ch == 13) || (ch == 27)){
    UART_OutChar(13);
    UART_OutChar(10);
    return 1;
  }
  UART_OutChar(ch);
  return 1;
}
开发者ID:ilemus,项目名称:473final2,代码行数:10,代码来源:UART.c

示例3: Xbee_Init

void Xbee_Init(unsigned char ChannelNum){
	unsigned char nextStep = 0;
	SysTick_Init();

//	printf("Initializing...%c",NEWLINE);
	while(nextStep == 0){
		UART_OutChar('x');
		SysTick_Wait10ms(110);//wait 1.1ms
		UART_OutChar('+');
		UART_OutChar('+');
		UART_OutChar('+');
		SysTick_Wait10ms(110);//wait 1.1ms
		nextStep = lookforCR();
	}
//	printf("okay1%c",NEWLINE);
	nextStep = 0;
	while(nextStep == 0){
		UART_OutString(ATCMD1);
		SysTick_Wait10ms(2);
		nextStep = lookforCR();
	}
//	printf("okay2%c",NEWLINE);
	nextStep = 0;
	while(nextStep == 0){
		UART_OutString(ATCMD2);
		SysTick_Wait10ms(2);
		nextStep = lookforCR();
	}
//	printf("okay3%c",NEWLINE);
	nextStep = 0;
	while(nextStep == 0){
		UART_OutString(ATCMD3);
		SysTick_Wait10ms(2);
		nextStep = lookforCR();
	}
//	printf("okay4%c",NEWLINE);
	nextStep = 0;
	while(nextStep == 0){
		UART_OutString(ATCMD4);
		SysTick_Wait10ms(2);
		nextStep = lookforCR();
	}
	//printf("okay5%c",NEWLINE);
	nextStep = 0;
	while(nextStep == 0){
		UART_OutString(ATCMD5);
		SysTick_Wait10ms(2);
		nextStep = lookforCR();
	}
//	printf("okay6%c",NEWLINE);
}
开发者ID:glockwork,项目名称:EE445L,代码行数:51,代码来源:Xbee.c

示例4: SysTick_Handler

SYSTICK HANDLER
	

void SysTick_Handler()
{
	  GPIO_PORTG_DATA_R ^= 0x4;
		sample = ADC_In();
		GPIO_PORTG_DATA_R ^= 0x4;
		sample = Convert(sample);
		thousands = sample%1000;
		hundreds = (sample%100)-(thousands*10);
		tens = (sample%10) - ( (hundreds*10) + (thousands*100) );
		ones = ( sample - (tens*10 + hundreds*100 + thousands*1000 ) );
	
	
		UART_OutChar(0x2);									// STx
		UART_OutChar((thousands)+0x30);		// first number ASCII
	  UART_OutChar(0x2E);									// dot ASCII
		UART_OutChar( (hundreds) + 0x30);		// second number ASCII
	  UART_OutChar( tens +0x30);					// third
		UART_OutChar(ones +0x30);					// last number ASCII
		UART_OutChar(0x0D);								// CR, whatever that is
		UART_OutChar(0x3);			 					// ETx
	
		samplecount++;
	
		GPIO_PORTG_DATA_R ^= 0x4;
		
}
开发者ID:rbridges,项目名称:pastProjects,代码行数:29,代码来源:UART+Receiver.c

示例5: UART_OutUDec

void UART_OutUDec(long long n,int i)
{
	if(n<0)
	{
		n=-n;
		UART_OutChar('-',i);
	}
  if(n>=10)
	{
    UART_OutUDec(n/10,i);
    n%=10;
  }
	UART_OutChar(n+'0',i);
}
开发者ID:Mr-Robots,项目名称:Gesture-controlled-surveillance-vehicle,代码行数:14,代码来源:UART.c

示例6: UART_OutString

//------------UART_OutString------------
// Output String (NULL termination)
// Input: pointer to a NULL-terminated string to be transferred
// Output: none
void UART_OutString(unsigned char buffer[]){
// as part of Lab 11 implement this function
   int i;
	 for(i = 0; buffer[i] != '\0'; ++i) {
			UART_OutChar(buffer[i]);    
		}
}
开发者ID:jatin-28,项目名称:embedded_electronics,代码行数:11,代码来源:UART.c

示例7: TestFile

void TestFile(void){   int i; char data; 
  printf("\n\rEE345M/EE380L, Lab 5 eFile test\n\r");
  // simple test of eFile
  //if(eFile_Init())              diskError("eFile_Init",0); 
  if(eFile_Format())            diskError("eFile_Format",0); 
  eFile_Directory(&printf);
  if(eFile_Create("file1"))     diskError("eFile_Create",0);
  if(eFile_WOpen("file1"))      diskError("eFile_WOpen",0);
  for(i=0;i<1000;i++){
    if(eFile_Write('a'+i%26))   diskError("eFile_Write",i);
    if(i%52==51){
      if(eFile_Write('\n'))     diskError("eFile_Write",i);  
      if(eFile_Write('\r'))     diskError("eFile_Write",i);
    }
  }
  if(eFile_WClose())            diskError("eFile_Close",0);
  eFile_Directory(&printf);
  if(eFile_ROpen("file1"))      diskError("eFile_ROpen",0);
  for(i=0;i<1000;i++){
    if(eFile_ReadNext(&data))   diskError("eFile_ReadNext",i);
    UART_OutChar(data);
  }
  if(eFile_Delete("file1"))     diskError("eFile_Delete",0);
  eFile_Directory(&printf);
  printf("Successful test of creating a file\n\r");
 // OS_Kill();
}
开发者ID:oujoshua,项目名称:445M,代码行数:27,代码来源:Lab5.c

示例8: UART_OutString

//------------UART_OutString------------
// Output String (NULL termination)
// Input: pointer to a NULL-terminated string to be transferred
// Output: none
void UART_OutString(unsigned char buffer[]){
// as part of Lab 11 implement this function
 while(*buffer){
    UART_OutChar(*buffer);
    buffer++;
  }
}
开发者ID:BerZerKku,项目名称:UT.6.01x-Embedded-Systems-Labware,代码行数:11,代码来源:UART.c

示例9: sendATCommand

 void sendATCommand( char * command, int waitTime, char CRout){
	 char frame2[50];
	 char done = 0;
	 char count = 0;
	 int j = 0;
	 int size;
	 int commandLen = strlen2(command);
	 for (j = 0; j < 50; j++)
		frame2[j] = 0;
	 
	 frame2[0] = 0;
	 frame2[1]  = 0;

	 do{
		 UART_OutString(command);
		 if (CRout)
			UART_OutChar(CR);
	Delay(500000*waitTime);
	j = 0;
  size = RxFifo_Size();
	while (size>0){
		frame2[j++] = UART_InChar();
		size = RxFifo_Size();
//		Delay(500000);
	}
	j = 0;
	while (frame2[j] != 'O') j++;
	if (frame2[j] == 'O' && frame2[j+1] == 'K' && frame2[j+2] == CR)
		done = 1;
	count++;
	} while (!done && count < 10);
 }
开发者ID:glockwork,项目名称:EE445L,代码行数:32,代码来源:XbeeOutlab10changed.c

示例10: UART_OutUHex

//--------------------------UART_OutUHex----------------------------
// Output a 32-bit number in unsigned hexadecimal format
// Input: 32-bit number to be transferred
// Output: none
// Variable format 1 to 8 digits with no space before or after
void UART_OutUHex(uint32_t number){
// This function uses recursion to convert the number of
//   unspecified length as an ASCII string
  if(number >= 0x10){
    UART_OutUHex(number/0x10);
    UART_OutUHex(number%0x10);
  }
  else{
    if(number < 0xA){
      UART_OutChar(number+'0');
     }
    else{
      UART_OutChar((number-0x0A)+'A');
    }
  }
}
开发者ID:SoajanII,项目名称:ESP8266_TM4C123,代码行数:21,代码来源:UART.c

示例11: copyHardwareToSoftware

// copy from hardware RX FIFO to software RX FIFO
// stop when hardware RX FIFO is empty or software RX FIFO is full
void static copyHardwareToSoftware(void){
  char letter;
  while(((UART0_FR_R&UART_FR_RXFE) == 0) && (RxFifo_Size() < (FIFOSIZE - 1))){
    letter = UART0_DR_R;
    RxFifo_Put(letter);
		UART_OutChar(letter); 
  }
}
开发者ID:c0lin91,项目名称:EE445M,代码行数:10,代码来源:UART2.c

示例12: uart_write

int uart_write(int dev_fd, const char *buf, unsigned count){ unsigned int num=count;
  while(num){
    UART_OutChar(*buf);
    buf++;
    num--;
  }
  return count;
}
开发者ID:SoajanII,项目名称:ESP8266_TM4C123,代码行数:8,代码来源:UART.c

示例13: UART_OutString

//------------UART_OutString------------
// Output String (NULL termination)
// Input: pointer to a NULL-terminated string to be transferred
// Output: none
void UART_OutString(unsigned char buffer[]){
// written by Billy.Ljm
	int i = 0;
	while(buffer[i]){
		UART_OutChar(buffer[i]);
		i++;
	}
}
开发者ID:GenaNiv,项目名称:UT.6.01x-Embedded-Systems---Shape-the-World,代码行数:12,代码来源:UART.c

示例14: Sound_Transmit

// Internal use only
void Sound_Transmit(uint8_t sound, uint8_t loop) {
	UART_OutChar(0x02);
	UART_OutChar(sound);
	UART_OutChar(loop);
	UART_OutChar(0x00);
	UART_OutChar(0x00);
	UART_OutChar(0x00);
	UART_OutChar(0x00);
	UART_OutChar(0x03);
}
开发者ID:M-bot,项目名称:EE319KLab10,代码行数:11,代码来源:SoundController.c

示例15: UART_OutUDec

//-----------------------UART_OutUDec-----------------------
// Output a 32-bit number in unsigned decimal format
// Input: 32-bit number to be transferred
// Output: none
// Variable format 1-10 digits with no space before or after
void UART_OutUDec(uint32_t n){
// This function uses recursion to convert decimal number
//   of unspecified length as an ASCII string
  if(n >= 10){
    UART_OutUDec(n/10);
    n = n%10;
  }
  UART_OutChar(n+'0'); /* n is between 0 and 9 */
}
开发者ID:SoajanII,项目名称:ESP8266_TM4C123,代码行数:14,代码来源:UART.c


注:本文中的UART_OutChar函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。