• AVR Freaks

Setting LATE or PORTE or TRIS E

Author
Malibow
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2009/09/21 09:05:48
  • Location: 0
  • Status: offline
2010/02/16 11:43:54 (permalink)
0

Setting LATE or PORTE or TRIS E

Hello i have a problem,

i am using MPLAB 8.40
with PIC18LF4550

when I try to change TRISE LATE or PORTE Register

i try to initialize the port with:

    ADCON1 = 0b1111;            //SET all Analogchannel to Digital I/O
    TRISEbits.TRISE0 = 0;            //Make LED PINS as OUTPUTPINS
    TRISEbits.TRISE1 = 0;            //Make LED PINS as OUTPUTPINS
    TRISEbits.TRISE2 = 0;            //Make LED PINS as OUTPUTPINS
    LATEbits.LATE0 = 0;            //Switch OFF LED
    LATEbits.LATE1 = 0;            //Switch OFF LED
    LATEbits.LATE2 = 0;            //Switch OFF LED


but changing the ports doesnt have any effect. its PORTE is always zero, LATE is always zero, and TRISE is always zero. although i tried to change the registers to 1.
can anybody help me?


#1

4 Replies Related Threads

    jw
    Senior Member
    • Total Posts : 122
    • Reward points : 0
    • Joined: 2005/11/19 04:26:01
    • Status: offline
    RE: Setting LATE or PORTE or TRIS E 2010/02/17 02:07:06 (permalink)
    0
    Have you noticed the following note on page 125 of the data sheet DS39632E?
    Note: On a Power-on Reset, RE2:RE0 are
    configured as analog inputs.


    Any pin which is configured as analog input will always be read as "0". Such pins must first be declared as digital I/O.

    Juergen
    #2
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    RE: Setting LATE or PORTE or TRIS E 2010/02/17 09:56:50 (permalink)
    0
    Yeah, but OP is making them "output".. so TRISE is correctly 0

    GENOVA :D :D ! GODO
    #3
    jw
    Senior Member
    • Total Posts : 122
    • Reward points : 0
    • Joined: 2005/11/19 04:26:01
    • Status: offline
    RE: Setting LATE or PORTE or TRIS E 2010/02/17 10:24:28 (permalink)
    0
    That is correct. But a read-modify-write instruction would still give problems since all pins configured as analog inputs will always be read as '0', independent of the TRIS-settings.

    Anyway, I just noticed that the OP has set the pins to digital I/O. I did not read his code snippet carefully enough. Sorry.

    Juergen
    #4
    Malibow
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2009/09/21 09:05:48
    • Location: 0
    • Status: offline
    RE: Setting LATE or PORTE or TRIS E 2010/02/17 10:35:02 (permalink)
    0
    Problem Solved.

    i am programming the PIC18LF4550 in dedicated Mode;
    so i have to connect PIN NC/ICPORTS to VDD. without connecting this pin.
    PIC18LF4550 is emulating a 28 pin device.
    #5
    Jump to:
    © 2019 APG vNext Commercial Version 4.5