Tema: Re: Nesuprantu AtTiny45 aprasymo...
Autorius: Darius-B
Data: 2014-09-20 16:26:59
Cia viskas is tiesu paprasta, galeciau parasyti kaip daryti, bet bijau kad 
ateis Codec`as ir paklaus - "Ar cia tu taip manai?":)


"Shadowed"  wrote in message news:lvfbvk$2ph$1@trimpas.omnitel.net...

Vienu zodziu skaitau datascheeta ir neaisku man toks dalykas:

The following code example shows how to set port B pins 0 and 1 high, 2 and
3 low, and define the port pins from
4 to 5 as input with a pull-up assigned to port pin 4. The resulting pin
values are read back again, but as previously
discussed, a nop instruction is included to be able to read back the value
recently assigned to some of the pins.

unsigned char i;
....
/* Define pull-ups and set outputs high */
/* Define directions for port pins */
PORTB = (1<<PB4)|(1<<PB1)|(1<<PB0);
DDRB = (1<<DDB3)|(1<<DDB2)|(1<<DDB1)|(1<<DDB0);
/* Insert nop for synchronization*/
_NOP();
/* Read port pins */
i = PINB;
....

Ok, tai PORTB nustato zema arba auksta lygi atitinkamose kojose, bet kodel
cia raso kad PB0 ir PB1 aukstam, o PB2 ir PB3 zemam lygiuose ? Ar neturetu
buti portai PB0, PB1 ir PB4 auksti, o PB2, PB3 ir PB5 zemi?
tada su DataDirectionRegisterB - raso, kad nuo PB4 iki PB5 pinu yra inputai,
nors man atrodo kad cia inputai turetu buti PB0, PB1, PB2 ir PB3.