Co je spatne?
Bolek
bolek-konf@eri.cz
Pátek Říjen 1 19:29:55 CEST 2004
No, uz to tak bude. Mate pravdu. Dik za pomoc.
Jan Matejka wrote:
> A neni to tak, ze se nikdy nestane ze by 256 cyklu cteni AD davalo
> stejny vysledek, krome nejakeho patologickeho stavu (preteceni) 0x3FF,
> ktery jako jediny zobrazite? Ze by Vam to fungovalo spravne tak jste to
> napsal? Zkuste zmensit vyzadovany pocet mereni, treba na 1 nebo 2.
>
> Jan Matejka
>
>
>>-----Original Message-----
>>From: hw-list-bounces@mailman.nethouse.cz
>>[mailto:hw-list-bounces@mailman.nethouse.cz] On Behalf Of Bolek
>>Sent: Friday, October 01, 2004 6:38 PM
>>To: [HWnews]
>>Subject: Re: Co je spatne?
>>
>>
>>Je to cast funkce, ktera cela vypada ted takhle:
>>
>>uint8_t ReadColumn( uint8_t column)
>>// Reads one column, return index of the key pressed
>>// Returns 0xFF if the reading is not stable or no key is pressed {
>> // How many reading must be the same before
>> // the value is accepted. It is used to get rid
>> // of transitional effect when the key is pressed
>> uint16_t i, value, prevval;
>>
>> ADMUX = column+4;
>>
>> // Get first reading
>> ADCSRA = admask | adsc;
>> while (ADCSRA & adsc) ;
>> ADCSRA = ADCSRA | adif;
>>
>> prevval = ADCW >> 2;
>> // Loop
>> for (i=1; i<256; i++) {
>> // Start conversion, loop until it is done
>> ADCSRA = admask | adsc;
>> while (ADCSRA & adsc) ;
>> ADCSRA = ADCSRA | adif;
>> // Read value
>> value = ADCW >> 2;
>>
>> if (prevval!=value) return 0xFF;
>> prevval = value;
>> }
>>
>> char buffer[10];
>> sprintf( buffer, "%x%x", ADMUX, value);
>> DisplayText( buffer);
>>
>> if (value>0xE0) return 0xFF; // No key is pressed, pin is
>>pulled up
>>to AUCC
>> else if (value>0xA0) return 0;
>> else if (value>0x60) return 1;
>> else if (value>0x20) return 2;
>> else return 3;
>>}
>>
>>Ivo Neubauer wrote:
>>
>>
>>>to je jak cast nejake funkce, nebo naky vykousnuti z main ?????
>>>
>>>
>>>
>>
>>----------------------------------------------------------------------
>>
>>>--
>>>
>>>_______________________________________________
>>>HW-list mailing list - sponsored by www.HW.cz
>>>HW-list@mailman.nethouse.cz
>>>http://mailman.nethouse.cz/mailman/listinfo/hw-list
>>
>>--
>>====================================================
>>Ing. Boleslav Vrany
>>
>>Consulting and development in software, electronics,
>>modern optics and mechanical engineering.
>>
>>e-mail: see my web page or use the form there http://www.bolekvrany.cz
>>ICQ: 287 834 668
>>tel: (+420) 732 673 905
>>
>>
>>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> HW-list mailing list - sponsored by www.HW.cz
> HW-list@mailman.nethouse.cz
> http://mailman.nethouse.cz/mailman/listinfo/hw-list
--
====================================================
Ing. Boleslav Vrany
Consulting and development in software, electronics,
modern optics and mechanical engineering.
e-mail: see my web page or use the form there
http://www.bolekvrany.cz
ICQ: 287 834 668
tel: (+420) 732 673 905
Další informace o konferenci Hw-list