Truncated match.
PICList
Thread
'transmission code'
1999\02\27@102527
by
Carlos Fiestas
Hi all..
I'am programming MIcrochip PIC16C73 and have problems with data transmission
using USART registers?.
First, I enable Tx,Rx pines with SPEN at RCSTA,
then set TXSTA for async mode
finally BRG register. When I send a character it looks like there is no transmis
sion.
Some suggestions please?
Thanks!!
1999\02\27@120033
by
Brian Aase
|
> Hi all..
>
> I'am programming MIcrochip PIC16C73 and have problems with data
> transmission using USART registers?. First, I enable Tx,Rx pines with SPEN
> at RCSTA, then set TXSTA for async mode finally BRG register. When I send
> a character it looks like there is no transmission.
>
> Some suggestions please?
>
> Thanks!!
Here's some cut-and-paste from a little project I finished recently.
Maybe it will help...
<cut>
;+++ Initialize ports
clrf PORTB ; Set all outputs low for now
clrf PORTC
BANK1 ; Define i/o port direction
movlw B'11010000' ; SDI and RX/TX are inputs (really!)
movwf TRISC ; for port C.
movlw B'00000000' ; All pins are outputs
movwf TRISB ; for port B.
movwf ADCON1 ; Enable AN0-AN4 with Vref=Vdd
movlw 0xff ; All pins are inputs
movwf TRISA ; for port A.
BANK0
<cut>
;+++ Start SCI
BANK1
movlw D'25' ; 9600 baud
movwf SPBRG
movlw B'00100110' ; Asnyc, 8 bit, TX on, hi speed
movwf TXSTA
BANK0
movlw B'10010000' ; Enable UART and receiver
movwf RCSTA
<cut>
SCI_CHAR_OUT: ; Send an ascii character out theSCI
; Enter with char to be sent in
W
SCI_DL: btfss PIR1,TXIF ; Is TXREG ready?
goto SCI_DL ; No, wait
movwf TXREG ; Yes, send the character
return ; Done.
1999\02\27@121740
by
Vincent Deno
|
I know posting code is a no-no, but...
My boss was having trouble using the USART on the 16C74. I spent 15
minutes or so changing the order in which the registers were configured
until it worked. i'm not saying this is the only way (or the right way)
to do it, but it works. Note that the comments are not mine and are quite
ugly.
Regards,
Vincent Deno
;-------------------------------------------------------------------------------
-----------------
Setup_UARTS setb RP0 ;
setb INTCON.6 ; interrupt control
clrb TXSTA.2 ; set BRGH
mov SPBRG,#129 ; set baud to 2400
clrb TXSTA.4 ; clear sync
clrb RP0 ;
setb RCSTA.7 ; set spen
setb RP0 ;
setb PIE1.5 ; set rcie
clrb RP0 ;
clrb RCSTA.6 ; clear rx9
setb RP0 ;
clrb TXSTA.6 ; clear tx9
setb TXEN ; enable transmission
clrb RP0 ;
setb RCSTA.4 ; enable reception cren
setb INTCON.7 ; set gie
ret ; return in bank 0
;-------------------------------------------------------------------------------
-------------------
> Hi all..
>
> I'am programming MIcrochip PIC16C73 and have problems with data transmission
> using USART registers?.
> First, I enable Tx,Rx pines with SPEN at RCSTA,
> then set TXSTA for async mode
> finally BRG register. When I send a character it looks like there is no transm
ission.
>
> Some suggestions please?
>
> Thanks!!
>
--------------
Vincent Deno
Design Engineer
Theta Digital Corp.
http://www.thetadigital.com
spam_OUTdenovjTakeThisOuT
email.uc.edu
_____________
| ____ ____ |
|/| | | | | |\|
| | |/| |\| | |
| | | | | | | |
| |_/ | | \_| |
| | | | | |
|_/ /___\ \_|
1999\02\27@125721
by
Ravi Pailoor
Configure the Tx pin of Port C as output.
Pailoor
Carlos Fiestas wrote:
{Quote hidden}> Hi all..
>
> I'am programming MIcrochip PIC16C73 and have problems with data transmission
> using USART registers?.
> First, I enable Tx,Rx pines with SPEN at RCSTA,
> then set TXSTA for async mode
> finally BRG register. When I send a character it looks like there is no transmission.
>
> Some suggestions please?
>
> Thanks!!
--
------------------------------------------------------------------------
Chip Technologies - Microchip Design Consultant
No. 70, 9th Main Road, Mathikere, Bangalore - 560 054. INDIA
Tel : +91-80-3362807, Fax : +91-80-3369451
Email : .....chiptechKILLspam
@spam@vsnl.com,
Webpage : http://business.vsnl.com/chiptech ( Updated on 16th February )
------------------------------------------------------------------------
1999\02\27@152046
by
Bob Blick
On Sat, 27 Feb 1999, Ravi Pailoor wrote:
> Configure the Tx pin of Port C as output.
NO! The UART will not work if the pin is set as output.
-Bob
1999\02\27@163143
by
Andy Kunz
At 12:09 PM 2/27/99 -0800, you wrote:
>On Sat, 27 Feb 1999, Ravi Pailoor wrote:
>
>> Configure the Tx pin of Port C as output.
>
>NO! The UART will not work if the pin is set as output.
GONG! It does work. All the programs I have use a 0 in the TRIS bit for
the tx pin.
Andy
\-----------------/
\ /---\ /
\ | | / Andy Kunz
\ /---\ / Montana Design
/---------+ +---------\ http://www.montanadesign.com
| / |----|___|----| \ |
\/___| * |___\/ Go fast, turn right,
and keep the wet side down!
1999\02\27@174028
by
Bob Blick
On Sat, 27 Feb 1999, Andy Kunz wrote:
> At 12:09 PM 2/27/99 -0800, you wrote:
> >On Sat, 27 Feb 1999, Ravi Pailoor wrote:
> >
> >> Configure the Tx pin of Port C as output.
> >
> >NO! The UART will not work if the pin is set as output.
>
> GONG! It does work. All the programs I have use a 0 in the TRIS bit for
> the tx pin.
On which chip? Let me quote from the 16C7x data sheet:
-------------------------------------------------
Bit SPEN (RCSTA<7>), and bits TRISC<7:6>, have to
be set in order to configure pins RC6/TX/CK and
RC7/RX/DT for the Serial Communication Interface.
-------------------------------------------------
Notice it says "set" not "clear".
I was bitten by this the first time I tried to transmit on a 16C74A, so I
remember it quite well - I have no idea how you made it work the other
way, but "it works for me the way the book says" :-)
Cheers,
Bob
1999\02\28@060309
by
Ravi Pailoor
Bob Blick wrote:
> On Sat, 27 Feb 1999, Andy Kunz wrote:
> > At 12:09 PM 2/27/99 -0800, you wrote:
> > >On Sat, 27 Feb 1999, Ravi Pailoor wrote:
> > >
> > >> Configure the Tx pin of Port C as output.
> > >
> > >NO! The UART will not work if the pin is set as output.
> >
> > GONG! It does work. All the programs I have use a 0 in the TRIS bit for
> > the tx pin.
>
> On which chip? Let me quote from the 16C7x data sheet:
> -------------------------------------------------
> Bit SPEN (RCSTA<7>), and bits TRISC<7:6>, have to
> be set in order to configure pins RC6/TX/CK and
> RC7/RX/DT for the Serial Communication Interface.
> -------------------------------------------------
> Notice it says "set" not "clear".
Does SET mean set the port bit as output ?
The documentation is / may not clear in defining the state the Tx port
pin that
has to be "set".
Pailoor
1999\02\28@135816
by
Gerhard Fiedler
|
At 16:19 02/28/99 +0530, Ravi Pailoor wrote:
>Bob Blick wrote:
>> On which chip? Let me quote from the 16C7x data sheet:
>> -------------------------------------------------
>> Bit SPEN (RCSTA<7>), and bits TRISC<7:6>, have to
>> be set in order to configure pins RC6/TX/CK and
>> RC7/RX/DT for the Serial Communication Interface.
>> -------------------------------------------------
>> Notice it says "set" not "clear".
>
>Does SET mean set the port bit as output ?
>
>The documentation is / may not clear in defining the state the Tx port
>pin that has to be "set".
no, it is quite clear: it says the bits 6 and 7 of the TRISC register have
to be set, which means the ports would be configured for input (ie. the
output driver would be disabled), if they were just plain ports. if you
have a look at the "portc block diagram (peripheral output override)" of a
data sheet, you see the "peripheral oe" output enable, this is the one that
switches the port to output when you activate the associated peripheral (by
some internal logic connected to the peripheral configuration registers).
when you look at that, you also see an explanation why it still works when
you declare the tx pin as output (as andy kunz observed): you'd just double
on what the internal "peripheral oe" does (that's the or gate for /q from
the tris latch and the peripheral oe). but i guess you =have= to declare
the rx input as input if you want it to work as rx, since the "peripheral
oe" only can =activate= the output driver, it can't =deactivate= them
(that's again the same or gate).
anyway, i declare both of them as inputs (set the associated trisc bits 6
and 7) and let the internal peripheral logic do its work, as they say in
the data sheets.
ge
'transmission code'
1999\03\01@152423
by
John Payson
|
>The documentation is / may not clear in defining the state the Tx port
>pin that has to be "set".
|no, it is quite clear: it says the bits 6 and 7 of the TRISC register have
|to be set, which means the ports would be configured for input (ie. the
|output driver would be disabled), if they were just plain ports. if you
|have a look at the "portc block diagram (peripheral output override)" of a
|data sheet, you see the "peripheral oe" output enable, this is the one that
|switches the port to output when you activate the associated peripheral (by
|some internal logic connected to the peripheral configuration registers).
I think the idea is that you're "supposed" to set the Tx pin to
an "input" to disconnect the output data latch and let the hardware
handle its "really" being an output; the existing designs use the
same output drivers for both UART and "normal pin" modes, so there
isn't really a problem with having it set to output; it's possible
that future PICs might use slew-limitted drivers or something for
the UART and setting the port pins to output could cause contention;
doubtful though.
As for the Rx pin, having the pin set to output would cause whatever
data is being output to appear on the pin, overriding the signal (if
any) that was trying to drive it. There may be certain circumstances
where this could be useful, though [e.g. you could use that pin by
itself to implement a one-wire half-duplex serial bus if you bit-bang
transmissions; you'd see your own data looped back in that case].
More... (looser matching)
- Last day of these posts
- In 1999
, 2000 only
- Today
- New search...