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

PIC and PC communication

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



Joined: 13 Oct 2008
Posts: 17
Location: Greece,Macedonia,Thessaloniki,Kalamaria

View user's profile Send private message

PIC and PC communication
PostPosted: Mon Oct 13, 2008 7:38 am     Reply with quote

Hi,
I am a new member of this forum and i have some questions to do.
I am doing sampling to a signal with 12bits resolution.I save it to a pic and my question is if there is any easy way to transfer this signal to a PC.
I tried to do it through the serial port but it can transfer 8 bits each time and i want 12.
I am using PIC16F877.
Blob



Joined: 02 Jan 2006
Posts: 75
Location: Neeroeteren, Limburg, Belgium

View user's profile Send private message

PostPosted: Mon Oct 13, 2008 7:50 am     Reply with quote

hello,

welcome to the forum.

if you want to send some data using rs232 this is what happens:

f.e. you want to send "hello",

the printf function sends:
"h" then "e" followed by "l" , "l" and "o"
all letters will be send seperately.

you have to put them together again at the PC side.

so it does not matter if you want to send just 1 letter or a whole sentence.

Best regards,
Blob
Guest








PostPosted: Mon Oct 13, 2008 8:03 am     Reply with quote

Thanks for the interest Blob.
I want to sent numbers, not letters.
And if a number is at this format:000000111101, with the RS232 the first 8 bits will transfer and then the others. I ask if there is a way to send it all at once. Perhaps with ethernet?But I don't know how.
d_nikolaos



Joined: 13 Oct 2008
Posts: 17
Location: Greece,Macedonia,Thessaloniki,Kalamaria

View user's profile Send private message

PostPosted: Mon Oct 13, 2008 8:05 am     Reply with quote

Oups sorry,
I am the person above......
Blob



Joined: 02 Jan 2006
Posts: 75
Location: Neeroeteren, Limburg, Belgium

View user's profile Send private message

PostPosted: Mon Oct 13, 2008 8:17 am     Reply with quote

hello,

you can cast it to an int or string or whatever,
I used letters in my example but you can use numbers too.

you can even send bit by bit...

for example your 000000111101 would be 61 in decimals and 3D in Hex.

it will be send as "3" and then "D"; you will have to put them back together as 3D and convert back to binairy number 111101.

it is easier when you use a start and stop sign f.e.

# = start
; = stop

when your pc receives # it will know that a new value will arrive
when a ; is received your pc program will know that the transfer of the value is complete


printf("#3D;");
so #3D; will be received by your computer

you have to tell your pc program to ignore the # and ;

best regards,
Blob
d_nikolaos



Joined: 13 Oct 2008
Posts: 17
Location: Greece,Macedonia,Thessaloniki,Kalamaria

View user's profile Send private message

PostPosted: Mon Oct 13, 2008 8:31 am     Reply with quote

Thanks for your help
Now something else.
Do you know how the pic can communicate with a pc through the ethernet?
Blob



Joined: 02 Jan 2006
Posts: 75
Location: Neeroeteren, Limburg, Belgium

View user's profile Send private message

PostPosted: Mon Oct 13, 2008 8:36 am     Reply with quote

The rs232 I use a lot,

but I never used ethernet connection

hope someone else can help you.

Best regards,

blob
d_nikolaos



Joined: 13 Oct 2008
Posts: 17
Location: Greece,Macedonia,Thessaloniki,Kalamaria

View user's profile Send private message

PostPosted: Mon Oct 13, 2008 8:48 am     Reply with quote

You think it's better do it in a new topic?
Thanks very much for your help....
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