Tema: Re: Nesuprantu AtTiny45 aprasymo...
Autorius: Gadaminas
Data: 2014-09-19 07:50:41
Nieko labai sudetingo nera. reikia gerai isiskaityti datasheta, kai ka 
pabandyti ir nusvis. O atmel studio geras yra, nes gali daug ka 
modeliuoti-simuliuoti, nors igyjus patyrimo simuliavimas beveik 
nereikalinagas. Reikia suprasti principus. Universitetuose pamoko , paskaito 
be jokiu didesniu praktiku, tai gaunasi, kad imeta tave, o toliau kapanokis. 
Info daug-belieka tik atsirinkti.




"Shadowed" <shadowed@bk.ru> parašė naujienų 
pranešime: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.