Can I combine outputs for more current?


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    jswayze's Avatar
    jswayze Guest


    Did you find this post helpful? Yes | No

    Default

    Here is my code for the whole program. Basically it switches two outputs based on the pulse width of two incoming signals.

    Code:
    ' ---------------------------------------------
    ' Define aliases to the LED ports
    ' ---------------------------------------------
    PWM1 var GPIO.0
    PWM2 var GPIO.1
    IO1A var GPIO.2
    IO1B var GPIO.5
    IO2 var GPIO.4
    
    
    PwmCount1 var byte               ' Count number of cycles for PWM1
    PwmCount2 var byte               ' Count number of cycles for PWM2
    
         INTCON.6=0                 ' Disable all unmasked Interrupts
         INTCON.7=0                 ' Disable Global Interrupts
         CMCON = 7
      
        '------------------------------
        ' Main program starts here
        '------------------------------
    
        input PWM1
        input pwm2
    output IO1A
    output IO1B
    output IO2
        
        pwmcount1 = 0            ' Initialize PWM counter variables
        pwmcount2 = 0       
    
    MAIN:  
    
    pulsin pwm1,1,PwmCount1
    PULSin pwm2,1,PwmCount2
    if Pwmcount1 > 140 then
       IO1A = 1
       IO1B = 1
       else
            IO1A = 0
            IO1B = 0
    endif
    
    if Pwmcount2 > 140 then
       IO2 = 1
       else
           IO2 = 0
    endif
                  
            goto MAIN   'endless loop
    
    END
    I will try switching IOA and IOB simultaneously and see if that works.

    Thanks,

    Jeff

  2. #2
    jswayze's Avatar
    jswayze Guest


    Did you find this post helpful? Yes | No

    Default

    Actuating the two output simultaneously seems to have done the trick. I used "GPIO = GPIO and %00100100" to turn them on and everything works as expected now.

    I have another general question regarding power switching, but I'll open a new thread. Thanks for the help!

    Jeff

Similar Threads

  1. Reducing PIC current to as low as possible...
    By FromTheCockpit in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th November 2009, 04:28
  2. Replies: 8
    Last Post: - 5th May 2009, 20:10
  3. current sensor interfacing
    By hell_pk in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th January 2009, 04:55
  4. 16F628A current high during sleep
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 9th October 2006, 10:21
  5. Current Meter
    By mikefox in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 18th September 2006, 06:15

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