“线程”中讨论的其他部件:TMDX570LC43HDK, HALCOGEN
大家好,团队
我想通过 SCI 使用 Hercules Eval 板(TMDX570LC43HDK)传输和接收消息。 我能够通过代码传输所需的字符串。 但是,收到的信息存在一些问题。 下图显示了我希望通过代码实现的目标的流程图。 此外,还附加了终端快照。
下面是我的代码片段。 请帮我解决我的问题吗?
/* USER CODE BEGIN (0) */
#include "HL_sci.h"
/* USER CODE END */
/* Include Files */
#include "HL_sys_common.h"
/* USER CODE BEGIN (1) */
static unsigned char command;
/* USER CODE END */
/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/
/* USER CODE BEGIN (2) */
/* USER CODE END */
char text_send[]="Are you there??\n\r";
char resp1_send[]="Yeah!!!\n\r";
char resp2_send[]="Nope!!!\n\r";
//char text_recv[4]="\0";
char *text_recv;
char y[] = "yeah";
char n[] = "nope";
void main(void)
{
/* USER CODE BEGIN (3) */
_enable_IRQ();
sciInit();
while(1)
{
sciSend(sciREG1, strlen(text_send), text_send);
sciReceive(sciREG1, 4, *text_recv);
command = strcmp(*text_recv, y);
if (command == 1)
//printf("Input is %s", y);
sciSend(sciREG1, strlen(resp1_send), resp1_send);
else
//printf("Input is Nope");
sciSend(sciREG1, strlen(resp2_send), resp2_send);
}
/* USER CODE END */
}
/* USER CODE BEGIN (4) */
void sciNotification(sciBASE_t *sci, uint32 flags)
{
sciSend(sci, 1, (unsigned char *)&command);
sciReceive(sci, 1, (unsigned char *)&command);
}
void esmGroup1Notification(int bit)
{
return;
}
void esmGroup2Notification(int bit)
{
return;
}
/* USER CODE END */


我所面临的同一条线上的另一个查询是发送计数器值。 我已经编写了一个代码来传输计数器值。 计数器初始化时的值为0,然后递增至10000。 计数器达到10000后,它将重置为0。 整个过程无限重复。 但是,问题在于终端程序(Putty)上看不到传输。 相同的代码片段如下所示。 请也帮我解决这个问题吗?
/* USER CODE BEGIN (0) */
#include "HL_sci.h"
/* USER CODE END */
/* Include Files */
#include "HL_sys_common.h"
/* USER CODE BEGIN (1) */
/* USER CODE END */
/* USER CODE BEGIN (2) */
/* USER CODE END */
void main(void)
{
/* USER CODE BEGIN (3) */
sciInit();
unsigned long int counter1 = 0;
while(1)
{
while (counter1 <10000)
{
while(sciIsTxReady(sciREG1) != 0)
{
sciSendByte(sciREG1, char(counter1));
}
}
counter1 = 0;
}
/* USER CODE END */
}
/* USER CODE BEGIN (4) */
/* USER CODE END */
谢谢!
H C 特里维迪