Pages: [1]   Go Down
Author Topic: Serial devices and clock pin  (Read 1384 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm posting this to make sure I understand it.

The Clock pin determines the rate of transfer of serial data and is determined by the arduino's programmed baud rate, correct?

Then this means serial devices essentially operate at this rate and not a certain speed set by the device, right?

Therefore, I can use ONE digital pin for Clock and connect it to multiple serial devices (PS/2 mouse, keyboard, LCD, etc) and they will all operate at the same baud rate? I would have one clock pin and three data pins?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 332
Posts: 16568
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Confusing what you are asking about? When one talks of baudrate that is when using the Serial.print commands that can send data to the PC or to a wired external serial link. There is no seperate clock used for that, the timing is determined by the bit length of the data. When one talks of a seperate clock line then that is usually in context to the SPI or I2C communications, and there is never a baudrate just the clock rate used for the clock signal. In SPI the master device determines how fast to run the clock signal and those speeds are defined in the arduino libraries that support SPI and I2C, however they can be modified to run at faster speed by hacking at the libraries I suppose.

So the speed of SPI or I2C buses have nothing to do with whatever speed the arduino is used in the Serial.begin(baudrate) statement.

So there are three totally seperate serial communications method that can be used on a Arduino. There speeds of operation have no dependencies on each other.

Serial
I2C
SPI

 Serial is just two signals, send and recieve. I2C uses two signals clock and data. SPI uses four signals, slave select, clock, MOSI, MISO.


So do you still have a question?

Lefty


« Last Edit: August 15, 2011, 11:05:38 pm by retrolefty » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, so PS/2 input devices are I2C? And I'm going to be using an I2C LCD. So, because I'm not Rx and Tx, I don't need to worry about the baud rate because none of those are "serial". Right?

So I could just put all of the clock pins from seperate I2C devices into one pin on the arduino, right?

And if I use the Wire library, I can also combine all of the data from the Data pins into one pin, too. Correct?

Ya know what? Can someone just point me to some good material on how to make a multi-peripheral I2C and I'll take it from there?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 446
Posts: 23872
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I2C is simple in concept.
You take the SCL from the Arduino and connect it to the clock input on your peripherals.
The take the SDA from the Arduinon and connect it to the data input on your peripherals.
At the end of the string of parts, you add a 10K resister on each line to +5v.

Then to access a part, you send out the address of a part as a read or write command, you send out the address of the register you want to read or write from (and maybe multiple bytes of address, depends on th device), and the next byte transferred is the data you send out, or the data you read back.
The wire library is also set up to read blocks of data if the device supports that.

If your devices have the same I2C address, there are ways around that too.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1]   Go Up
Jump to: