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 support@ccsinfo.com

PC-> PIC using rs232

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



Joined: 13 Sep 2008
Posts: 3

View user's profile Send private message

PC-> PIC using rs232
PostPosted: Sun Sep 14, 2008 11:54 am     Reply with quote

I am trying to send numbers (i.e. 44,55,66, etc) from a PC to be stored inside a 16F877A microcontroller .
The numbers are being sent using serial rs232 communication.
The microcontroller receives the information in the for of a string.

From the PC side, what's the form of the printf function that to be sent (printf("%d\n", 44); )?

On the Microcontroller side, How do i receive the number in the serial format and store it as an integer in a byte?..
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Sep 14, 2008 4:27 pm     Reply with quote

Look at the input.c file. It has various functions to get numbers from a
PC (in the form of an ASCII string -- terminated with a carriage return)
and convert them into int, long, float variables. Here's the file location:
Quote:
c:\Program Files\PICC\Drivers\input.c
arunb



Joined: 08 Sep 2003
Posts: 492
Location: India

View user's profile Send private message Send e-mail

RE:
PostPosted: Sun Sep 14, 2008 9:41 pm     Reply with quote

Use putc() instead of printf(), it uses less overheads than printf()

thanks
arunb
MarcosAmbrose



Joined: 25 Sep 2006
Posts: 38
Location: Adelaide, Australia

View user's profile Send private message

Re: PC-> PIC using rs232
PostPosted: Tue Sep 16, 2008 4:59 pm     Reply with quote

mohanade wrote:

From the PC side, what's the form of the printf function that to be sent (printf("%d\n", 44); )?

From the PC side, this really depends on what programming enviroment you're using. If you're creating a console (DOS type) application then just use Putc(). However, if you're working in a Windows/Visual/.Net enviroment, it's easier to use the Serial Port Controller/Class to send/receive data.

-Cheers
viraj
Guest







beginer
PostPosted: Tue Sep 16, 2008 11:27 pm     Reply with quote

I am trying to transfer data using PIC18F4620 through an ethernet cable. can any one tell me the algorithm to go abt ith it
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