Searching \ for '[PIC]: uart asynchronous transmitter mode' 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/devices.htm?key=pic
Search entire site for: 'uart asynchronous transmitter mode'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: uart asynchronous transmitter mode'
2007\07\30@091713 by ELKEJBOUT Mustapha

flavicon
face
hi list,
I have a problem with the uart part of the pic16f628, I want to send some data, from RA0..3, on TX , here is the code:

list p=16f628
   
   include "p16f628.inc"

   __CONFIG _CP_OFF & _DATA_CP_OFF & _BODEN_OFF & _MCLRE_OFF & _PWRTE_OFF & _WDT_OFF & _XT_OSC & _LVP_ON


tmp EQU 0x20
   
   org 0x00
   goto main

   org 0x04
   goto main
   ;; uart config:    asynchronous transmitter mode
main
   movlw 0x0        ; usrt initialization
   bsf STATUS, RP0     ;bank 1
   movlw 0x01f
   movwf TRISA
   movlw 0x19        ; X=25 to set baud rate for 9600bps
   movwf SPBRG
   bsf TXSTA,BRGH
   bcf TXSTA,SYNC
   bcf TXSTA,TX9
   bsf TXSTA,TXEN
   bcf STATUS, RP0        ; bank 0
   bsf RCSTA,SPEN
   clrf PORTA
   
mnloop
   movf PORTA,W
   andlw 0x0f
   movwf TXREG
   goto mnloop

   end

if I use a literal value the transmission occurs correctly but as I use a PORTA as input from which I should read the transmitted data, Only I got 0000000 on TX.
any help would be appreciate
thanks in advance


Mustapha ELKEJBOUT
---------------------------------------
"Every one has to do what he can do according to how it can be truly done"
For whom the bell tolls, Ernest Hemingway.
     
---------------------------------
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail

2007\07\30@114611 by Dario Greggio

face picon face
ELKEJBOUT Mustapha wrote:

> mnloop
>     movf PORTA,W
>     andlw 0x0f
>     movwf TXREG
>     goto mnloop

You should wait for TRMT flag or TXIF flag, before (or after, it depends
on schools of thoughts...) sending a new char to TXREG...

--
Ciao, Dario

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