PDA

View Full Version : PIC16F887, turn off..



xobx
- 16th October 2007, 14:57
How do I turn off all A/D,timers and all the stuff on PIC16F887?

I know that ANSELH=0 turns of the A/D on PORTB but thers tons of extra on the other ports that i dont want..

sayzer
- 16th October 2007, 15:11
Cut the power supply !

:)

xobx
- 16th October 2007, 16:05
Cut the power supply !

:)

Thats one way but I want to know how to do it the other way.. (in the code)

sinoteq
- 16th October 2007, 17:20
Look at a PIC like a toolbox with lots of funny tools inside (they are acually hardware functions) Some of these functions are activated after a Power on Reset or similar event, other functions stays in the toolbox until you start to use them. You have already figured out how to turn off PORTB analog functions.

You 1--PIC 0

Next we have to worry about Comparators, they are normally a headache so look in the manual, page 87 under 8.6. As you can see a reset event turns this function off and because the PIC makes a POR when it starts this is taken care of.

You 1--PIC 1


Timers and other functions:
Look at other modules and see how they are tured on, look at page 26 Table 2.1 and figure out what the default startup setting is after POR. Table 2.1 shows how things are when the PIC is released from POR

If the module is not turned on by the PIC and you don't want to use it I see no reason at all to activate them, just let them be and they won't bother you. When you see a need for them just get them one by one and use them as you see fit.

The only thing left that can make serious trouble is Ocillator settings 4.0 make sure you read and understand this because this is the key module for all functions, no or wrong ocillator freq and you will not get anywhere nor will your program.

xobx
- 17th October 2007, 14:02
Ok, so this will turn off the Comparators?


CMxCON0
CM2CON1

And I have no idea how Table 2.1 works :/

mackrackit
- 17th October 2007, 16:34
Hi,
Have you read these?
http://www.picbasic.co.uk/forum/showthread.php?t=564
http://www.picbasic.co.uk/forum/showthread.php?t=561

Table 2-1 just tells the address and names of special function registers. Each is covered in the corresponding part of the data sheet. What one are you looking at?

sinoteq
- 18th October 2007, 02:39
Does not only show the name and address of each register,it does that ALSO. Look at Figure 2-4,2-5 and 2-6 they ONLY name and addresss information. The key with Table 2.1 is under the text "Value on POR,BOR" at the top of each table. Table 2-2,2-3,2-4 are similar but addresses different functions. It is only here we can figure out what settings the PIC has after a BOR or POR event. The safe way is to set all registers to a known value the first thing you do in your program or let the POR or BOR event make it for you. Or a combination of these......

If you do not know what functions are activated how can you turn them off?


Most people stick to one or two different PICs and use these for many different applications, because of this they learn what and what not to to..... Many times the hard way

Archangel
- 18th October 2007, 05:55
Does not only show the name and address of each register,it does that ALSO. Look at Figure 2-4,2-5 and 2-6 they ONLY name and addresss information. The key with Table 2.1 is under the text "Value on POR,BOR" at the top of each table. Table 2-2,2-3,2-4 are similar but addresses different functions. It is only here we can figure out what settings the PIC has after a BOR or POR event. The safe way is to set all registers to a known value the first thing you do in your program or let the POR or BOR event make it for you. Or a combination of these......

If you do not know what functions are activated how can you turn them off?


Most people stick to one or two different PICs and use these for many different applications, because of this they learn what and what not to to..... Many times the hard way
Hi sinoteq,
look in your Microchip mpasm suite folder for the PIC Chip number of your choice .inc file and open it. You will see the register names and syntax for using them, at least in as much as the correct names, I . E. things like . . . Configuration Bits, OSCON , PCON etc . . . Definately worth a look.
JS