That information is already in the datasheet.
For the 16F916 you are using, look at Table 2-1 (page 17)
It has the POR/BOR and "Other" reset defaults for every register.
That information is already in the datasheet.
For the 16F916 you are using, look at Table 2-1 (page 17)
It has the POR/BOR and "Other" reset defaults for every register.
DT
Yeah, but that table does not explicitly state the POR for each pin. It just lists what each pin CAN DO, not what it wakes up to without tweaking registers.
I want a clear explicit list of the defaults, it would sure make my life simpler!
"Do or do not, there is no try" Yoda
The two columns on the right of that table show the Power-On state of every bit in every register.
The registers control the peripherals.
The peripherals are multiplexed with the Pins.
The peripherals are all OFF (except for comparators).
The pins are tri-stated (OFF).
What else do you need?
Last edited by Darrel Taylor; - 20th October 2011 at 18:32.
DT
I guess what I want is something more readable and less abstract. Sure that chart contains the info - but not in a very user friendly format. Maybe you (and others) find that chart fills your needs, it just does not work for me. But I will make a point of trying to study this chart in future.
"Do or do not, there is no try" Yoda
So my header wizard should only flip the bits needed that are not correct on POR. Got it. Then will you like it?
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Tekart, I by no means ment to hinder your rant, ranting is fun sometimes. I do find it kinda funny that this thread shows very clearly what my wife has been saying for years - I don't need you to solve the problem, just listen to it!!
So here you started ranting for what was clearly something very annoing for you, Charles jumped in with how he hate it, and how he deals with it. I threw in my 2 cents, but with more advice on how I deal with it. Then Darrel comes along and points out where the information you seek is located on the DS.
I shudder to suggest this, but I can ALMOST see my wifes point (not admiting she ever has one mind you)
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Darrel, I see that you "highly dislike" my method. That's OK. My code still runs.
It takes up code space, but I don't mess with chips with 1K of FLASH.
I start out with a large list and eliminate lines as I need until I get it down to just what I need in the end. By the time I have used a chip 4-5 times, I'm left with 10 lines of configs or so. In the meantime, I have learned a lot about what the chip can do.
Charles Linquist
Charles,
I see Darrel's point. But in my case if I were to use your "shotgun" approach I would worry about accidentally setting up conflicting registers. In fact I just did that today. I thought I had set a port to all digital I/O by disabling comparators AND configuring the A/D properly, but I accidentally set a bit that I did not need to in the ADCON0 register and it took me an hour to see my error.
cncmachineguy,
Listening to the question is good, as is reading answers from Darrell.
My wife and I have an agreement "I am always right - unless she's right"!What would we do with out our wives?
![]()
"Do or do not, there is no try" Yoda
If I set up conflicting registers, my code doesn't run and I go back and fix them like I would anything else. I have had mysterious problems from time to time that were traced to the fact that I SHOULD have set a register, but didn't. Once everything is working,
I carefully start removing the setups in small groups, all the while noting what the defaults are. If everything keeps on working, I
can remove more at my pace. If not, I go back and see why. I use only about 4 chips. None of my headers contains more than about 10 lines of setup - now.
Charles Linquist
Bookmarks