Searching \ for ' Serial Setup' 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/io/serials.htm?key=serial
Search entire site for: 'Serial Setup'.

No exact or substring matches. trying for part
PICList Thread
'[PICLIST] Serial Setup'
2000\09\27@004212 by David Huisman

flavicon
face
I am having problems with the TXIF flag not being set after loading transmit
data into the TXREG. A snippet of code concerning the serial comms is below.
Would someone mind pointing out what I have missed ? The code locks up on
the "while" line.
The watchdog timer is disabled, code is compiled using Hi-Tech C in MPLAB,
then downloaded via Microchip DEBUG ICD to ISP connection on target. I have
tested other code on the platform such as flashing LED's etc attached to
various port pins without problem.


THANKS

void Send(unsigned char tx_byte)
{
  TXREG = tx_byte;
  while (!TXIF);
}

void init(void)
{
       TRISC = 0x80;   PortC = all outputs except RXD
       INTCON = 0xc0;  Enable global ints, enable PEIE
       TXSTA = 0x24;  Txen = 1,Sync = 0,BRGH = 1
       RCSTA = 0x50;  Spen = 1, CREN = 1
       SPBRG = 129;   9600 Baud, 0.16% error
}

main(void)
{
 for(;;)
 {
   Send(65);
   Delay(200);
 }
}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
use spam_OUTlistservTakeThisOuTspammitvma.mit.edu?body=SET%20PICList%20DIGEST


2000\09\27@061806 by Paul

flavicon
face
re problem:

from what l remember (l dont use hardware comms much) the TX interupt flag
is to tell you that the sending process is over...not ready to begin...
ie.
its over
put next byte in buffer
transmit
wait for txif

{Original Message removed}

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