Searching \ for '[PIC]: 18C452 UART' 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: '18C452 UART'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: 18C452 UART'
2002\08\01@100252 by James.Hyslop

flavicon
face
Hi,

I am trying to use the UART on the PIC18C452 to read serial output from the
computer.  I have successfully been able to send serial output and view it
on the computer, but I want to go the other way.  I am using the MPLAB C18 C
compiler, sofware UART, interfacing to the computer through a MAX233 chip.
What I want to do is have a place in the program where the PIC checks for
data from the computer, or it waits there for a certain character to be sent
from the computer.  For example:


...

char SerialIn;  //character to hold data from UART

...

SerialIn=ReadUART();  //reads a character in through the Software UART
while(SerialIn != 0x30){  //wait while SerialIn is not 0x30 ('0')
       SerialIn=ReadUART();  //read a character from the Software UART
}

...



The program will pause at this point and wait, but this code does not seem
to work. Perhaps it is a timing problem?  What i'd really like to do is use
some kind of interrupt, but i'm not sure how to go about that.  Is there a
buffer that could hold this serial information that I could just
periodically check instead of continuously polling the UART input pin?  I
appreciate any help that you can offer.  Thanks!


James Hyslop


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the sender immediately.

This footnote also confirms that this email message has been swept by
MIMEsweeper and Symantec Norton AntiVirus for the presence
of computer viruses.
**********************************************************************

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\08\01@101719 by Jennifer L. Gatza

flavicon
face
Have you tried using the hardware USART?  It has a receive interrupt with a
buffer for the incoming byte.  It works very reliably.

Jen

In response to:

What i'd really like to do is use
some kind of interrupt, but i'm not sure how to go about that.  Is there a
buffer that could hold this serial information that I could just
periodically check instead of continuously polling the UART input pin?  I
appreciate any help that you can offer.  Thanks!

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\08\01@120154 by Harold M Hallikainen

picon face
       Some reason you're using the software uart instead of hardware? For the
hardware USART, I use the code below:

unsigned char InkeyUSART(void){
// Same as getcUSART, but returns 0 if no key instead of waiting for a
key
unsigned char data;
 if (DataRdyUSART()){
     data=getcUSART();                 // Get the byte
 }else data=0;                         // If nothing there, return 0
 return(data);
}


Harold



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: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


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