Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 15, 2024, 02:56:59 02:56


Login with username, password and session length


Pages: [1]
Print
Author Topic: serial communication  (Read 3962 times)
0 Members and 1 Guest are viewing this topic.
schlen
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 2
-Receive: 0


« on: December 30, 2007, 03:36:53 15:36 »

hello friends,

i use 16f877, i want to send 12 bit data on portb and show it on lcd. i tried times and times but i couldn't do it. i am so bored why i can't do it. Could u send me a sample to explain serial communication? i am so confused.

my english is not good and i can't understand all information from help menu. plz help me.
Logged
Silent_Thunder
Junior Member
**
Offline Offline

Posts: 69

Thank You
-Given: 56
-Receive: 20



« Reply #1 on: December 31, 2007, 07:00:36 07:00 »

Hi schen;
Regarding the serial communication, you can only send max 9 bit data using Asynchronous mode, otherwise you can split your data into 2 bytes and send theme separatly, and combine theme back when they are recived.
Logged
schlen
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 2
-Receive: 0


« Reply #2 on: December 31, 2007, 02:27:41 14:27 »

Hi Silent_Thunder,

Thank u ur answer, but i couldn't send and receive any data by serial with virtual terminal on proteus. so i have problem about serial data sending and receiving.
Logged
ero
Junior Member
**
Offline Offline

Posts: 43

Thank You
-Given: 12
-Receive: 27


« Reply #3 on: December 31, 2007, 03:31:55 15:31 »

@Schlen,
There are some specific point on serial communications. If you pay enough attention to that points you can do esaily that communcations. Let me I explain you a little bit;
- First of all try to use the pic which having hardware serial port (USART) .
- Try to send first the preambl signal to the reciver to weak up it before you send your real data.
- Try to send again on the receiver side the USART interrupt. By the way you can not loose any data.
- Do not use very high baud rate on both side. If you are using 4 MHz osc. freq. 2400 Baud will be enough for you.
- I had prepared some lessons for PBP and it is included also serial communication. Download them from following link (the lessons are prepared in Turkish Language)
http://www.4shared.com/file/17435059/b7b33870/BASIC-DERS.html

In case if you have some more questions send me e-mail or pm .

I hope you do the job now.

Ero (Ete)
Logged
twonuts
Active Member
***
Offline Offline

Posts: 118

Thank You
-Given: 55
-Receive: 42


« Reply #4 on: December 31, 2007, 04:40:42 16:40 »

Maybe you should investigate SPI for more than 9 bits serial data exchange.
Logged
Silent_Thunder
Junior Member
**
Offline Offline

Posts: 69

Thank You
-Given: 56
-Receive: 20



« Reply #5 on: January 01, 2008, 05:28:10 17:28 »

Hi schen;
I guess ur problem with Proteus is in the baud rate, u have to set the virtual terminal at the same baud rate as ur pic.

and with my post u can find a simple proteus schematic to test serial, it will echo back each byte it receive.
Logged
schlen
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 2
-Receive: 0


« Reply #6 on: January 01, 2008, 11:32:10 23:32 »

Silent_Thunder,
thank you for your interest, but i need program file to understand it. like proton or mikro c
Logged
Silent_Thunder
Junior Member
**
Offline Offline

Posts: 69

Thank You
-Given: 56
-Receive: 20



« Reply #7 on: January 02, 2008, 05:37:32 17:37 »

Hi schen;
I'm using MikroBasic, and the test program is just a few lines of code, if it will help, here it is :


program rs232_com_test
dim received_byte as byte

main:
  Usart_Init(9600)                      ' Initialize USART at 9600 baud
  while true
    if Usart_Data_Ready = 1 then   ' If data is received
      received_byte = Usart_Read   ' Read received data
      Usart_Write(received_byte)    ' Send data back via USART
    end if
  wend
end.
Regards
Logged
schlen
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 2
-Receive: 0


« Reply #8 on: January 02, 2008, 08:36:51 20:36 »

i ll try it as soon as possible, thx
Logged
JADT
Guest
« Reply #9 on: January 05, 2008, 04:33:18 16:33 »

Hi schlen,

It might be a good idea to do some research on serial, if you did not do it yet here is some usefull links:
http://en.wikipedia.org/wiki/RS-232
http://en.wikipedia.org/wiki/Asynchronous_start-stop

Then you could also try a logic probe to see if data is being send & received...

Greetings
Augusto
Logged
Shinta
Newbie
*
Offline Offline

Posts: 21

Thank You
-Given: 20
-Receive: 3


« Reply #10 on: January 11, 2008, 10:37:01 22:37 »

If your communication doesnt work maybe the error is in the eschematic circuit connection.

Even Proteus need to be configured. Check paremeters like: bit rate, parity, data bits.
Remember that this parameters have to match with the pic.

Also check the frecuency of the oscilator of the Pic in the propertys of Proteus. Maybe you're using a 20Mhz Crystal in the pic program and the Proteus configuration is 4Mhz (default). The external connection of a crystal in the Proteus schematic don't give the frecuency of operation of the pic.
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC