Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Serial Communication using I2C

Status
Not open for further replies.

ericmar

Full Member level 5
Joined
Apr 14, 2004
Messages
278
Helped
3
Reputation
6
Reaction score
4
Trophy points
1,298
Location
Singapore
Activity points
2,928
Serial Communication

Hi guys,
May I know wats the different between using handshaking or not using it in Serial Communication? When we r not using it, we just connect RTS to CTS, and DTR to DSR, am I right?

Thanks!

Regards,
Eric
 

Re: Serial Communication

Well, when u don't do handshake, u have to configure both terminals at the same speed and frame configuration, u are right, is just connecting both terminals together, usually crossover connect.

When there is handshake the terminals find and configure the comunications and find a carrier too. At least that is how i always used it.
 

Re: Serial Communication

DarkJedi said:
Well, when u don't do handshake, u have to configure both terminals at the same speed and frame configuration, u are right, is just connecting both terminals together, usually crossover connect.

When there is handshake the terminals find and configure the comunications and find a carrier too. At least that is how i always used it.
It's not neccessary to do handshaking, isnt it? Wont it be troublesome to do handshaking?
 

Re: Serial Communication

Hi,

Handshake is needed when you have to transmit continous data. In such high traffic, the receiver has a lot of work to do, like processing the incoming data's buffer, processing the datas itself etc.

If the incoming flow is continous, there will be a moment where the receiver will not have time enough to do all that things, so it will send an "xoff" or set the proper pins to tell the sender to stop sending.

When it has processed some datas and when it is able to receive new ones, it will send an "xon" to tell the sender restart sending.

This is specialy true when the processor inside the receiver is a small microcontroller with small memory onboard. Imagine a PC station like P4 3GHz sending continous datas through a RS232 link to a small PIC board. The P4 station has memory and CPU power enough to process data coming fron the PIC board, but in the other way, the PIC board can not.

Sending "xon", "xoff" or managing the RTS/CTS pins must be do by software. If i am not wrong, there are some rescent UARTs that can manage itself their RTS/CTS pins, but i am not sure.
 

Re: Serial Communication

If I only need to send data to computer once a while and I dont need computer to send any data to PIC, then do I still need to do handshaking? If I do handshaking, I'll need to use 4 pins of PIC, right? If not, I just need 2 pins only?
 

Re: Serial Communication

Hi,

I think you are right. If you have nothing to transmit to the PIC, then you do not have to use handshaking. But if you want to use it without using any PIC pins, you can do handshake by using "xon" and "xoff" that are ASCII characters dedicated to software handshake.

Sending "xon" to the other side tells the other side to start transmission. Sending "xoff" to the other side tells the other side to stop transmission.

When you start hyperterminal on a PC, you can choose between hardware handshaking (RTS/CTS), software handshaking (xon/xoff) or no handshake.
 

Re: Serial Communication

papyaki said:
The P4 station has memory and CPU power enough to process data coming fron the PIC board, but in the other way, the PIC board can not.

Even a PC far slower than a P4 will be able to bang out serial data almost constantly. If the PIC has a UART, it can probably store at least 2 bytes of data, and as long as you're not running at a really high baud rates you should easily have enough time for processing. Take, for example, DMX512. It runs at 250Kbaud, far faster than most serial ports will run at, and that still gives you around 88uS to do any required processing before the UART buffer will overflow. Once you empty the buffer (which isn't going to take long) you have another 88uS, and so on. I can't see why you would encounter any problems with PIC speed.
 

Re: Serial Communication

papyaki said:
Hi,

I think you are right. If you have nothing to transmit to the PIC, then you do not have to use handshaking. But if you want to use it without using any PIC pins, you can do handshake by using "xon" and "xoff" that are ASCII characters dedicated to software handshake.

Sending "xon" to the other side tells the other side to start transmission. Sending "xoff" to the other side tells the other side to stop transmission.

When you start hyperterminal on a PC, you can choose between hardware handshaking (RTS/CTS), software handshaking (xon/xoff) or no handshake.
Can u give me an example on how to do the software handshaking?
 

Re: Serial Communication

@seven_segment:

imagine that the tiny PIC receives datas from accelerometer and has to process the datas(my application). It takes a little bit more then 88µs to calculate the angles and show the calculations on a display ...

With this I will say, it depends on your application if you need handshaking or not.
 

Re: Serial Communication

ericmar said:
Hi guys,
May I know wats the different between using handshaking or not using it in Serial Communication? When we r not using it, we just connect RTS to CTS, and DTR to DSR, am I right?

Thanks!

Regards,
Eric

Look here for a nice tutorial:

**broken link removed**
**broken link removed**

Bye
 

Serial Communication

I cant connect the RC6/TX and RC7/RX directly to the RS232 serial COM port's TXD and RXD, right? I tried this but it doesnt work for some reasons if I connect the RS232 serial COM port's TXD to RC7/RX and RXD to RC6/TX. But it works the other way round. Is that mean the data are inverted? I'm using the FTDI FT232BM chip and not using any MAXIM IC chips atm.
 

Re: Serial Communication

Do you put a RS232 driver between your PIC and your PC?
Please take a look at the datasheet for the MAX232 you can found it on www.maxim-ic.com
 

Re: Serial Communication

Mr_Programmer said:
Do you put a RS232 driver between your PIC and your PC?
Please take a look at the datasheet for the MAX232 you can found it on www.maxim-ic.com
I'm using the FTDI FT232BM chip in between of PIC and PC so I guess I dont need a RS232 driver, am I right?
 

Re: Serial Communication

@eric_mar:

Sorry, I don't read the last line of your previous posting. BTW I took a short look on the data sheet of the FT232. Did the PC recognize the new RS232 port??? With which voltage levels are you dealing, I mean at which voltage operate your PIC, as far as I see the FT232 works with 5V. Did you also connect the ground from FT232 to the PIC? You see, theese are only suggestions, without knowing your hardware. If you don't find the problem, post you schematic.
 

Re: Serial Communication

Mr_Programmer said:
@eric_mar:

Sorry, I don't read the last line of your previous posting. BTW I took a short look on the data sheet of the FT232. Did the PC recognize the new RS232 port??? With which voltage levels are you dealing, I mean at which voltage operate your PIC, as far as I see the FT232 works with 5V. Did you also connect the ground from FT232 to the PIC? You see, theese are only suggestions, without knowing your hardware. If you don't find the problem, post you schematic.

The PC does recognize the FTDI device as a new serial COM port. I use usb power to supply voltage to the FTDI chip but another external power to supply my PIC. I didnt ground from FT232 to PIC, could this be the problem?
 

Re: Serial Communication

If the PIC isn't on the same PCB or does not use the same power supply, this will be a problem.
 

Re: Serial Communication

Mr_Programmer said:
If the PIC isn't on the same PCB or does not use the same power supply, this will be a problem.
Are u saying that I must use the same power supply for both the FT232BM chips and my PIC?

In fact, I'm using this USB<->serial kit and would like to combine it with my device. I'm developing my device on the Blurbird Millennium board so I'm not using the same power source for both chips. I think this USB kit draws the power from USB ports to supply itself! Currently, I'm not doing handshaking and only use the pin 9 (TX) and pin 10 (RX) on this USB kit.
 

Re: Serial Communication

I don't say that you have to use the same power supply. I will say you have to use the same ground!
Without the same ground you have a big problem. The voltage on the RS232 line have no comparable reference, you have the meaning that the voltage on you RS232 TX line(USB) is 5V but if you measure the same line with the ground from the PIC board as reference you will say "WHOWW, what is this?". If you connect a bus cable (RS232 is simple point to point) you always connect the ground also. Therefore the minimum RS232 cable has 3 wires: RX, TX and ground (pins 2, 3 and 5).

I'm sorry if I can't explain it better.
 

Re: Serial Communication

Mr_Programmer said:
I don't say that you have to use the same power supply. I will say you have to use the same ground!
Without the same ground you have a big problem. The voltage on the RS232 line have no comparable reference, you have the meaning that the voltage on you RS232 TX line(USB) is 5V but if you measure the same line with the ground from the PIC board as reference you will say "WHOWW, what is this?". If you connect a bus cable (RS232 is simple point to point) you always connect the ground also. Therefore the minimum RS232 cable has 3 wires: RX, TX and ground (pins 2, 3 and 5).

I'm sorry if I can't explain it better.
I get wat u mean now! Thanks for explaining so clearly to me! Sorry that I'm a bit slow on this. hehe... :)

Now I managed to get it work already but then whenever I turn off my PIC, 0xFE will be sent to computer! What's this? :?

Besides, can anyone teach me how to do software handshaking by using XON/XOF ? :?:
 

Serial Communication

I guess it's possible that the 0xFE is just caused by noise when switching off the supply???
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top