Newbie: Beginner Questions[long]

Started by Sukrit K Mehra February 29, 2004
Background:I have done interfacing of PIC16f877 and 8051 with an ADC,
DAC, stepper motor, LCD etc using port pins. Using this method I can
interface anything with a uC.

1. I want to learn interfacing using I2C or any other bus.
What I don't understand is how are the control/data registers mapped
onto the uC i/o or memory space?

When I interfaced a LCD, I used the port pins and each pin represented
a bit on the LCD. I used 8 pins for data channel and 3 pins for
control (or something like that).

2. In my course I first learnt how to glow leds using the port pins of
a uc. Extrapolating from that knowledge I have been able to interface
all kind of hardware - adc, dac, lcd etc. Now that's just one way of
interfacing. Buses are another and I don't understand them; there are
many to choose from: I2C, USB, PCI, ArmBus, ISA etc. What would be a
good example bus to learn so that I am at a level that I can simply
look at the datasheet of the device or bus specification and use that
particular bus technology?

3. What are board support packages? If I compile a gcc toolchain for
an arm based hardware, build any custom device drivers needed and
install linux on it, would I have built a board support package?

You might want to check out the book "Designing Embedded Hardware" from
O'Reilly. Some of it will be stuff you already know, but it does cover things
like I2C, SPI, and even a bit of USB.

As for I2C, it's a bit weird. Each chip type has it's own address. When you
start an I2C transaction (there's a simple START sequence), you send the
address of the device you want to talk to along with a R/W bit. If the device
with that address is out there, it sends back an ACK bit. Now, how you control
that device depends on the device itself. You might want to read up on
different I2C devices like temperature sensors and EEPROMs. On the
microcontroller, you either control I2C with a built-in I2C controller or with
2 pins of digital I/O.