I thought PORTA.0[33] was the same as PORTE.1 ?!?


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    blainecf's Avatar
    blainecf Guest

    Question I thought PORTA.0[33] was the same as PORTE.1 ?!?

    Any Ideas???


    SERIN2 PORTE.1, 49236, [Commbyte]

    SERIN2 PORTA.0[33], 49236, [Commbyte]

    The first line works perfectly, the second line doesn't work at all.

    I have multiple lines that I'm getting comm signals from, and I need to select them with an index variable. Everywhere else in the program I'm able to use these two concepts interchangeably, except with SERIN2 (and, SEROUT2, I think). I've tried brackets and parenthesis - no help.

    My alternative is to write 8 separate sets of code, one for each I/O line

    Any brilliance would be appropriately lavished.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Hi blaine,

    Confusing, isn't it?

    With the PORTA.0[33], it's actually doing an array operation.

    It will Read PORTE.1 which is either a 0 or 1, then it will SERIN from either PORTB.0 or PORTB.1, depending on the PORTE.1 value.

    There is a way to do what you're after, but it depends on 1 thing.

    Have you used any "Numbered Ports" anywhere else in your program?

    Numbered Ports would be anything like...

    LOW 1
    HIGH 7
    SERIN2, 15, ...

    P = 6
    LOW P

    etc. etc.
    DT

  3. #3
    blainecf's Avatar
    blainecf Guest

    Unhappy Good or bad, I'm NOT using numbered ports

    I'm really hoping you have a solution. Please enlighten...

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    It depends on what pins the serial data is coming in on too, hopefully they are all on only 2 PORTS.

    Here's the idea.

    In your PBP folder, open the .BAS file associated with the chip you are using. You'll see these variables.

    PORTL VAR PORTB
    PORTH VAR PORTC
    TRISL VAR TRISB
    TRISH VAR TRISC


    They are the Starting locations for the Numbered Ports.

    For 0-7 it uses PORTL and TRISL
    for 8-15 it uses PORTH and TRISH

    These can actually be assigned 2 different ports. You could have PORTL on PORTA, and PORTH on PORTE. Then 0-7 would be PORTA, and 8-15 would be PORTE.

    DO NOT just edit the file. Comment out the lines, and declare the PORTs in your main program. This way when you write another program for that chip, the compiler will remind you that the file has been changed.

    After that there are many ways to handle the numbers. But it's something like this.

    PORTH VAR PORTE
    TRISH VAR TRISE

    P = 9 ; PORTE.1
    SERIN2 P, 49236, [Commbyte]

    Last edited by Darrel Taylor; - 19th July 2006 at 21:53. Reason: .
    DT

  5. #5
    blainecf's Avatar
    blainecf Guest

    Default No such luck

    D:

    Thanks for the info, but I'll need another solution for my application. I'm using pins scattered across B, C, D, and E ports. For now I've hard-coded individual SELECT CASE statements for each comm group for both SERIN2 and SEROUT2 commands... yuk!

    Too bad you can't alias individual array elements to user-defined pins. That would be sweet.

    Any other suggestions out there??????????

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Ok, then one more question.

    16F or 18F?

    DT

Similar Threads

  1. More space than I thought !!!
    By keithdoxey in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th August 2006, 20:04
  2. 16F88 is not the dream device I thought it was.
    By keithdoxey in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 25th October 2005, 21:19
  3. What is the Pin Number for PortE.1? on 18F458
    By khufumen in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 2nd June 2005, 16:13

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