EmbeddedRelated.com
Forums

SCI example for transmitting and receiving in Assembly (PC to MCU)

Started by felixrigorii September 20, 2006
Hi,

I am new in this site and I am a beginner in programming 68HC12
microprocessor.

I would like to ask from the expert on this to give me an example on
how to transmit and receive data from PC to mcu and vice versa using
COMM Port(preferably in Assembly coz I am using AxIDE to compile it).

Thanks,

Felix II
----- Original Message -----
From: To: <6...>
On Wednesday, September 20, 2006 10:41 AM
"felixrigorii" wrote: -

> I am new in this site and I am a beginner in programming 68HC12
> microprocessor.
>
> I would like to ask from the expert on this to give me an example on
> how to transmit and receive data from PC to mcu and vice versa using
> COMM Port(preferably in Assembly coz I am using AxIDE to compile it).
>
> Thanks,
>
> Felix II

If you have a real interest in programming a 68HC12, you would be hard
put finding such a good starting point as serial communication, but you
should not start by using ready made code. Start by writing your
own.

It's very easy getting something simple and basic to work, and it will
teach you how to use the registers and the technical documents. Once
you have mastered some basic communication, using HyperTerminal for
example, you can go on to implement buffering, handshaking and
interrupts. The way to learn is to roll up your sleeves and getting
down to work. The satisfaction from getting something to operate
will pay for your hard work -- even if it's just seeing 'Hello World'
on your PC screen!

Mike Elphick
--- In 6..., "Michael Elphick" wrote:

> down to work. The satisfaction from getting something to operate
> will pay for your hard work -- even if it's just seeing 'Hello World'
> on your PC screen!

For a novice without teacher guidance that could be a tad daunting, between having to set up the environment and getting the ports to work that's a lot of research.

I note that all students start with at least some sort of environment in place.

I found good research can be done by simply spending a few hours going through relevant messages on the board here and browsing the files area.
Cheers,

Theo
--- In 6..., "felixrigorii" wrote:
> I would like to ask from the expert on this to give me an example on
> how to transmit and receive data from PC to mcu and vice versa using
> COMM Port(preferably in Assembly coz I am using AxIDE to compile it).

Here is my "howto" example:

- since the bus speed is 24MHz, SCI0BD=0x009c for 9600 baud

- SCI0CR2=0x0c to enable tx and rx

- wait until the TDRE bit is set in the SCI0SR1 register

- write the character to SCI0DRL and it will start sending

- if bit RDRF of SCI0SR1 is high then read SCI0DRL to receive the char

This should at least give you something to ask questions about.
Thanks for the advices.

Felix II

--- In 6..., "Jefferson Smith" wrote:
>
> --- In 6..., "felixrigorii" wrote:
> > I would like to ask from the expert on this to give me an example on
> > how to transmit and receive data from PC to mcu and vice versa using
> > COMM Port(preferably in Assembly coz I am using AxIDE to compile it).
>
> Here is my "howto" example:
>
> - since the bus speed is 24MHz, SCI0BD=0x009c for 9600 baud
>
> - SCI0CR2=0x0c to enable tx and rx
>
> - wait until the TDRE bit is set in the SCI0SR1 register
>
> - write the character to SCI0DRL and it will start sending
>
> - if bit RDRF of SCI0SR1 is high then read SCI0DRL to receive the char
>
> This should at least give you something to ask questions about.
>