How to use UART with PE(AsynchroSerial)?

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

How to use UART with PE(AsynchroSerial)?

ソリューションへジャンプ
1,557件の閲覧回数
aaronlee
Contributor V

Hi,

How to use UART with PE(AsynchroSerial) in S12ZVCA?

Have any example?

Best Regards,

Aaron

タグ(4)
1 解決策
1,012件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Aaron,

The correct code creates an instance of AS1_TComData and then the function takes the address of the instance as a argument. The wrong code creates only a pointer. But the pointer doesn't point anywhere.  

Regards,

Daniel

元の投稿で解決策を見る

8 返答(返信)
1,012件の閲覧回数
aaronlee
Contributor V

Hi Daniel,

I try to use Event of AS1_OnRxChar. It can work fine in DEBUG mode. But it can not work in NORMAL mode (remove MULTILINK then power off/on my board).

P.S. Main() code can work fine in both (DEBUG/NORMAL) mode.

void AS1_OnRxChar(void)
{
    AS1_TComData *ReceiveChar;
 /* Write your code here ... */
    AS1_RecvChar(ReceiveChar);
    switch(*ReceiveChar)
   {
       case 'C':
          Pin_DO3 = 1; // LED4 OFF
          Pin_RCK_DoorLock = 0; // Door Lock (Lo Active)
          setReg8(DDRS, 0xF3U);
          break;
       case 'O':
          Pin_DO3 = 0;// LED4 ON
          Pin_RCK_DoorUnlock = 0; // Door Unlock (Lo Active)
          setReg8(DDRS, 0xF5U);
          break;
       default:
          setReg8(DDRS, 0xF1U);
          break;
    }
   return;
}

AS1_OnRxChar.png

0 件の賞賛
1,012件の閲覧回数
aaronlee
Contributor V

My code as attachment

0 件の賞賛
1,012件の閲覧回数
aaronlee
Contributor V

Hi, Daniel,

I resolved the issue. But, I don't know why.

The wrong code as follow:

    AS1_TComData *ReceiveChar;
    AS1_RecvChar(ReceiveChar);
    switch(*ReceiveChar)

The correct code as follow:

    AS1_TComData ReceiveChar;
    AS1_RecvChar(&ReceiveChar);
    switch(ReceiveChar)

Best Regards,

Aaron

0 件の賞賛
1,013件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Aaron,

The correct code creates an instance of AS1_TComData and then the function takes the address of the instance as a argument. The wrong code creates only a pointer. But the pointer doesn't point anywhere.  

Regards,

Daniel

1,012件の閲覧回数
aaronlee
Contributor V

Hi Daniel,

Thank you so much! 

Best Regard,

Aaron

0 件の賞賛
1,012件の閲覧回数
aaronlee
Contributor V

Hi Daniel,

ZVL32-SCI-CW106 can work fine. Then, I modify SCI0 to SCI1 (ZVL32-SCI1-CW106 as attachment). It can work, too.

But, I got many error when I merge the SCI1.c & SCI1.h into my Processor Expert project(B0005_Test as attachment). I don't know how to solve the error.

Have any SCI (UART) example for Processor Expert?

 

Best Regards,

Aaron

0 件の賞賛
1,011件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

types byte and word are undefined.

You should define them in SCI1.h header file:

typedef unsigned char byte;
typedef unsigned int word;

Regards,

Daniel

0 件の賞賛
1,012件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Aaron,

If you use an evaluation board you can connect the UART via OSBDM to an USB host.

Read the detailed description of the attached example (in main.c).

 

Regards,

Daniel

0 件の賞賛