Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

CC3200: Can we give input as hex format in Uart for CC3200

$
0
0

Part Number:CC3200

Hi,

I'm using UART1 as an interrupt based code but I want to enter the data as a HEX format can anyone help in that. I'm going to share my entire code as for reference it is working properly just I want to enter data as hex format. If anyone can help then that will be good for me 

#include "hw_types.h"
#include "hw_memmap.h"
#include "hw_ints.h"
#include "rom.h"
#include "rom_map.h"
#include "prcm.h"
#include "uart.h"
#include "interrupt.h"
#include "pin.h"
#include "uart_if.h"

unsigned long UART_STATUS;
unsigned long UARTDataFlag;
unsigned char UARTDataBuffer[1024];
unsigned char UARTData;
unsigned long UARTDataCount;

#define CONSOLE1 UARTA1_BASE
#define CONSOLE_PERIPH1 PRCM_UARTA1
#define UART_BAUD_RATE 115200


//*****************************************************************************
// GLOBAL VARIABLES -- Start
//*****************************************************************************
#if defined(ccs)
extern void (* const g_pfnVectors[])(void);
#endif
#if defined(ewarm)
extern uVectorEntry __vector_table;
#endif

void UART1_Handler()

{
UART_STATUS = 0;

UART_STATUS = UARTIntStatus(CONSOLE1, true);

MAP_UARTIntClear(CONSOLE1, UART_INT_RX);

if((UART_STATUS & UART_INT_RX) && MAP_UARTCharsAvail(CONSOLE1))

{

UARTData = (unsigned char)MAP_UARTCharGetNonBlocking(CONSOLE1);

UARTDataBuffer[UARTDataCount] = UARTData;

UARTDataCount++;

if(UARTDataCount > 400)

{

UARTDataFlag = 1;

}

if(UARTDataCount > 1000)

{

UARTDataCount = 0x00;

}

}
if(UARTData=='\n'||UARTData=='\r'){
Report("%s",UARTDataBuffer);
memset(UARTDataBuffer,0,1024);
UARTDataCount = 0x00;
}
}
//*****************************************************************************
//
//! Board Initialization & Configuration
//!
//! \param None
//!
//! \return None
//
//*****************************************************************************
static void
BoardInit(void)
{
/* In case of TI-RTOS vector table is initialize by OS itself */
#ifndef USE_TIRTOS
//
// Set vector table base
//
#if defined(ccs)
MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);
#endif
#if defined(ewarm)
MAP_IntVTableBaseSet((unsigned long)&__vector_table);
#endif
#endif

//
// Enable Processor
//
MAP_IntMasterEnable();
MAP_IntEnable(FAULT_SYSTICK);

PRCMCC3200MCUInit();
}

void main()
{
MAP_PinTypeUART(PIN_07, PIN_MODE_5);
MAP_PinTypeUART(PIN_08, PIN_MODE_5);
//PinModeSet(PIN_55,PIN_MODE_6);
//PinModeSet(PIN_57,PIN_MODE_6);

BoardInit();

//UART-1 Initialization
MAP_PRCMPeripheralClkEnable(CONSOLE_PERIPH1,PRCM_RUN_MODE_CLK);

MAP_UARTConfigSetExpClk(CONSOLE1,MAP_PRCMPeripheralClockGet(CONSOLE_PERIPH1),
UART_BAUD_RATE,(UART_CONFIG_WLEN_8 |
UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
MAP_UARTFIFODisable(CONSOLE1); //disable fifo

// MAP_UARTIntRegister(CONSOLE1,UART1_Handler); //enable interrupts
// MAP_UARTIntEnable(CONSOLE1,UART_INT_RX);

// MAP_UARTCharPut(CONSOLE1,'c');
while(1)
{
MAP_UARTIntRegister(CONSOLE1,UART1_Handler); //enable interrupts
MAP_UARTIntEnable(CONSOLE1,UART_INT_RX);

}
}

Thanks in advance


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>