Question regarding serial communication

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Question regarding serial communication

qq4ever
Do you guys have any sample program that receives data through serial
port (SCI0 or SCI1). I only need to receive 1 byte and stored in a
memory location. I'm using P&E program.
The serial port is set to 9600 baud rate no parity no interrupt.




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/68HC12/

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply | Threaded
Open this post in threaded view
|

Re: Question regarding serial communication

Mark L. Cukier
I hope this helps!

http://www.pemicro.com/downloads/download_file.cfm?download_id=118

Regards,
   Mark
   P&E

qq4ever wrote:

>Do you guys have any sample program that receives data through serial
>port (SCI0 or SCI1). I only need to receive 1 byte and stored in a
>memory location. I'm using P&E program.
>The serial port is set to 9600 baud rate no parity no interrupt.
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>  
>


--

--

____________________________
*Mark L. Cukier*, /Design Engineer/      
P&E Microcomputer Systems          
656 Beacon Street, Floor 2          
Boston, MA 02215                          
_________________________________
e-mail: [hidden email] <mailto:[hidden email]>
phone : (617) 353-9206 x19
fax   :   (617) 353-9205
_________________________________

visit us on the web at: http: //www.pemicro.com

 




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/68HC12/

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply | Threaded
Open this post in threaded view
|

Re: Question regarding serial communication

imajeffs (Bugzilla)
In reply to this post by qq4ever
Outside of P&E, here is a practical example using GNU C...
-----in header sio.h--------
/* Wait for a character on the serial line and return it.  */
extern inline unsigned char
serial_recv (void)
{
  while (!(SCI0SR1 & RDRF))
    cop_optional_reset ();

  return SCIDRL;
}

-----------Example results (without COP watchdog)-------

    10ca: f6 00 cc     ldab cc <SCI0SR1>
    10cf: c4 20       andb #32
    10d1: 04 54 f6     beq 10ca
    10d4: f6 00 cf     ldab cf <SCI0DRL>

000010d4 <.LM33>:
extern inline unsigned char
serial_recv (void)
{
  while (!(SCISR1 & RDRF))
    cop_optional_reset ();
    10d4: f6 00 cf     ldab cf <__bss_size+0xaf>
    10d7: 87           clra

000010d8 <.LBE5>:
    10d8: 7b 00 00     stab 0 <__data_section_size>

000010db <.LM35>:
        {
                PORTA = serial_recv();
                asm("bgnd");
    10db: 00           bgnd
    10dc: 20 ec       bra 10ca <.LBB5>


--- In [hidden email], "qq4ever" <qq4ever@y...> wrote:
> Do you guys have any sample program that receives data through serial
> port (SCI0 or SCI1). I only need to receive 1 byte and stored in a
> memory location. I'm using P&E program.
> The serial port is set to 9600 baud rate no parity no interrupt.





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/68HC12/

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply | Threaded
Open this post in threaded view
|

Re: Question regarding serial communication

imajeffs (Bugzilla)
In reply to this post by qq4ever
PRE.S.  Ignore that first post of mine, somehow an incomplete copy got
mixed up in the cut/paste...

Outside of P&E, here is a practical example using GNU C.

-----in header sio.h--------
/* Wait for a character on the serial line and return it.  */
extern inline unsigned char
serial_recv (void)
{
  while (!(SCI0SR1 & RDRF))
    cop_optional_reset ();

  return SCIDRL;
}

-----Using the inline func--------
void
main ()
{
   char c;
   c = serial_recv();
}

-----------Example assembly (without COP watchdog)-------
    ;; Wait for RDRF flag
    10ca: f6 00 cc     ldab cc <SCI0SR1>
    10cf: c4 20       andb #32
    10d1: 04 54 f6     beq 10ca
    ;; Load received character in accumulator B
    10d4: f6 00 cf     ldab cf <SCI0DRL>


--- In [hidden email], "qq4ever" <qq4ever@y...> wrote:
> Do you guys have any sample program that receives data through serial
> port (SCI0 or SCI1). I only need to receive 1 byte and stored in a
> memory location. I'm using P&E program.
> The serial port is set to 9600 baud rate no parity no interrupt.





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/68HC12/

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/