Problem : Picbasic Pro and TMR0.

Status
Not open for further replies.

Jum

Junior Member level 2
Joined
Dec 23, 2001
Messages
20
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
83
I would like to know like I can assign value to TMR0 using the picbasic. Se puede asignar usando TMR0=200?.


' Define puertos A y B.
TRISA =%00000000 ' Todas las lineas como entrada.
TRISB =%00001100 ' Todas las lineas como salida.
TRISC =%00000000

' Define variables del sistema
dato VAR WORD
conta VAR BYTE

' Comienza programa.

PORTA=0
PORTB=0
PORTC=1

'Set TMR0 to interrupt every 16.384 milliseconds
tmr0 = 61
OPTION_REG = %01010111 ' Set TMR0 configuration and enable PORTB pullups
INTCON = $a0 ' Enable TMR0 interrupts
ON Interrupt GoTo timerint

inicio:
GoTo inicio

Disable
timerint:
conta = conta + 1
IF conta = 20 Then
conta = 0
Toggle PORTB.3
tmr0 = 61
EndIF
Resume
Enable

End

This program doesn't work. If I modify the you line that they put TMR0=61 and I eliminate them it works correctly. Does somebody know that it happens?

jum_spain@hotmail.com
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…