In the Data sheet in the USART section, 12.2.1 if you download it from the
web. It states that Once you write to the TXREG. The TXREG will transfer
the data to the TSR register. This should occur in one Tcy. What is one Tcy
and where is it referenced to in the book.
David Wong <MITVMA.MIT.EDU> wrote: PICLIST
> What is one Tcy and where is it referenced to in the book.
Tcy is the instruction cycle time; it's equal to 4/Fos, where Fos is
the oscillator frequency (so if you're using a 4 MHz crystal, for
instance, Tcy = 1 microsecond).
The "Tcy" symbol is defined in the timing diagrams at the back of the
data books... Look at Section 18.5.
=== Meet other PICLIST members at the Embedded Systems Conference:
=== 6:30 pm on Wednesday, 1 October, at Bytecraft Limited's booth.
=== For more information on the Embedded Systems Conference,
=== see: http://www.embedsyscon.com/
=== Andrew Warren - ix.netcom.comfastfwd
=== Fast Forward Engineering - Vista, California
Novice here ready to work an A/D conersion to a LCD and I was wondering
what exactly the USART is. It looks like something that could prove to
be useful but what I gather from the tech books still have me in the
dark somewhat. So any information / references that will help me
understand the USART would be greatly appreciated.
Thanks for your time,
At 07:09 03/15/99 -0600, Gary Brooks wrote:
>Novice here ready to work an A/D conersion to a LCD and I was wondering
>what exactly the USART is.
i guess that's "Universal Synchronous/Asynchronous Receiver/Transmitter."
that's a hardware unit which allows to to do serial comms. on the pic this
means an SPI-similar interface (that's the synchronous part), a standard
(eg. rs232) async serial interface, and in some cases some i2c support
(that's also synchronous). these functions are exclusive, that means you
can use only one of them.
you probably won't need any of these functions in your application, unless
you use a serial lcd (in which case you might use the async part of the
usart), or a serial spi eeprom for calibration data (in which case you
might use the spi part).
I am trying to talk to a pc with a 16F877 USART. Nowhere in the docs
does it say whether I need a serial interface chip or not, so I stuck a
meter on the output of pins <26:25>, and I didn't see any negative
voltage, so I am assuming I do need a chip (although I tried it without,
just in case). The circuit works fine with other code loaded in it, and
o-scopes ok too (not that I know what I'm doing with it, but hey :-)
Circuit has a 10Mhz x-tal. I tried connecting it to a laptop and a pc.
Also tried various combinations of CTS/RTS & DTR/DSR with no luck. The
laptop echoes perfectly when TX is tied to RX. Anyway, the circuit was
producing gibberish on the screen (wired as 3-wire, no flow control), so
it seemed like I had it wired properly and had a baud rate problem, so I
tried the code below with different SPBRG and baudrate=0 and 1 with no
luck. I'm just using hyperterminal. Then I noticed that I forgot to
connect pin 15 of the MAX232A to ground (duhhhh!), so I did, and it
won't utter a bit. That ground also makes the OSC all fuzzy on the
scope. It still has +/-10v on pins 2 and 6, tho. I used .1uf caps as
indicated on page 17 of the datasheet. (Those are just dumb. Will use
a Dallas next time!) Help!
list p=16F877, R=DEC
i equ 0x0C
j equ 0x0D
__CONFIG _CP_OFF & _WDT_OFF & _XT_OSC & _PWRTE_ON
CONSTANT LF = d'10' ; Line Feed
CONSTANT CR = d'13' ; Carriage Return
; Initialize ports
clrf PORTA ; Set PORTA output latch to 0 (optional)
clrf PORTB ; Set PORTB output latch to 0
clrf PORTC ; Set PORTC output latch to 0
clrf PORTD ; Set PORTC output latch to 0
clrf PORTE ; Set PORTC output latch to 0
bsf STATUS,RP0 ; Switch to Bank1
movlw B'11000000' ; Set PORTC 7,6 to TRI-state for RX/TX
movwf TRISC ; Set PORTC to all outputs & TRI-S for RX,TX
bcf STATUS,RP0 ; Switch back to Bank0
; Initialize USART Transmitter
movlw B'10000000' ; Select: Port C serial ports (not I/O), RX disabled
bsf STATUS, RP0 ; Switch to Bank1
movlw d'32' ; 19,200bps for 10Mhz x-tal
movwf SPBRG ;
movlw B'00100100' ; Select Asynchronous, 8bit, high baud rate, TX
enabled serial port
movwf TXSTA ;
bcf STATUS, RP0 ; Switch to Bank0
;TEMP ; also tried
;movlw 'X' ; this, instead
;movwf TXREG ; of the table
;goto TEMP ; stuff below
start clrf i
loop movf i,w
movwf TXREG ; Move w to TX register
Well I'm a new user of the list and of PICs as you can see I don't speak
English very well (I'm sorry for that)... I have some troubles tryinf to use
the USART, I wanted to see some examples in microchip web site but there
weren't anyone that helps... I hope some of you could help me with that
maybe sending me some examples of how to use (configure, etc.) the USART I
want it specially use it to TX.
Thanks a lot...
P.S. if there is some information in Spanish it would be better...
More... (looser matching)
- Last day of these posts
- In 2000
, 2001 only
- New search...