PotatoPeeler
Newbie level 2
Hello I am a student that are a complete novice.
I have written a code in Assembler that works, except for one thing.
The offset value that I have entered for TMR0 never appears in TMR0 if I simulate! So I am doing it wrong.
I am using P16F84A (Use MPLAB and PIC Simulator to write code.).
I am using TMR0 is timer and not the WDT.
If have never noticed before that my offset values are not entered in TMR0; because I have only had to work with very small offset values, so I didn't notice errors. I can not find anything on the net to explain how to enter offset correctly.
Here is part of my code with an example of how I entered all my offset values:
START BSF STATUS,RP0
CLRF TRISA ;Make all outputs
CLRF TRISB ;Redandant part.
MOVLW B'00010110' ;INPUTS RB1, RB2 AND RB4!
MOVWF TRISB
MOVLW B'10000001'
MOVWF OPTION_REG ; Redundant part
MOVLW B'10101000'
MOVWF INTCON ;Interupt Setup
BCF STATUS,RP0
CLRF PORTA
CLRF PORTB ;PORT A & B start at 0
BSF STATUS,RP0
MOVLW B'10000001'
MOVWF OPTION_REG ;PRESCALER=4
BCF STATUS,RP0
MOVLW B'00001000' ;******This part doesnt work!
MOVWF TMR0 ;******OFFSET=8
MAIN GOTO MAIN
END
I have written a code in Assembler that works, except for one thing.
The offset value that I have entered for TMR0 never appears in TMR0 if I simulate! So I am doing it wrong.
I am using P16F84A (Use MPLAB and PIC Simulator to write code.).
I am using TMR0 is timer and not the WDT.
If have never noticed before that my offset values are not entered in TMR0; because I have only had to work with very small offset values, so I didn't notice errors. I can not find anything on the net to explain how to enter offset correctly.
Here is part of my code with an example of how I entered all my offset values:
START BSF STATUS,RP0
CLRF TRISA ;Make all outputs
CLRF TRISB ;Redandant part.
MOVLW B'00010110' ;INPUTS RB1, RB2 AND RB4!
MOVWF TRISB
MOVLW B'10000001'
MOVWF OPTION_REG ; Redundant part
MOVLW B'10101000'
MOVWF INTCON ;Interupt Setup
BCF STATUS,RP0
CLRF PORTA
CLRF PORTB ;PORT A & B start at 0
BSF STATUS,RP0
MOVLW B'10000001'
MOVWF OPTION_REG ;PRESCALER=4
BCF STATUS,RP0
MOVLW B'00001000' ;******This part doesnt work!
MOVWF TMR0 ;******OFFSET=8
MAIN GOTO MAIN
END