PIC18EXT.BAS Alteration


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    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 00:41.
    Steve

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

  2. #2
    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

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


    Did you find this post helpful? Yes | No

    Default

    Weird... work perfectly here with 10K external pull-up (EasyPIC 4) but push-buttons... big deal... While i'm still awake, could you post your code so i can test it here?

    Maybe not a bad idea to start a new thread as it's a out of topic from the original.

    PS: for your tests.. did you left one or the other pin floating or you had a pull-up attach to?
    Last edited by mister_e; - 7th April 2008 at 04:26.
    Steve

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

  4. #4
    Join Date
    Apr 2008
    Posts
    10


    Did you find this post helpful? Yes | No

    Default pulse in code

    this is part of a pretty large program.

    the code for the alias'

    SCLK var PortC.0
    ColPump var PortC.1
    RadPump var PortC.2
    RadFlowInput var PortC.4
    ColFlowInput var PortC.5
    SerRecieve var PortC.6
    SerTransmit var PortC.7

    this is the code to read pulse width:

    gosub checksw
    if colflocal > 0 then 'if have a calibration number, read the collector sensor
    pulsin colflowinput,0,colflo
    colfloacc = colfloacc + colflo
    endif
    gosub checksw
    if radflocal > 0 then 'if have a calibration number, read the radiant heat sensor
    pulsin radflowinput,0,radflo
    radfloacc = radfloacc + radflo
    endif
    gosub checksw

    i am averageing over 10 scans then writing the colflowacc and radfloacc to an lcd

    don't stay up too late.

    RD

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


    Did you find this post helpful? Yes | No

    Default

    in meantime try something,
    1 reload the BootLoader firmware and disable the USB voltage generator config fuse,
    2 load it in your PIC and dump your program in ...
    3 see if it change anything...

    Also try on another set of pin... i may think of few thing when using PULSIN on those specific pin....
    Last edited by mister_e; - 7th April 2008 at 04:44.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    I'm unable to reproduce the issue here...
    Code:
            RadFlowInput var PortC.4
            ColFlowInput var PortC.5
    
            ColFlow var word
            RadFlow var word
    
            pause 500
            hserout ["Testing...",13,10]                
    
    start:        
            pulsin colflowinput,0,colfloW
            pulsin radflowinput,0,radfloW
              
    
            hserout ["    PORTC.4=",DEC rADFLOW,_
                     "    PORTC.5=",DEC cOLFLOW,13,10]
    
            GOTO START
    Seems to be a hardware problem... if you have any schematic and part#, that would be handy.
    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 Hardware

    I did try turning off the USB voltage. Same result.

    I was leaving PortC.5 floating when running the pulses into PortC.4 and vice versa. By tying PortC.5 low or high thru a 1K resistor the problem does go away. Interesting that i don't have to tie PortC.4 low when putting pulses into PortC.5.

    Will get another pulse input set up tomorow and see if the problem goes away.

    I am using a water flow sensor that counts pulses of a magnetic rotor passing a hall effect switch. Am blowing air thru the sensor to test. Am assuming you are using a push button??

    The board is my own design. It is intended as a solar collector control and monitor. This is about the last bug to have it all working.

    Will let you know tomorow, if having both sensors connected works.


    Thanks for the help!!

    RD

Similar Threads

  1. Elapsed_Int-18 Alteration
    By Rob in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 31st January 2008, 11: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