How can I speed this code up? SHIFTOUT is slowing it down and I need a faster way.


Results 1 to 30 of 30

Threaded View

  1. #20
    Join Date
    Mar 2010
    Location
    Minnesota, USA
    Posts
    41


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by HenrikOlsson View Post
    Hi,
    However, BIT 1 as you've specified means it tries to map it to PORTB.1 which isn't valid.

    /Henrik.
    See I was confused because in the manual it said:
    bit 3-0 CCP1M<3:0>: CCP1 Mode Select bits
    0000 = Capture/Compare/PWM disabled (resets CCP1 module)
    0100 = Capture mode, every falling edge
    0101 = Capture mode, every rising edge
    0110 = Capture mode, every 4th rising edge
    0111 = Capture mode, every 16th rising edge
    1000 = Compare mode, set output on match (CCP1IF bit is set)
    1001 = Compare mode, clear output on match (CCP1IF bit is set)
    1010 = Compare mode, generate software interrupt on match (CCP1IF bit is set, CCP1 pin is
    unaffected)
    1011 = Compare mode, trigger special event (CCP1IF bit is set, CCP1 pin is unaffected); CCP1
    resets TMR1 and starts an A/D conversion (if A/D module is enabled)
    11xx = PWM mode
    So I was thinking the xx was what I was setting so I figured the LSB was 1 for port B0 and 2 for B3. Like I said I was confused

    So you are saying all I need to do is say 0 and not 1, right?


    Quote Originally Posted by Gusse View Post
    Hi Wolwil,

    You could replace PBP SHIFTOUT with attached ASM code example and reduce time spend in SHIFTOUT + loop to ~1/8. This is kind of tested, but no promises ... Check if it is usefull for you.

    PBP_shiftout execution time was around 814uS, but ASM_shiftout took only 104uS to do the same.

    BR,
    -Gusse-
    Thanks I will try this out tonight!
    Last edited by wolwil; - 11th May 2010 at 21:34.

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