Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

OPTION register set to 0 problems?

Status
Not open for further replies.

GraveYard_Killer

New Member
im using C compiler for PIC.
at the start of my program there is this line

void main(void){
set the option register to 0
set INTCON to 0
set of commands follows here
set of commands follows here
set of commands follows here
set of commands follows here
...
...
...
}

it simulates ok. but when i tried it with the real hardware, it didnt work.








when i tried to set option register to 0xFF like this:
void main(void){
set the option register to 0xFF
set INTCON to 0
set of commands follows here
set of commands follows here
set of commands follows here
set of commands follows here
...
...
...
}

the program worked.

im just curious why it doesnt work when option register is set to 0? thanks in advance.
 
It depends really what your C compiler is doing?, but there is a PIC register named 'option', which is used to set tmr0, the prescaler, pullups on portb, and interrupts on portb.

But your compiler instructions should explain about it!.
 
Status
Not open for further replies.

Latest threads

Back
Top