go_away

Author Topic: atmega16L  (Read 3462 times)

0 Members and 1 Guest are viewing this topic.

Offline bakilTopic starter

  • Jr. Member
  • **
  • Posts: 20
  • Helpful? 0
atmega16L
« on: June 22, 2007, 02:37:17 PM »
ok i read a little part of the sheet (info of the chip) so now i wanted to ask what the ports of the atmega16l are for (B7 / B0 for example) in plain english (so even a total noob can understand it)

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: atmega16L
« Reply #1 on: June 22, 2007, 03:35:09 PM »
Quote
Port B is an 8-bit bidirectional I/O port with internal pull-up resistors (selected for each
bit). The Port B output buffers have symmetrical drive characteristics with both high sink
and source capability. As inputs, Port B pins that are externally pulled low will source
current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset
condition becomes active, even if the clock is not running.
Port B also serves the functions of various special features of the ATmega16 as listed
on page 58.


You want this to be translated? Or the functions listed on page 58?

Ok, I'll try to translate this and maybe later the functions.

The first sentence states that Port B is basically an 8 bit or 1 byte port that can be set as input or output. It also state that it has internal pull-up resistors selectable for all or each bit (pin).
The second sentence states that used as output, Port B has buffers that can source (provide current, like connecting something to power) or sink (absorb current, like connecting something to ground).
The third sentence warns you that when used as input, Port B pins that are connected externally to the ground (directly or through a resistor) and have the internal pull-up resistor activated will have a current going towards the ground (directly or through the resistor). This is a waste of power, bad for a robot.
The fourth sentence states that Port B pins will be disconnected from the circuit (state Z, high impedance) when the reset pin will be triggered (usually pulled low - connected to the ground). More about tri-state on the link below:

http://www.cs.umd.edu/class/spring2003/cmsc311/Notes/CompOrg/tristate.html

Does this help?
Check out the uBotino robot controller!

Offline bakilTopic starter

  • Jr. Member
  • **
  • Posts: 20
  • Helpful? 0
Re: atmega16L
« Reply #2 on: June 23, 2007, 01:41:26 AM »
ik this helps thks :p

Offline bakilTopic starter

  • Jr. Member
  • **
  • Posts: 20
  • Helpful? 0
Re: atmega16L
« Reply #3 on: June 24, 2007, 01:19:46 PM »
just a question is it possible to set a pin of portb to in and another one of portb to out

Offline rgcustodio

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 0
  • Use "Search" and ye might find answers!
Re: atmega16L
« Reply #4 on: June 25, 2007, 11:55:47 AM »
It depends on the definitions of the channels. Generally, yes you can set one channel to INPUT only while the other is OUTPUT only.

Open the data sheet of the part (ATmega8, ATtiny13, etc) that you are using then find "Alternate Functions of Port X". This section will give you the definitions of the functionality of Port "X", some channels are INPUT only some are OUTPUT only, some have dual roles, able to become INPUT or OUTPUT. Common sense dictates that you can not set an INPUT only channel to OUTPUT.
The best thing one can do when it's raining is to let it rain. - H. W. Longfellow

understanding is the path to enlightenment

Offline iNFINITE

  • Jr. Member
  • **
  • Posts: 21
  • Helpful? 0
Re: atmega16L
« Reply #5 on: June 26, 2007, 06:57:30 AM »
@bakil

Yes you can..
For PortB you should write 1 in the corresponding bit in DDRB register to configure the xorresponding pin as output. For configuring a pin as input just write the corresponding bit as 0.

For example: You want to use PB0,PB1,PB2,PB3 as input and PB4,PB5,PB6,PB7 as output then you should write DDRB=0xF0


Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,660
  • Helpful? 169
    • Society of Robots
Re: atmega16L
« Reply #6 on: June 27, 2007, 07:38:05 PM »
I use google to do that for me . . .

for example:
DDRB = 0xC7;  //configure B ports 0, 1, 2, 6, 7 for output

(google search '0b11000111 to hex')

Offline iNFINITE

  • Jr. Member
  • **
  • Posts: 21
  • Helpful? 0
Re: atmega16L
« Reply #7 on: July 01, 2007, 07:33:47 AM »
You can also use the "calculator" program in Windows. Switch to scientific view. Select Binary, type 11000111, then select hex, it will show C7.

 


Get Your Ad Here

data_list