View previous topic :: View next topic |
Author |
Message |
mohanade
Joined: 13 Sep 2008 Posts: 3
|
PC-> PIC using rs232 |
Posted: Sun Sep 14, 2008 11:54 am |
|
|
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
|
|
Posted: Sun Sep 14, 2008 4:27 pm |
|
|
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
|
RE: |
Posted: Sun Sep 14, 2008 9:41 pm |
|
|
Use putc() instead of printf(), it uses less overheads than printf()
thanks
arunb |
|
|
MarcosAmbrose
Joined: 25 Sep 2006 Posts: 38 Location: Adelaide, Australia
|
Re: PC-> PIC using rs232 |
Posted: Tue Sep 16, 2008 4:59 pm |
|
|
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 |
Posted: Tue Sep 16, 2008 11:27 pm |
|
|
I am trying to transfer data using PIC18F4620 through an ethernet cable. can any one tell me the algorithm to go abt ith it |
|
|
|