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 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

  2. #2
    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 05:44.
    Steve

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

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

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

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


    Did you find this post helpful? Yes | No

    Default Great!

    Your welcome! you could still use HPWM for your tests... this one have 2 channel.. just play with duty cycle and hop.. you're in business.

    I also tried to left a pin floating but didn't had any problem.. must be because i use a development board and not a breadboard

    But... on the other side, i don't see your full code, maybe somewhere you write to PORTC.x and it cause some "extra noise". BTW if you want to write to a single pin, consider LATx register instead of PORTx. Maybe you already know it?
    Last edited by mister_e; - 7th April 2008 at 06:59.
    Steve

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

  6. #6
    Join Date
    Apr 2008
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Both sensors

    Hooked up both pulse sensors this morning. No crosstalk. Will have to see if i can sqeeze in a ground trace between the two pulse traces on the next board evolution.

    Thanks again, the USB settup on these chips is more than a bit confusing.

    RD

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