How to determin default pin settings for PIC

Status
Not open for further replies.

fuper

New Member
Hey - I have a pickit2 and a PIC16F690. I've been trying to figure out [by reading the datasheet] what the default pin configuration.

I was taking the standard blink program which was using I believe [I'm at work don't have everything] PORTB to toggle the led on/off.

I figured OK a good starting point would be to use PORTC and see if I could get the helloworld working. Nada. I finally found a counter example where they said some pins have dual use so make sure you clear/set the proper setting when you start. Makes sense. I have been reading through the data sheet and either don't know what to look for or just cannot find the default pin settings?

I could resort to experimentally turning on/off ADC, Comparators or whatever else might be doubled down but it would seem that I *should* be able to read this someplace?
 
Hi,

Well your first lesson is that Microchip datasheets are a terrible place for the beginner as they do not give the info in an easy to understand way.

What you are looking for is first the I/O Port A section which give an example of how to initialise the ports.

Your point about finding out what the Power On Defaults, its the Resisters like PORTA, TRISA ,ANSEL that set the defaults - you can see them in Table2 page 32 of the datasheet

If you are using the 16F690 and Pk2 do you have the Low Pin Count tutorial that usually comes with the MicroChip starter kit ? - it has lessons with complete projects to help you get going - have attached the pdf here, you can download all the project code from the Microchip site.
 

Attachments

  • Low Pin Count User Guide DS51556a.pdf
    452.6 KB · Views: 233
But don't worry, each chapter describes a peripheral or feature, in the same chapter they provide the code example. The problem is that before you start with your PIC you should read all the datasheet... This is due the way the datasheet is made, they really want you to read most the information they provide.
 
This gets me where I need to go!

Okay I see what you mean, this document does explain things step by step. You know guys and directions

Thanks!

 
Table 2-1, page 20, of the 16F690 displays the power up states of the pins. Remember that PIC pins often come up in their analog state, as a default.

Review section 4 on the setup of TRIS and PORT commands to move to digital states.

Typically, you need to turn off the comparator and analog to digital converter to make the pins digital. As you move up the chain of PIC's the options become more complex.

The best way to start is with the simulator. Program your pins and step through the program to see if the commands for TRIS and PORT give you expected results.

All the mid-level PIC manuals are organized in the same manner. Once you are familiar with one, the others follow suit.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…