PDA

View Full Version : What is the Pin Number for PortE.1? on 18F458



khufumen
- 2nd June 2005, 01:07
I want to access a Tx Pin using a number for the serout2 command instead of a variable name. any ideas? Couldn't understand the help screen which said
"Depending on the particular PICmicro, pin number 0 could be physical pin 6, 21 or 33, but in each case it maps to PORTB.0 (or GPIO.0 for 8-pin devices, or PORTC.0 for a PIC14C000) . Pins may be referenced by number (0 - 15)"

I am working with more than 15 pins

Eric

mister_e
- 2nd June 2005, 04:28
Simple solution then...
Pin16 var PORTE.0
Pin17 var PORTE.1

Select Case SerinData
Case 16
PortPin=Pin16

Case 17
PORTpin=pin17

End select

High Portpin

khufumen
- 2nd June 2005, 09:53
I tested the following code and it does not work.

PortPin Var Byte
Pin16 Var PortE.1

PortPin = Pin16
Serout2 PortPin , 16390, ["Hello World"]

Ingvar
- 2nd June 2005, 11:52
See if ......
Serout2 PortA.0[33] , 16390, ["Hello World"]
.... will output data on PortE.1. If it does you should be able to access all pins on your pic.

Melanie
- 2nd June 2005, 13:04
I'll put money on the fact that you've not switched it into DIGITAL mode... PortE like PortA is muxed with the ADC...

khufumen
- 2nd June 2005, 16:13
I have declared at the start of the code ADCON = 7 to switch Pins to digital mode. Now since the 18F458 is 40 Pin PIC perhaps the 7 is the wrong number.

I've run the following code and have noted what works and what doesn't below.


ADCON = 7
PortPin Var Byte
Pin16 Var PortE.1

PortPin = Pin16

Serout2 PortPin , 16390, ["Hello World"] ' this does not work

Serout2 Pin16 , 16390, ["Hello World"] ' this works

Serout2 Pin16 , 16390, [Dec Pin16] ' this spits out 0

Serout2 Pin16 , 16390, [Dec PortPin] ' this spits out 0