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. #13
    Join Date
    Mar 2010
    Location
    Minnesota, USA
    Posts
    41


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Charles Linquis View Post
    Use a 16 bit counter in assembly to count to 0FFF.
    In that loop, use the instruction -

    btg LATA.3

    You can't get much quicker than that.

    I haven't counted exactly, but it looks to be under 14 cycles. At 40Mhz, that is
    1.4uSEC = 714 Khz.
    so do I just replace this:
    Code:
    	FOR C3 = 0 TO 4095
        		PORTA = %00001000
        		PORTA = %00000000
    	NEXT
    with this:
    Code:
    FOR C3 = 0 TO 4095
         btg LATA.3
    NEXT
    I do not know assembly at all thats why I went with PBP and keep in mind I am using a 16MHz Clock but I will be switching it up to a 20MHz
    Last edited by wolwil; - 9th May 2010 at 00:19.

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