casova konstanta
Marek Pavlu
pavlu@HWserver.cz
Sobota Červen 16 20:56:54 CEST 2007
Nepouzivejte 4,000MHz, ale 4,096MHz krystal.
Delicku k TMR0 vypnete, tim ziskate preruseni kazdych:
4,096 * 10^6 / 4 / 256 = 4000
Preruseni kazdych 0.25 ms, coz uz staci napocitat do ctyr a mate presne 1ms.
Nicmene kondiky u krystalu Vam lehce ovlivni vysledny kmitocet tez...
M. Pavlu
>> -----Original Message-----
>> From: hw-list-bounces@list.hw.cz [mailto:hw-list-bounces@list.hw.cz]
>> On Behalf Of Libor
>> Sent: Saturday, June 16, 2007 8:03 PM
>> To: HW-news
>> Subject: casova konstanta
>>
>> Zdravim
>> Mel bych dotaz jestli by mi nekdo nezkontroloval tento kod pro
>> microchoip 16f627
>>
>> Clock je 4MHZ crystal a potreboval bych aby promenna timeticks
>> ukazovala
>> co nejpresneji milisekundy cili timeticks = 1000 => 1 sekunda
>>
>> void interrupt() {
>> timeticks++;
>> TMR0 = 101;
>> INTCON = 0x20; // Set T0IE, clear T0IF
>>
>>
>> }
>>
>>
>> main
>> OPTION_REG = 0x01;
>> TMR0 = 101;
>> INTCON = 0xA0; // Enable TMRO interrupt
>>
>> Mockrat diky
>>
>> LK
>> _______________________________________________
>> HW-list mailing list - sponsored by www.HW.cz
>> Hw-list@list.hw.cz
>> http://list.hw.cz/mailman/listinfo/hw-list
_____
avast! Antivirus <http://www.avast.com> : Odchozi zprava cista.
Virova databaze (VPS): 000749-2, 16.06.2007
Testovano: 16.6.2007 20:56:53
avast! - copyright (c) 1988-2007 ALWIL Software.
Další informace o konferenci Hw-list