Autor Tema: TMR0  (Leído 3265 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado isabelino

  • Colaborador
  • PIC16
  • *****
  • Mensajes: 139
TMR0
« en: 03 de Noviembre de 2002, 19:35:00 »

Hola a todos: deseo leer el prescaler del PIC16F84A para hacer una medición de tiempo. Puedo leer el TMR0 en cualquier momento, ¿pero cómo leo el valor del prescaler?
Desde ya muchas gracias.

Desconectado RGL

  • Colaborador
  • PIC24F
  • *****
  • Mensajes: 634
RE: TMR0
« Respuesta #1 en: 04 de Noviembre de 2002, 02:30:00 »
Hola isabelino,

Normalmente lo que yo he visto programar para contar tiempo se suele hacer poniendo un valor en el timer y mirar el flag de éste hasta que pase el valor del timer de FF a 00, en ese momento el flag T0IF pasa a valer 1. Si lo que quieres contar excede de un valor de 255, entonces cuentas cuantas veces ha pasado por cero el timer y ya está. Supongo que habrá otras formas pero esto es lo que yo he visto que hace la gente.

Saludos
Ricky

Desconectado todopic

  • Administrador
  • DsPIC30
  • *******
  • Mensajes: 3495
    • http://www.todopicelectronica.com.ar
RE: TMR0
« Respuesta #2 en: 04 de Noviembre de 2002, 11:29:00 »
Hola Isabelino, el TMR0, podes escribirlo , borrarlo o leerlo como cualquier registro.... pero el PREESCALER, solo se Asigna un valor, y no se lee ni escribe...
se asigna empleando el registro OPTION., qeu si miras el manual del 16F84 dice....


2.3.2 OPTION REGISTER
The OPTION register is a readable and writable
register which contains various control bits to configure
the TMR0/WDT prescaler, the external INT interrupt,
TMR0, and the weak pull-ups on PORTB.
REGISTER 2-2: OPTION REGISTER (ADDRESS 81h)
Note: When the prescaler is assigned to
the WDT (PSA = ’1’), TMR0 has a 1:1
prescaler assignment.
R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1
RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0
bit 7 bit 0
bit 7 RBPU: PORTB Pull-up Enable bit
1 = PORTB pull-ups are disabled
0 = PORTB pull-ups are enabled by individual port latch values
bit 6 INTEDG: Interrupt Edge Select bit
1 = Interrupt on rising edge of RB0/INT pin
0 = Interrupt on falling edge of RB0/INT pin
bit 5 T0CS: TMR0 Clock Source Select bit
1 = Transition on RA4/T0CKI pin
0 = Internal instruction cycle clock (CLKOUT)
bit 4 T0SE: TMR0 Source Edge Select bit
1 = Increment on high-to-low transition on RA4/T0CKI pin
0 = Increment on low-to-high transition on RA4/T0CKI pin
bit 3 PSA: Prescaler Assignment bit
1 = Prescaler is assigned to the WDT
0 = Prescaler is assigned to the Timer0 module
bit 2-0 PS2:PS0: Prescaler Rate Select bits
000
001
010
011
100
101
110
111
1 : 2
1 : 4
1 : 8
1 : 16
1 : 32
1 : 64
1 : 128
1 : 256
1 : 1
1 : 2
1 : 4
1 : 8
1 : 16
1 : 32
1 : 64
1 : 128
Bit Value TMR0 Rate WDT Rate



Espero lo entiendas... ok, cualquier cosa, consulta

Firmat - Santa Fe - Argentina

www.TodoPic.net

Solo se tiran piedras, al arbol que tiene frutos...


 

anything