Микроконтролери и електроника
http://mcu-bg.com/mcu_site/

18F452 - 16 bit TMR0 ???
http://mcu-bg.com/mcu_site/viewtopic.php?f=7&t=2812
Страница 1 от 1

Автор:  me40 [ Съб Авг 26, 2006 12:07 am ]
Заглавие:  18F452 - 16 bit TMR0 ???

Здравейте ! Купих си PIC микроконтролери II част (млад конструктор) с идеята да се опитам да понауча малко за пиковете. Изтеглих си MPLAB и с негова помощ забелязвам, че TMR0 работи като 8 bit брояч, въпреки избраният от мен режим - 16 bit. Ето как:

MOVLW b'10000000'
MOVWF T0CON
MOVLW 0xFF
MOVWF BR
E1 DECF BR,1
GOTO E1

При следене състоянието на TMR0L и TMR0H забяляввам, че когато TMR0L=FF следва TMR0L=00, a ТМР0H не се променя !!! Не би ли следвало TMROH да се промени ???

Моля по-напредналите за помощ ! Къде точно бъркам ?

Автор:  Syrius-B [ Съб Авг 26, 2006 1:15 am ]
Заглавие: 

Старшия байт не е директно достъпен
Прочети си дата шиита

TMR0H is not the high byte of the timer/counter in
incrementing of Timer0 after synchronization.
16-bit mode, but is actually a buffered version of the
high byte of Timer0 (refer to Figure 10-2). The high byte
10.2 Prescaler
of the Timer0 counter/timer is not directly readable nor
writable. TMR0H is updated with the contents of the
An 8-bit counter is available as a prescaler for the Timer0
high byte of Timer0 during a read of TMR0L. This pro-
module. The prescaler is not readable or writable.
vides the ability to read all 16-bits of Timer0 without
The PSA and T0PS2:T0PS0 bits determine the
having to verify that the read of the high and low byte
prescaler assignment and prescale ratio.
were valid due to a rollover between successive reads

A write to the high byte of Timer0 must also take place
module, prescale values of 1:2, 1:4,..., 1:256 are
through the TMR0H buffer register. Timer0 high byte is
selectable.
updated with the contents of TMR0H when a write
When assigned to the Timer0 module, all instructions occurs to TMR0L. This allows all 16-bits of Timer0 to be
writing to the TMR0L register (e.g., CLRF TMR0, updated at once.

Автор:  Ки4о [ Съб Авг 26, 2006 7:23 am ]
Заглавие: 

Същото го прави и при PIC18F2320 -задаваш да е 16 bit,на симулатора работи като 8 битов,но на платката - като 16.

Автор:  me40 [ Съб Авг 26, 2006 5:35 pm ]
Заглавие: 

Благодаря за отг. Прочетох ...остава да експериментирам :-) !!!

Страница 1 от 1 Часовете са според зоната UTC + 2 часа [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/