LPUART SENDING VALUES

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPUART SENDING VALUES

跳至解决方案
1,200 次查看
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

标签 (1)
标记 (2)
0 项奖励
回复
1 解答
1,076 次查看
sushma
Contributor III

  Using this function , solved my issue

itoa(CURRENT, buffer, 10);

在原帖中查看解决方案

0 项奖励
回复
1 回复
1,077 次查看
sushma
Contributor III

  Using this function , solved my issue

itoa(CURRENT, buffer, 10);

0 项奖励
回复