casova konstanta
Libor
libor@netron.cz
Neděle Červen 24 16:28:04 CEST 2007
Nejak mi to nepocita.....
Krystal jsem dal 4096
program takovyto
void interrupt() {
timeticks++;
INTCON = 0x20; // Set T0IE, clear T0IF
}
main
OPTION_REG = 0x00;
INTCON = 0xA0; // Enable TMRO interrupt
jedna sekunda by mela byt timeticks=4000 , ale zati m mi 4000 casove
vychazi pres 2 sekundy.
Diky za radu...
LK
Marek Pavlu wrote:
> 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.
>
>
>
> _______________________________________________
> HW-list mailing list - sponsored by www.HW.cz
> Hw-list@list.hw.cz
> http://list.hw.cz/mailman/listinfo/hw-list
>
> __________ Informace od NOD32 1.1743 (20060907) __________
>
> Tato zprava byla proverena antivirovym systemem NOD32.
> http://www.nod32.cz
>
>
>
>
Další informace o konferenci Hw-list