avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] Software UART receiver first byte as NULL / empty


From: Douglas Dotson
Subject: RE: [avr-gcc-list] Software UART receiver first byte as NULL / empty
Date: Fri, 12 Mar 2004 12:24:19 -0800 (PST)

I missed the first part of this thread so sorry if
this is redundant. I remember when using an
Intel 8251 USART one had to do a couple of reads
during initialization to clear out any bogus
characters. This was due to the double buffering
scheme in the chip itself. The reads cleared out
any junk there from power up.

Doug

--- harshit suri <address@hidden> wrote:
> Thanks for ure reply. I am posting the basic stamp
> code as u asked. I have also tried doing 
> serout 6,16468,["HowdyAtmega01234"] .It yield the
> same
> problem. Any help will be aprreciated
> 
> 
> '{$STAMP BS2}
> 
> 'this code implements the commn protocol
> 'it tries to communicate with the atmega128
> 
> rx con 5 'receive from atmega
> tx con 6  'transmit to atmega
> input 5
> output 6
> looper:
> 'make my tx high to indicate to atmega128 that i am
> ready to send
> high 6
> 
> 
> 'wait for atmega128 to acknowledge
> wait_for_ack:
> if IN5 = 1 then sendbyte 'that means atmega shall
> give
> the stamp a chance to communicate.This DOES NOT mean
> that he has set up his uart
> goto wait_for_ack
> 
> sendbyte:
> low 6 'lower the tx line telling mega that ill send
> data whenever atmega is ready
> 
> wait_till_atmega_has_setup_UART:
> if IN5=0 then senddata 'wait for atmega128 to lower
> its txline that means that atmega has set up his
> uart
> and is ready to receive
> goto wait_till_atmega_has_setup_UART
> 
> senddata:
> serout 6,16468,["H"] 'send data at 9600baud 8N1
> inverted LSB first
> serout 6,16468,["o"] 'send data at 9600baud 8N1
> inverted LSB first
> serout 6,16468,["w"] 'send data at 9600baud 8N1
> inverted LSB first
> serout 6,16468,["d"] 'send data at 9600baud 8N1
> inverted LSB first
> serout 6,16468,["y"] 'send data at 9600baud 8N1
> inverted LSB first
> serout 6,16468,["A"] 'send data at 9600baud 8N1
> inverted LSB first
> serout 6,16468,["t"] 'send data at 9600baud 8N1
> inverted LSB first
> serout 6,16468,["m"] 'send data at 9600baud 8N1
> inverted LSB first
> serout 6,16468,["e"] 'send data at 9600baud 8N1
> inverted LSB first
> serout 6,16468,["g"] 'send data at 9600baud 8N1
> inverted LSB first
> serout 6,16468,["a"] 'send data at 9600baud 8N1
> inverted LSB first
> serout 6,16468,["0"] 'send data at 9600baud 8N1
> inverted LSB first
> serout 6,16468,["1"] 'send data at 9600baud 8N1
> inverted LSB first
> serout 6,16468,["2"] 'send data at 9600baud 8N1
> inverted LSB first
> serout 6,16468,["3"] 'send data at 9600baud 8N1
> inverted LSB first
> serout 6,16468,["4"] 'send data at 9600baud 8N1
> inverted LSB first
> 'right now atmega is printing out what it recvd to
> the
> debug terminal
> goto looper 'do whole step again...this makes sure
> experiment is repeatable and error free
> 
> 
> 
> --- "D. Daniel McGlothin" <address@hidden>
> wrote:
> > I'm curious about the exact Basic Stamp commands
> > that you are using to
> > send the data to the AVR.  Could you post the
> > relevant portion of the
> > Stamp's program?
> > 
> > Daniel
> > 
> > > -----Original Message-----
> > > From: address@hidden
> > > [mailto:address@hidden Behalf
> Of
> > harshit suri
> > > Sent: Friday, March 12, 2004 12:55 PM
> > > To: address@hidden
> > > Subject: RE: [avr-gcc-list] Software UART
> receiver
> > first
> > > byte as NULL /
> > > empty
> > >
> > >
> > > i was thinking the same ..that the handshaking
> > might
> > > be triggering a start bit ISR. *But* the
> waveform
> > at
> > > the RX pin of the atmega128 is absolutely clear
> no
> > > spurious noise bits.The devices dont need level
> > > converters both are 0-5V . And as i said if i
> > remove
> > > the handshaking and all i do is listen in the
> mega
> > and
> > > tx from stamp continousule. then all is fine.
> > Thanks
> > > for ure reply.
> > > Regards
> > >
> > > --- Rune Christensen
> > <address@hidden>
> > > wrote:
> > > > Hello
> > > >
> > > > If the handshaking uses the rx and tx signals
> > maybe
> > > > it will trigger a false
> > > > start bit.
> > > > Normally handshaking uses other dedicated pins
> > for
> > > > that purpose.
> > > >
> > > > If you don't have enough pins then maybe
> > consider
> > > > software handshaking
> > > > instead of hardware handshaking.
> > > >
> > > > Have you voltage level conversion between the
> > two
> > > > devices?
> > > >
> > > > Cheers
> > > > Rune Christensen
> > > >
> > > > -----Original Message-----
> > > > From: address@hidden
> > > > [mailto:address@hidden
> Behalf
> > Of
> > > > harshit suri
> > > > Sent: Friday, March 12, 2004 10:21 AM
> > > > To: address@hidden
> > > > Subject: [avr-gcc-list] Software UART receiver
> > first
> > > > byte as NULL /
> > > > empty
> > > >
> > > >
> > > > I am using the Software Uart Code from
> > > >
> http://hubbard.engr.scu.edu/embedded/avr/avrlib/
> > . I
> > > > am using a basic stamp to send data to the
> > > > atmega128.
> > > > I uses a handshaking protocol to communicate.
> > The
> > > > stamp sends 16 bytes
> > > > "HowdyAtmega01234"
> > > > and the software uart(its interrupt based)
> > listens
> > > > for
> > > > 16 bytes at once.
> > > >
> > > > The problem is that the atmega reads a NULL
> byte
> > > > first
> > > > before reading the 'H' in Howdy . So when i
> > print it
> > > > out it prints:
> > > >
> > > > Byte[0] =
> > > > Byte[1] =H
> > > > Byte[2] = o
> > > > Byte[3] = w
> > > > Byte[4] = d
> > > > Byte[5] = y
> > > > Byte[6] = A
> > > > Byte[7] = t
> > > > Byte[8] = m
> > > > Byte[9] = e
> > > > Byte[10] = g
> > > > Byte[11] = a
> > > > Byte[12] = 0
> > > > Byte[13] = 1
> > > > Byte[14] = 2
> > > > Byte[15] = 3
> 
=== message truncated ===


_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]