Author Topic: Port usages  (Read 2736 times)

0 Members and 1 Guest are viewing this topic.

Offline RadikenTopic starter

  • Jr. Member
  • **
  • Posts: 39
  • Helpful? 0
Port usages
« on: May 03, 2007, 06:37:52 PM »
I'm looking over the Schematic of a microprocessor that I have, and I'm curious what these extra ports are used for:

What are some popular uses for an Interrupt?
What a Serial clock and serial data (SCL and SDA) used for?
What is TX and RX, and what are they used for?
What is LSDA and LSCL?
What are some other uses for pulse with modulators besides servos?

and finally, how do I know if a port is analog or digital? (It doesn't say what ports are analog on the schematic)

Thanks for any help!

The schematic can be found here: (very top one)
The best way to get to the top is to get off your bottom.

Offline Somchaya

  • Robot Overlord
  • ****
  • Posts: 180
  • Helpful? 0
  • You know it's cute!
Re: Port usages
« Reply #1 on: May 03, 2007, 09:43:53 PM »
Hmm let me try to answer some of these questions..

An interrupt is useful for working with encoders. If you set it up so that a click (when a black goes to white or vice versa) creates an interrupt, you can increment your encoder count in the code.

TX and RX are useful for creating a serial link to the microcontroller

PWMs can also be used to control DC motors, if you have a speed controller board attached (since some of them can accept PWM as input).
Somchaya - Back after a year of misc things

Offline dunk

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 1,086
  • Helpful? 21
Re: Port usages
« Reply #2 on: May 04, 2007, 04:26:09 AM »
to expand a little on Somchaya's answer,

you would use an interupt when a task on a microcontroller is time critical.
when an interupt is triggered the current program pauses and jumps to a different section of code (called the Interupt Service Routine or ISR on PICs).
when the interupt is over the program returns to where it left off in the main section of the program.

interupts are important when you need something to happen quickly.
as an example, imagine you had a complicated program that took a few seconds to complete each loop.
now imagine that you had a keyboard attached. you don't want to wait for a full iteration of the main program before the system responds every time a user types a key.
you would attach the keyboard to an interupt so user input was captured immediately.

Somchaya's encoder example is just a high speed version of the same problem. the interupt is needed to get timing information as accurate as possible.

SCL and SDA are the 2 lines on an i2c bus which is a 2 wire serial communication protocol commonly used for passing information between electronic components.
i use i2c whenever i have more than one microcontroller in a project. it's a very usefull way to pass information without much hardware.

i'm guessing LSDA and LSCL are a 2nd i2c channel.
what does the datasheet say?

the serial link that uses TX and RX can be connected to a PC serial port with a few extra components allowing you to control/read data from your project.

PWM (Pulse Width Modulation) is commonly used for controlling the amount of power going to something.
imagine you want to controll how bright an LED is. attach it to a PWM port. if you want it at 50% brightness, switch the pin it is attached to on and off so it is only on 50% of the time.
this is used a lot in DC motor controll.

to find out if a port is analog or digital, read the datasheet for the microcontroller on the board.
some pins can do either, depending on how you configure them.



Get Your Ad Here