PDA

View Full Version : pin assignment



cheznez
- 3rd February 2005, 15:38
i am programming a pic16f648 for the first time. in the manuel i found a statement that says the pin number has nothing to do with the physical pin number. How do I assign know which physical pin number will be used for each pin of a port

bartman
- 3rd February 2005, 16:02
Doesn't the datasheet show you what port numbers are assigned to what physical pin numbers? It's usually right near the front of the specific PIC datasheet.

Bart

Dwayne
- 3rd February 2005, 16:12
Hello Cheznez,

Chez>>i am programming a pic16f648 for the first time. in the manuel i found a statement that says the pin number has nothing to do with the physical pin number. How do I assign know which physical pin number will be used for each pin of a port<<

Most chips that I know of, have a little indent, or dot on the #1 pin of the chip, and you count clockwise or counter clockwise for the pin numer.

You have to look at the DATA sheet for the PIC chip you are using.

For example the chip has 8 pins.....

PortA has 8 pins, but for a ADC pin there may be 5 of them. Pins number 0,1,2,3,7. but on your Switch part of the program (the headers that tell the chip which pins you are using for ADC), It keeps them in order.

so activating a ADC would be like
ADCON1="00011111" 'Activating all 5 ADC's on pin 0,1,2,3,7

not

ADCON1="10001111"

Dwayne

mister_e
- 3rd February 2005, 16:37
If you refer to ident pin like for

HIGH PinNumber

as

HIGH 0

you'll find some information in the page 26 of the PBP manual.

BUT i'll prefer to use PIN NAME instead of pin number... more easy to read.

ex:

HIGH PORTB.0

Dwayne
- 3rd February 2005, 16:55
Hello Steve,

Steve>>BUT i'll prefer to use PIN NAME instead of pin number... more easy to read.

ex:

HIGH PORTB.0
<<

I agree Steve... Makes a heck of a lot easier to debug too. You are not constantly referring back to a previously assigned Pin Value.

I do the same with the header variables too. I realize that using certain functions will automatically assign a pin to a input or output, but I use (by habit) the Header assignments for safety sake <g>.

Dwayne