What is the Pin Number for PortE.1? on 18F458


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2004
    Posts
    46

    Default What is the Pin Number for PortE.1? on 18F458

    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

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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
    Last edited by mister_e; - 2nd June 2005 at 04:34.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Oct 2004
    Posts
    46


    Did you find this post helpful? Yes | No

    Default I don't think that works

    I tested the following code and it does not work.

    PortPin Var Byte
    Pin16 Var PortE.1

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

  4. #4
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Default

    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.

  5. #5
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I'll put money on the fact that you've not switched it into DIGITAL mode... PortE like PortA is muxed with the ADC...

  6. #6
    Join Date
    Oct 2004
    Posts
    46


    Did you find this post helpful? Yes | No

    Default Still a bit confused

    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

Similar Threads

  1. Is this a K Type sensor?
    By jessey in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 21st November 2009, 13:55
  2. DS1820 with 16f688
    By jessey in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 23rd May 2009, 05:07
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  4. Another RTC, DS1287
    By DavidK in forum Code Examples
    Replies: 0
    Last Post: - 12th December 2006, 17:07
  5. Keypad unlock (as in garage door possibly)
    By Fred in forum Code Examples
    Replies: 5
    Last Post: - 2nd April 2006, 04:26

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts