View Full Version : 12F508 OPTION Register
sayzer
- 14th October 2012, 13:55
Has anyone successfully written to OPTION register in 12F508?
This register is not recognized and has no address !
HenrikOlsson
- 14th October 2012, 16:21
Hi,
Looks like you need to resort to a bit of assembly to get to it.
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.
Now, I truly suck at assembly but if I were to try anything it would probably be something like:
ASM
MOVLW 128 ; Put 128 in W (enable weel pullup).
OPTION ; Move content of W to OPTION
ENDASM
/Henrik.
sayzer
- 15th October 2012, 07:35
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.
Agent36
- 12th January 2013, 17:28
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:
ASM
MOVLW 128 ; Put 128 in W (enable weel pullup).
OPTION ; Move content of W to OPTION
ENDASM
/Henrik.
Thanks Henrick, that assembly code helped me out with the 12f508. You have to TAB in once then write the code to remove errors.
GPIO.2 and 3 work fine now. Cheers Nick
Meriachee
- 12th January 2013, 18:32
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.
Meriachee
- 12th January 2013, 18:33
p.s.
That's on the 16f505 chip, not the 508
Darrel Taylor
- 12th January 2013, 20:35
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 ...
OPTION_REG.5 = 0
Meriachee
- 13th January 2013, 00:00
Thanks Darrell, worked like a charm. Options are not so clear in the documentation.
Powered by vBulletin® Version 4.1.7 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.