PortD on 18f4550 cofig pullup for switches


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    Dec 2004
    Location
    Scarborough UK
    Posts
    77


    Did you find this post helpful? Yes | No

    Red face

    Hi Steve

    I read the datasheet before i post my message :-/, to me the datasheet says that bit7 on port E set the pull-ups for portD on 18f4550 ?.

    Anyway, i could use portB,

    I want to have switches that can be active low and active high,

    can this be done without resistors ?

    thx :-)
    Reading the datasheet & understanding it are two different things.

  2. #2


    Did you find this post helpful? Yes | No

    Default Similar story

    I have read the data sheet and have set registers as below for 4550
    TRISA = %00111111'An 0-4
    TRISB = %00011111'An 8-12
    TRISC = %00000000'All output
    TRISD = %00000000'All output
    TRISE = %00000111'An 5-7
    ADCON1 = %00000000'A/D channel All
    ADCON2 = %10000011'Right justify for 10 bit
    INTCON2 = %10000000'Set to disable pullup on An 8-12?

    I cannot disable the weak pullups on portb, can someone please show me how this is done, is pbaden involved?

    Thanks

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


    Did you find this post helpful? Yes | No

    Default

    Ouch,mmm well , seems you're totally right, I totally missed that part, my apologies
    Each of the PORTD pins has a weak internal pull-up. A
    single control bit, RDPU (PORTE<7>), can turn on all
    the pull-ups. This is performed by setting RDPU. The
    weak pull-up is automatically turned off when the port
    pin is configured as a digital output or as one of the
    other multiplexed peripherals. The pull-ups are
    disabled on a Power-on Reset. The PORTE register is
    shown in Section 10.5 “PORTE, TRISE and LATE
    Registers”.
    PORTE.7=1 ' this will indeed enable pull-up on PORTD

    Intcon2.7=1 will disable the pull-ups as per the datasheet. (pdf page 102)

    Out of curiosity, why do you say that you're unable to disable the pull-ups? If you read some voltage from them, maybe you read some "parasitic voltage", and If I remember correctly, some of these I/O on PORTB are also set as analog at POR. See ADCON0 (p262)

    ADCON0=%00001111 ' turn of all ADCs

    You can also trick PORTB adc with the config fuses.
    Steve

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

  4. #4
    Join Date
    Dec 2004
    Location
    Scarborough UK
    Posts
    77


    Did you find this post helpful? Yes | No

    Talking

    Hi Steve,

    I always try the datasheets before I post a help request, the only problem with the datasheets is that they are quite technical and confusing to a dabbler like me who only program for fun.

    Anyway, I think i got the active low switch working now, the switch is connected to ground and port pin and it works,

    BUT, How do I get a switch to work active high now ?,

    I connect the switch to +5v and port pin (it trigger the switch once but do not go back low)

    how can i get this to work ? any ideas :-)
    Reading the datasheet & understanding it are two different things.

  5. #5


    Did you find this post helpful? Yes | No

    Default Analog input problems resolved

    Thanks for your/and others invaluable help in guiding me along.

    The faulty analog inputs an8, an9 and an12 when connected to a pot 0-5v would, when the applied voltage was reduced, indicate the correct voltage until the voltage went down to 1.5v. I then connected a milliamp meter in circuit with the analog input and measured a current of 1.6 ma. After reading the sbc44 manual I now believe these inputs cannot be used as analog inputs but can be used as digital i/o? I do however have 10 analog inputs that work correctly, as I shall be using lm35/ad22100 to measure temperatures, hopefully.

    PS I have now succeeded in getting pc vb2005 to usb pic4550 and believe I now understand how it works. Does upgrading to vb2008 express give any problems?

    Tom

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


    Did you find this post helpful? Yes | No

    Default

    Tom , VB2008 work as VB2005, but it has few less bugs and few new improvements.

    Assuming you might use EasyHid DLL, I can't tell how good, bad it will be for Vista or VB2008 as I no longer use that DLL.

    Check your ADCON0 setting, I already use all Analog channel on that one, and never got issues.

    Bonxy
    BUT, How do I get a switch to work active high now ?,
    Same thing, but you need a pull-down resistor instead of a pull-up.
    Steve

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

  7. #7
    Join Date
    Dec 2004
    Location
    Scarborough UK
    Posts
    77


    Did you find this post helpful? Yes | No

    Unhappy Try again

    Hi all

    Does anyone know how to read a switch connected to a port pin on 18f4550 (active high).

    eg: switch is connected between port pin and +5v

    without using an external pull-down resistor
    Reading the datasheet & understanding it are two different things.

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


    Did you find this post helpful? Yes | No

    Default

    Not recommended. A pin will 'float'... sometimes it might acquire a charge from internal capacitances and over a period of time you will read a High when earlier it was a Low.

    Use internal Pull-Up's where available and pull down with a switch externally for minimum component count. Try not to wire +5v to things like Switches and Sensors... especially if that same +5v supplies your PIC or other Logic... all you're doing is asking for noise to be induced into your Power Supply circuits which could then cause you grief elsewhere.

Similar Threads

  1. 18F4550 to 18F2550
    By mpardinho in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th September 2007, 23:13
  2. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30

Members who have read this thread : 0

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