Serial Communication between Labwindows and Kinetis

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Serial Communication between Labwindows and Kinetis

1,133件の閲覧回数
kharsha
Contributor II

Using kinetis Design Studio ,Processor Expert , how to do serial communication from LabWindows ?

I am creating a GUI in LabWindows which will be sending & receiving characters via the serial port with Kinetis K10 processor. Unfortunately unable to do so. could anyone please suggest a way to solve the issue ?

Thanks in advance.

Kinetis Processor Expert Code :

in main.c

/* this is used when receiving data , currently commented out*********/

//volatile bool DataReceivedFlg = FALSE;
//unsigned char InpData[10];

/******** to send a character**********/

unsigned char OutData[] = "1";

LDD_TError Error;
LDD_TDeviceData *MySerialPtr;

int main(void)

{

PE_low_level_init();
MySerialPtr = AS1_Init(NULL);
for(;;) {

Error = AS1_SendBlock(MySerialPtr, OutData, sizeof(OutData));
WAIT1_Waitms(100);

}

LabWindows Code: 

bytes_read = ComRd(comport,buf,2);

CopyString (tbox_read_data, 0, buf, 0, bytes_read);
SetCtrlVal (panelHandle, PANEL_TBOX_READ, tbox_read_data);

every time "buf" is empty .

0 件の賞賛
返信
4 返答(返信)

932件の閲覧回数
kharsha
Contributor II

Hi Alice ,

Sorry for the trouble, but could you please tell me if the code snippet for sending the character I have used is correct . I wanted to know if there is any other way to do so. 

Thanks in advance.

Harsha.

0 件の賞賛
返信

932件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello ,

Yes, there is no error in your sending code.

I rememberd you said it can work well :

pastedImage_1.png

About the usage of  Serail_LDD, there are demo code you can refer to:

pastedImage_2.png

Hope it helps


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

932件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello K HARSHA,

Sorry I don't know the Labwindows well.

While I recommend you firstly use a serial terminal (Putty or others )

to check whether the send data can work well.

Hope it helps


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

932件の閲覧回数
kharsha
Contributor II

Hello Alice,

I have checked the output in teraterm (Serial Terminal) as well as the CRO .Its coming fine.

Thanks 

Regards

Harsha

0 件の賞賛
返信