Searching \ for '[PIC]: Help with USART on 16F627.' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=usart
Search entire site for: 'Help with USART on 16F627.'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Help with USART on 16F627.'
2002\07\11@115846 by A.J. Tufgar

flavicon
face
Hey all,
       I've got some modem routines working on the F627 however they
are not making use of the USART, so I thought I'd be more efficent and
get the modem working with USART.  However after many hours going
through the datasheets and Tom McGahee's USART program I still can't get
it up and running.  I'm trying to avoid using interrupts if possible and
I'm trying just to get TX working for now.  Here's my code hope someone
can help, Thanks.
If I have both TXD and RXD set as outputs the RXD light will flash when
I start my write routine by the TXD won't work. If RXD is an input
nothing.
The following code sets the port up.
       MOVLW   d'25'
       movwf   SPBRG
       BCF     TXSTA, SYNC
       BCF     RCSTA, SPEN
       BSF     TXSTA, CSRC
       BSF     TXSTA,  TXEN
       movlw   0
       movwf   TXREG

My TX routine is:
TX_MODEM
       movf    dat_buf, w
       movwf   TXREG
;wait_for_tx_to_end               ; If I put this loop in it won't exit
       ;BTFSS  TXSTA, TRMT       ; The routine, so I put the delay in
       ;goto wait_for_tx_to_end
       movlw   .5
       CALL    DELAY_N_MS
       RETURN


Thanks for an assistance in advance,
Aaron

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\07\11@121248 by Jennifer L. Gatza

flavicon
face
Are your bank bits set correctly?

For example, you list:

       BCF     TXSTA, SYNC
       BCF     RCSTA, SPEN

But TXSTA is in bank1, and RCSTA is in bank0.

Thus, you would have to do the following:
       BCF     STATUS, RP1
       BSF     STATUS, RP0
       BCF     TXSTA, SYNC

       BCF     STATUS, RP1
       BCF     STATUS, RP0
       BCF     RCSTA, SPEN

For the complete 16F627 memory map (keep this handy while programming!), see
page 14 of the PIC16F62X datasheet.

Jen

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\07\11@121916 by Harold M Hallikainen

picon face
       How about the fact that TXREG is in bank 0 and TXSTA is in bank 1. I see
no bank switches in there. Same thing with spbrg (also in bank 1).

Harold


On Thu, 11 Jul 2002 11:57:19 -0400 "A.J. Tufgar"
<spam_OUTtufgarajTakeThisOuTspamMUSS.CIS.MCMASTER.CA> writes:
{Quote hidden}

FCC Rules Online at http://hallikainen.com/FccRules
Lighting control for theatre and television at http://www.dovesystems.com

Reach broadcasters, engineers, manufacturers, compliance labs, and
attorneys.
Advertise at http://www.hallikainen.com/FccRules/ .


________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
dl.http://www.juno.com/get/web/.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\07\11@123633 by Olin Lathrop

face picon face
>         I've got some modem routines working on the F627 however they
> are not making use of the USART, so I thought I'd be more efficent and
> get the modem working with USART.  However after many hours going
> through the datasheets and Tom McGahee's USART program I still can't get
> it up and running.  I'm trying to avoid using interrupts if possible and
> I'm trying just to get TX working for now.  Here's my code hope someone
> can help, Thanks.
> If I have both TXD and RXD set as outputs

That's definitely a problem.  Both TRIS bits must be set for correct UART
operation.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\07\11@123839 by Olin Lathrop

face picon face
> Are your bank bits set correctly?
>
> For example, you list:
>
>         BCF     TXSTA, SYNC
>         BCF     RCSTA, SPEN
>
> But TXSTA is in bank1, and RCSTA is in bank0.
>
> Thus, you would have to do the following:
>         BCF     STATUS, RP1
>         BSF     STATUS, RP0
>         BCF     TXSTA, SYNC
>
>         BCF     STATUS, RP1
>         BCF     STATUS, RP0
>         BCF     RCSTA, SPEN
>
> For the complete 16F627 memory map (keep this handy while programming!),
see
> page 14 of the PIC16F62X datasheet.

It's good to keep this handy, but even better to let the assembler generate
the bank switching instructions for you.  See my DBANKIF and related macros
in STD.INS.ASPIC at http://www.embedinc.com/pic.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\07\11@124654 by A.J. Tufgar

flavicon
face
Banks are set right.  Sorry should have made that more clear to the
list.  Any more ideas?

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\07\11@132318 by A.J. Tufgar

flavicon
face
Olin thanks for the note on setting tris high but still a no go.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\07\11@172917 by Jinx

face picon face
Aaron, hi, I posted complete simple Rx and Tx routines for the F628
in answer to a question a couple of days ago. Check your mail for
"[PIC] Few PIC16F877 Questions". If you haven't got it try the archives

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\07\11@182309 by A.J. Tufgar

flavicon
face
Thanks Jinx!
I'll check them out.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...