How to use UART with PE(AsynchroSerial)?

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

How to use UART with PE(AsynchroSerial)?

Jump to solution
1,495 Views
aaronlee
Contributor V

Hi,

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

Have any example?

Best Regards,

Aaron

1 Solution
950 Views
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

View solution in original post

8 Replies
950 Views
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 Kudos
950 Views
aaronlee
Contributor V

My code as attachment

0 Kudos
950 Views
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 Kudos
951 Views
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

950 Views
aaronlee
Contributor V

Hi Daniel,

Thank you so much! 

Best Regard,

Aaron

0 Kudos
950 Views
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 Kudos
949 Views
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 Kudos
950 Views
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 Kudos