Has anyone successfully written to OPTION register in 12F508?
This register is not recognized and has no address !
Has anyone successfully written to OPTION register in 12F508?
This register is not recognized and has no address !
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Hi,
Looks like you need to resort to a bit of assembly to get to it.Now, I truly suck at assembly but if I were to try anything it would probably be something like:The OPTION register is a 8-bit wide, write-only register, which contains various control bits to configure the Timer0/WDT prescaler and Timer0.
By executing the OPTION instruction, the contents of the W register will be transferred to the OPTION register.
A Reset sets the OPTION<7:0> bits./Henrik.Code:ASM MOVLW 128 ; Put 128 in W (enable weel pullup). OPTION ; Move content of W to OPTION ENDASM
Thanks Henrik,
I made a simple flip flop code; and even it did not work. So, I can not test whether your suggestion actually works or not.
There must be something specific with the programming of this chip.
Even though I get no error when programming, I can't get it work.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Is this the same kind of process that might be used to get the TOCKI on Portc.5 to be used as a gpio? Any ideas?
The datasheet says:
On power-up, TOCKI functionality is enabled in the OPTION register and must be disabled to allow RC5 to be used as general purpose I/O.
However, noplace does it state how to do that.
p.s.
That's on the 16f505 chip, not the 508
The OPTION register is accessed the same as any other 16F. PBP translates it to an assembly OPTION command on 12-bit cores.
To use RC5 as an output pin, use ...
Code:OPTION_REG.5 = 0
DT
Thanks Darrell, worked like a charm. Options are not so clear in the documentation.
Bookmarks