Software Serial

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

Software Serial

1,627 Views
gregoryclement
Contributor I

Hello;
Sorry for my English.
I am new in programming microncontroleurs and CodeWarrior. I use a MC9S08SH4CTG.
They ask me to have a serial communication on PTA1 (RX) and PTA2 (TX).


I did not know at all how. In looking around, this technique is called software uart. Continuing my research, I found AN2502, AN2637, ASM8 to do that.


Unfortunately for me, I do not know what to do next. I downloaded all the libraries for trying. I do not know the assembly code, so I've instead turned to AN2637.

 

By reading the .pdf document, I still do not understand how to implement the library.


Is it that there would be someone who could help me.


I put the .c and .h files provided with AN2637. But I have errors and I do not know why. (See PJ)


Is there would be someone who could help me by giving me the tracks of solution or example?


Thank you

Labels (1)
0 Kudos
7 Replies

1,426 Views
gregoryclement
Contributor I

Up please, I still have not found a solution

0 Kudos

1,426 Views
gregoryclement
Contributor I

No answer. Is my question is poorly known ?

0 Kudos

1,426 Views
vicentegomez
NXP TechSupport
NXP TechSupport

Hi please check the attached sample code, this is a software SCI using a timer interrupt. This is an old sample code with codewarrior 6.3

I hope this will help you

Regards

Vicente Gomez

0 Kudos

1,426 Views
gregoryclement
Contributor I

Hello and thank you for your reply.

You tell me that this is an old example code. Or did you find ? Her research I have to do to get a sample? When I looked on the internet and forums, I find notes applications without too understands how to use them.

To return to your example. I am unable to use it. I import different .c and .h files unless start08.c because it gave me an error:

ERROR L1818: Symbol 17 - _startupData duplicated in start08_c.obj and Start08_c.obj

ERROR L1818: Symbol 20 - _Startup duplicated in start08_c.obj and Start08_c.obj

I modified:  #define Tx_MODULO_VALUE             0x67

To have a baud rate of 9600 with 8 Mhz

In debug mode, this condition is always false, so I can never sent a character.

if(RxOk) // if there's a ready byte just received

    {

      SSCI_Tx_Byte('U'); // Start sending TX byte (sending via MTIM interrupt) 

      RxOk = 0;  // acknoledges the Received Byte

    }

Is what I had to change anything that I would not notice?

Thank you

0 Kudos

1,426 Views
vicentegomez
NXP TechSupport
NXP TechSupport

Hi

This sample is part of the samples code that we as technical support have.

The code is working on codewarrior 6.3

Why did you import the files? are you are migrate the code to Code warrior 10.x?

I remember that I used this code some time ago, but now my computer has windows 64 bit so I do not have codewarrior 6.3

0 Kudos

1,426 Views
gregoryclement
Contributor I

Hello;

I probably misunderstood the operation of CodeWarrior.

When I want to program a MCU, I make New MCU Project. I add the microcontroller. Subsequently a main.c file, and derivative.h mc9s08sh4.h are created automatiquements. I then remove the main.c automatically created to add the one you gave me

That's right I should do?

So I added the .c and .h that you gave me

screen.png

I am with :

CodeWarrior for MCU

Version: 10.6

Build Id:140329

0 Kudos

1,426 Views
gregoryclement
Contributor I

Can someone help me ? Or can I find information allowing me to train me on serial communication, what to look for, what to change? How a person learning to work with microcontrollers NXP can find examples?

Thank you for your help

0 Kudos