View previous topic :: View next topic |
Author |
Message |
d_nikolaos
Joined: 13 Oct 2008 Posts: 17 Location: Greece,Macedonia,Thessaloniki,Kalamaria
|
PIC and PC communication |
Posted: Mon Oct 13, 2008 7:38 am |
|
|
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
|
|
Posted: Mon Oct 13, 2008 7:50 am |
|
|
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
|
|
Posted: Mon Oct 13, 2008 8:03 am |
|
|
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
|
|
Posted: Mon Oct 13, 2008 8:05 am |
|
|
Oups sorry,
I am the person above...... |
|
|
Blob
Joined: 02 Jan 2006 Posts: 75 Location: Neeroeteren, Limburg, Belgium
|
|
Posted: Mon Oct 13, 2008 8:17 am |
|
|
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
|
|
Posted: Mon Oct 13, 2008 8:31 am |
|
|
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
|
|
Posted: Mon Oct 13, 2008 8:36 am |
|
|
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
|
|
Posted: Mon Oct 13, 2008 8:48 am |
|
|
You think it's better do it in a new topic?
Thanks very much for your help.... |
|
|
|