[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Simulavr-devel] Re: simulavr, again, and UART
From: |
ken |
Subject: |
Re: [Simulavr-devel] Re: simulavr, again, and UART |
Date: |
Sun Oct 13 12:09:02 2002 |
User-agent: |
Mutt/1.2.5i |
Ted-
The sad thing is that "I don't know". The UART patch *may* stand alone,
or it may require the 163 patch, but, I don't remember if I tested that
or not, and, I simply don't get enough uninterrupted time these days to
try it and find out (and fix it if it doesn't). All I know is that it
works with what I had sitting here before I got pulled off the project.
-ken
-------
On Sat, Oct 12, 2002 at 11:22:30PM -0700, Theodore A. Roth wrote:
> On Sat, 12 Oct 2002, ken restivo wrote:
>
> :)OK, you shamed me into it. ;-)
> :)
> :)Test program is attached. This works with my simulated UART on my simulated
> :)Mega163, which includes a mix of Ted's version of my UART patch, plus my
> :)original Mega163 patch, plus a bunch of changes I had made that I haven't
> :)had time to sort out properly. "It works for me (tm)".
> :)
> :)-ken
>
> Thanks Ken.
>
> >From your discription, it sounds like it may be less than trivial to use
> your patch then. I'll have to dig the 163 patch out of the archives...
>
> Ted Roth
> /*
> * $Id: simpleuart.c,v 1.1 2002/10/13 03:02:28 ken Exp $
> * very simple test program to assure that uart works
> * this just echoes characters back out the uart interface
> *
> */
>
> #include <avr/io.h>
> #include <stdlib.h>
>
>
> char recchar(void)
> {
> while (! (UCSRA & _BV(RXC)));
> return UDR;
> }
>
> void sendchar(char c)
> {
> while (! (UCSRA & _BV(TXC)));
> UDR = c;
> }
>
> int
> main(int argc, char ** argv)
> {
> volatile int c;
>
> /* setup serial */
> UBRR = 51; /* 9600 at 8 mhz */
> UCSRB |= (_BV(RXEN) | _BV(TXEN));
>
>
> sendchar('F');
> sendchar('\n');
>
> while(1){
> c = recchar();
> /* right back at 'cha */
> sendchar(c);
> };
>
> return(0);
> } /* END MAIN */
>
> /* EOF */
>
>