Faster SHIFTOUT without dedicated hardware, possible?


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: Faster SHIFTOUT without dedicated hardware, possible?

    You're right, for a PIC18 WREG is the name of a register.

    If you're using a PIC16 then you have to declare a variable named WREG as I mentioned in post #9

    Quote Originally Posted by tumbleweed View Post
    If you're using a PIC16 then you'll have to add a definition for a WREG variable
    Code:
    WREG var byte
    If you wanted to make the code the same for all devices then change all the references to WREG to a byte variable instead, including the SHOUT subroutine.
    Here I've named it SHDATA.
    Code:
    SHDATA var byte
    
    SHDATA = $55
    call SHOUT

  2. #2
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: Faster SHIFTOUT without dedicated hardware, possible?

    It works fine without definition on PIC16F1828.
    In fact, if I add definition, compiler gives an error - Redefiniton of VAR
    This is why I asked

  3. #3
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: Faster SHIFTOUT without dedicated hardware, possible?

    If you're using an enhanced midrange PIC16 device (like the PIC16F1828) then it has a WREG, so it works with them too without having to declare a 'WREG' variable.

    It's only for the older PIC16's you'd have to define it, or just change all the references to WREG to a new variable name of your choice.

  4. #4
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: Faster SHIFTOUT without dedicated hardware, possible?

    The above code works fine with TM1629A display.
    But it does not work properly with APA102C leds.
    I have the following statement:

    SHIFTOUT di, ci, 1,[224+Bri[x],COLORS[X+16],COLORS[X+8],COLORS[X]]

    Which I have replaced with

    wreg=224+Bri[x]
    gosub shout
    wreg=COLORS[X+16]
    gosub shout
    wreg=COLORS[X+8]
    gosub shout
    wreg=COLORS[X]
    gosub shout

    The issue is that only odd bytes got transferred.
    Say if I set some value to 2 or 4 it gets delivered to LEDs, but if I set it to 1 or 3 or 5 - nothing happens.
    Tried to insert pause between each subroutine call - no difference

  5. #5
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: Faster SHIFTOUT without dedicated hardware, possible?

    I also tried to add some NOPs as suggested above - no difference.

  6. #6
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: Faster SHIFTOUT without dedicated hardware, possible?

    Don't know what to tell you... the routine transfers any values for WREG so there's no difference between odd/even values.

    Must be some issue with the APA102C timing/format.

  7. #7
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: Faster SHIFTOUT without dedicated hardware, possible?

    I will hook up scope and check both "versions", to find the possible issue.

Similar Threads

  1. Replies: 29
    Last Post: - 20th May 2010, 03:47
  2. Is there a faster way to compare?
    By RussMartin in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 8th February 2010, 19:48
  3. Dedicated LCD Controller question
    By chuckles in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th February 2006, 14:44
  4. Is there a faster/better way of doing this?
    By Mad_Labs in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th October 2005, 11:01

Members who have read this thread : 1

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