本文整理汇总了C++中UARTCharPut函数的典型用法代码示例。如果您正苦于以下问题:C++ UARTCharPut函数的具体用法?C++ UARTCharPut怎么用?C++ UARTCharPut使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UARTCharPut函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: enviaID
void enviaID() {
UARTCharPut(UART_PC_COMM, 0x12);
UARTCharPut(UART_PC_COMM, 0x34);
UARTCharPut(UART_PC_COMM, 0x56);
}
示例2: print_tc
void print_tc(char d1,char d2){
UARTCharPut(UART0_BASE,d1);
UARTCharPut(UART0_BASE,d2);
UARTCharPut(UART0_BASE,96);
UARTCharPut(UART0_BASE,'C');
UARTCharPut(UART0_BASE,' ');
}
示例3: UARTPutn
//*****************************************************************************
//
//! Print a number to Uart
//!
//!
//! \param UART_Base.
//! \param Num number you want to print.
//!
//! \return None
//
//*****************************************************************************
void UARTPutn(uint32_t UART_Base, long Num)
{
unsigned long temp = 1;
long NumTemp;
NumTemp = Num;
if (Num == 0)
{
UARTCharPut(UART_Base, 48);
}
else
{
if (Num < 0)
{
UARTCharPut(UART_Base, '-');
Num *= -1;
}
while (NumTemp)
{
NumTemp /= 10;
temp *= 10;
}
temp /= 10;
while (temp)
{
UARTCharPut(UART_Base,(Num / temp) % 10 + 48);
temp /= 10;
}
}
}
示例4: xuart0301Execute
//*****************************************************************************
//
//! xuart0301 test execute main body.
//
//! \return None.
//
//*****************************************************************************
static void xuart0301Execute(void)
{
unsigned char UartData = 0;
unsigned char i = 0;
xtBoolean bTmpBoolean = xfalse;
UART_Print("\r\nPlease wait 1 s then type the follow string\r\n");
UART_Print("123456789ABCDE\r\n");
bTmpBoolean = UARTCharsAvail(UART_BASE);
TestAssert((xfalse == bTmpBoolean),
"UART 0301: Function UARTCharsAvail failed!\r\n");
while((UartData = UARTCharGet(UART_BASE)) != '\n')
{
UARTCharPut(UART_BASE, UartData);
if(++i >= 15)
{
break;
}
}
UARTCharPut(UART_BASE, '\r');
UARTCharPut(UART_BASE, '\n');
}
示例5: clearscreen
/*
* Function Name: clearscreen
* Input: none
* Output: none
* Description: Clears the screen
* Example Call: clearscreen();
*/
void clearscreen(void) {
int i;
for (i = 0; i < 50; i++) {
UARTCharPut(UART0_BASE, ' ');
}
UARTCharPut(UART0_BASE, '\r');
}
示例6: UARTPrint_uint32_t
int UARTPrint_uint32_t(uint32_t value)
{
// unexpected crash at variable assignments. could not fix.
int i = 0; // iterator
int written = 0;
uint32_t temp = value;
char buffer[100];
if (value == 0) {
UARTCharPut(UART0_BASE, '0');
return 1;
}
// Convert to string
while (temp != 0) // count the number of digits
{
i++;
temp /= 10;
}
buffer[i] = '\0';
i--;
for (; i >= 0; i--) // convert digits to chars, and store in buffer
{
buffer[i] = value % 10 + '0';
value /= 10;
}
while (buffer[i] != '\0') {
UARTCharPut(UART0_BASE, buffer[i]);
written++;
}
return written;
}
示例7: enviarDelta_t
void enviarDelta_t(int delta_t) {
enviaID();
UARTCharPut (UART_PC_COMM, MESSAGE_TYPE_DELTA_T);
UARTCharPut(UART_PC_COMM, ((delta_t & 0xFF00) >> 8));
UARTCharPut (UART_PC_COMM, delta_t & 0xFF);
}
示例8: fputc
// definition of fputc for debugging over virtual COM port11
int fputc (int ch, FILE *f) {
/* Debug output to serial port. */
if (ch == '\n') {
UARTCharPut (UART0_BASE, '\r'); /* output CR */
}
UARTCharPut (UART0_BASE, ch);
return (ch);
}
示例9: print_temc
void print_temc(void){
print("Current Temperature ");
get_temp();
UARTCharPut(UART0_BASE, ui32TempValueC/10 + 48);
UARTCharPut(UART0_BASE, ui32TempValueC%10 + 48);
UARTCharPut(UART0_BASE, 96);
UARTCharPut(UART0_BASE, 'C');
UARTCharPut(UART0_BASE, ' ');
}
示例10: clrscr
void clrscr(){
uint32_t i;
for(i=0;i<MAX_STRING_LENGTH;i++)
UARTCharPut(UART0_BASE,'\b');
for(i=0;i<MAX_STRING_LENGTH;i++)
UARTCharPut(UART0_BASE,' ');
for(i=0;i<MAX_STRING_LENGTH;i++)
UARTCharPut(UART0_BASE,'\b');
}
示例11: UARTdeleteLastEntry
void UARTdeleteLastEntry(int length) {
int i;
for (i = 0; i < length; i++) {
UARTCharPut(UART0_BASE, '\b');
UARTCharPut(UART0_BASE, ' ');
UARTCharPut(UART0_BASE, '\b');
}
}
示例12: RemoTIUARTWake
//##### INTERNAL BEGIN #####
//*****************************************************************************
//
// Send a wakup packet to the remote network processors UART interface.
//
// This function will send a NULL character to the UART interface repeatedly
// in order to awaken the RNP and cause it to start listening for UART packets.
//
// \return None.
//
//*****************************************************************************
void
RemoTIUARTWake(void)
{
#if 0
bool bIntState;
uint32_t ui32Ticks;
//
// Disable Master interrupts. Record previous interrupt state to properly
// restore it later.
//
bIntState = IntMasterDisable();
//
// Tick counter for tracking how many times we send the NULL character set.
//
ui32Ticks = 0;
//
// If the TX interrupt is enabled. If it is assume UART is already
// awake. If it is not then wake up the UART on the RNP with a null char.
//
if((HWREG(g_ui32UARTBase + UART_O_IM) & 0x20) != UART_IM_TXIM);
{
do
{
//
// Send consecutive NULL characters.
//
UARTCharPut(g_ui32UARTBase, 0);
UARTCharPut(g_ui32UARTBase, 0);
UARTCharPut(g_ui32UARTBase, 0);
UARTCharPut(g_ui32UARTBase, 0);
//
// Delay 10 milliseconds to allow time for RNP to process and wake.
//
SysCtlDelay(SysCtlClockGet() / (100 * 3));
ui32Ticks++;
//
// Send the NULL character set until we get a character back or we have
// tried 10 times to get a response.
//
} while((ui32Ticks < 10) & (UARTCharsAvail(g_ui32UARTBase) == 0));
}
//
// Restore the master interrupt enable to it previous state.
//
if(!bIntState)
{
IntMasterEnable();
}
#endif // 0
}
示例13: enviarDadosSonares
void enviarDadosSonares() {
enviaID();
UARTCharPut(UART_PC_COMM, MESSAGE_TYPE_DADOS_SONAR);
for (int i = 1; i <= 6; i++) {
UARTCharPut(UART_PC_COMM, ((ultimaLeitura[i] & 0xFF00) >> 8));
UARTCharPut(UART_PC_COMM, (ultimaLeitura[i] & 0xFF));
}
}
示例14: sendMotorVelocity
void sendMotorVelocity(int id_motor, int vel, int comp) {
enviaID();
UARTCharPut(UART_PC_COMM, MESSAGE_TYPE_DEBUG_VELOCIDADE_MOTOR);
UARTCharPut(UART_PC_COMM, (char)(id_motor & 0xFF));
UARTCharPut(UART_PC_COMM, (char)(vel & 0xFF));
UARTCharPut(UART_PC_COMM, (char)(comp & 0xFF));
}
示例15: main
int main(void) {
settemp = 25;
uint32_t ui32ADC0Value[4];
SysCtlClockSet(
SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN
| SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE,1,3,ADC_CTL_TS|ADC_CTL_IE|ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE, 1);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
IntMasterEnable();
IntEnable(INT_UART0);
UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
while(1){
ADCIntClear(ADC0_BASE, 1);
ADCProcessorTrigger(ADC0_BASE, 1);
while(!ADCIntStatus(ADC0_BASE, 1, false))
{
}
ADCSequenceDataGet(ADC0_BASE, 1, ui32ADC0Value);
ui32TempAvg = (ui32ADC0Value[0] + ui32ADC0Value[1] + ui32ADC0Value[2] + ui32ADC0Value[3] + 2)/4;
ui32TempValueC = (1475 - ((2475 * ui32TempAvg)) / 4096)/10;
ui32TempValueF = ((ui32TempValueC * 9) + 160) / 5;
char m[] = "Current Temperature is *C, Set Temperature is *C";
m[23]=(ui32TempValueC/10 % 10) + '0';
m[24]=(ui32TempValueC%10) + '0';
m[49]=(settemp/10 % 10) + '0';
m[50]=(settemp%10) + '0';
int i;
for(i=0;m[i];i++){
UARTCharPut(UART0_BASE, m[i]);
}
if(ui32TempValueC < settemp){
GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3,8);
}
else{
GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3,2);
}
UARTCharPut(UART0_BASE, '\r');
UARTCharPut(UART0_BASE, '\n');
SysCtlDelay(1000000);
}
}