LPUART SENDING VALUES

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPUART SENDING VALUES

Jump to solution
1,098 Views
sushma
Contributor III

Hello 

I want to send int values using LPUART , I'm using the example code lpuart_echo_s32k144 and modified the main accordingly:



#include "Cpu.h"
#include "pin_mux.h"
#include "dmaController1.h"
#include "clockMan1.h"
#include "lpuart1.h"

volatile int exit_code = 0;
/* User includes (#include below this line is not maintained by Processor Expert) */
#include <string.h>
#include <stdint.h>
#include <stdbool.h>


int main(void)
{
int CURRENT = 123;
int buffer[5] = {CURRENT};
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,
g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);


PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);


LPUART_DRV_Init(INST_LPUART1, &lpuart1_State, &lpuart1_InitConfig0);

while (1)
{
LPUART_DRV_SendData(INST_LPUART1, (int *)buffer, strlen((int *)buffer));
}

All I recieve on PuTTyis the ASCII equivalent of 123 i.e '{' . What changes must be done in the function call of LPUART_DRV_SendData; so that I get the value I have sent ( i.e as 123 on PuTTy)

Kindly help 

Thank you 

Sushma Mantagani

pastedImage_8.png

Labels (1)
Tags (2)
0 Kudos
1 Solution
974 Views
sushma
Contributor III

  Using this function , solved my issue

itoa(CURRENT, buffer, 10);

View solution in original post

0 Kudos
1 Reply
975 Views
sushma
Contributor III

  Using this function , solved my issue

itoa(CURRENT, buffer, 10);

0 Kudos