CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to initialize a uart

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ikk06



Joined: 30 Nov 2009
Posts: 6

View user's profile Send private message

How to initialize a uart
PostPosted: Mon Nov 30, 2009 12:28 pm     Reply with quote

Hi I am new to pic c programming and I was wondering if anybody knows how to initialize the uart for asynchronous transmission on the pic18f252.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Nov 30, 2009 12:39 pm     Reply with quote

See this post:
http://www.ccsinfo.com/forum/viewtopic.php?t=37010&start=14
Ikk06



Joined: 30 Nov 2009
Posts: 6

View user's profile Send private message

PostPosted: Wed Dec 02, 2009 8:56 am     Reply with quote

When I checked the datasheet for my pic it said that I had to initialize the SPBRGH and the TXSTA. Is that not required to get the pic to send a message to the pc?

What if you wanted to connect another device to the pic such as a button, so that when you press the button a signal is sent to the pc?
Ttelmah
Guest







PostPosted: Wed Dec 02, 2009 9:55 am     Reply with quote

This is the fundamental difference between a compiler, and assembler. The compiler does a lot of the basic 'housekeeping' for you. So (for instance), you can just declare a variable, and the compiler decides where to actually put it in memory, and keeps track of it as you work. Similarly fo the UART, you just use the '#use rs232' line, and then getc, and putc to read/write data, and the compiler sets all the registers for you.
The button, is a separate thing. All you do, is input the bit value, and when it changes, or (better for a real button), when it has stayed the 'same' for a number of mSec, rsend your message.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group