PIC18EXT.BAS Alteration


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Apr 2008
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Digital inputs

    Not using USB, just want to use them as digital inputs, for some flow sensors. Setting UCON = %00000000.

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


    Did you find this post helpful? Yes | No

    Default

    Code and config fuses will help
    Steve

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

  3. #3
    Join Date
    Apr 2008
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Config Settings for non-USB

    The only config setting i see that affects USB is VREGEN. Does this have to be off for the USB to be disabled. From what i read in the data sheet only UCON.3 needs to be turned off to change PortC.4 & 5 to digital.

    I am using Micro Code Studios boot loader, do you know if they preset bits in the config to enable USB?

    RD

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rdheiliger View Post
    The only config setting i see that affects USB is VREGEN. Does this have to be off for the USB to be disabled. From what i read in the data sheet only UCON.3 needs to be turned off to change PortC.4 & 5 to digital.

    I am using Micro Code Studios boot loader, do you know if they preset bits in the config to enable USB?

    RD
    Seems the loader enable it... but it's not the problem... you also have to set the UCFG register to Disable the On-Chip Transceiver.

    Code:
    UCFG.3=1
    this way it works.
    Steve

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

  5. #5
    Join Date
    Apr 2008
    Posts
    10


    Did you find this post helpful? Yes | No

    Thumbs up Ucfg.3=1 And Ucon.3=0 Works

    Thank You!!

    Adding both

    UCON var byte EXT
    UCFG var byte EXT

    to PIC18EXT.BAS

    and adding

    UCFG.3=1
    UCON.3=0

    to the code lets PortC.4 and PortC.5 on the 18F2455 operate as inputs.


    Now i can sleep tonight!!!!!!!!!!!!!

    RD

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


    Did you find this post helpful? Yes | No

    Default

    Actually UCON=0 at power up, so you shouldn't need that line... but who knows... it's never a bad idea to set all registers.

    Good night
    Last edited by mister_e; - 7th April 2008 at 01:41.
    Steve

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

  7. #7
    Join Date
    Apr 2008
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Input Cross Talk

    Couldn't go to bed before i hooked up the pulse inputs.

    When i hook up the pulse input to PortC.5 i get pulses on PortC.5 and not on PortC.4.

    When i hook up the pulse input to PortC.4 i get counts on PortC.4 and PortC.5 as well.

    The traces are paralell for awhile but if i was getting cross talk between traces i would think it would be in both directions. But its not. I can eliminate everything in the program that refers to PortC.4, put pulses into PortC.4 and still get pulses on PortC.5. There are no shorts between the traces or anything else on the board. It appears to be internal to the ports.

    I did notice that these two ports do not have smitt triggers as most other inputs do. Can this have some thing to do with it.

    Also there are internal pullups on these two inputs. I supposedly disabled them by setting UCFG.4 to 0 as well.

    My pulse input is from a hall effect switch with a 1K pull up resistor.

    Any thoughts????

    RD

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


    Did you find this post helpful? Yes | No

    Default

    If you were getting compile errors regarding UCON, then the USB library is probably being included without you realizing it. Your program most likely compiles to a size that seems much larger than it should.

    If the file you are compiling is in the same folder as another USB project, then the USB library may be included automatically.

    Or if the 18F2455.bas in the PBP folder has been modified for USB it will do the same thing from any folder.

    If it is in the same folder as another USB project? Move it to it's own separate folder.

    If it's already in it's own folder? Check the 18F2455.bas file in the PBP folder. You should see this in the file...
    Code:
    BANKA   $0000, $005F
    BANK0   $0060, $00FF
    BANK1   $0100, $01FF
    BANK2   $0200, $02FF
    BANK3   $0300, $03FF
    BANK4   $0400, $04FF
    BANK5   $0500, $05FF
    BANK6   $0600, $06FF
    BANK7   $0700, $07FF
    'EEPROM  $F00000, $F000FF
    LIBRARY "PBPPIC18"
    'LIBRARY "PBPUSB18"
    The PBPPIC18 line should NOT be commented, and the PBPUSB18 line should be commented.

    If you are using PBPL, then look in the 18F2455.BAL file instead.

    hth,
    DT

Similar Threads

  1. Elapsed_Int-18 Alteration
    By Rob in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 31st January 2008, 12:51

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