Co je spatne?
Bolek
bolek-konf@eri.cz
Pátek Říjen 1 18:38:08 CEST 2004
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
Další informace o konferenci Hw-list