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. #7
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191


    Did you find this post helpful? Yes | No

    Default

    There are couple of workarounds available:
    1) changed crystal to 20MHz
    2) If Shiftout command is too slow
    Code:
    <code><font color="#000000">    <b>SHIFTOUT </b>dpin,clk,1,[Dat]
    </code>
    then don't use it. Do it other way (e.g code below).
    Code:
    <code><font color="#000000">    dpin = Dat.0(7) : clk = 1 : clk = 0
        dpin = Dat.0(6) : clk = 1 : clk = 0
        dpin = Dat.0(5) : clk = 1 : clk = 0
        dpin = Dat.0(4) : clk = 1 : clk = 0
        dpin = Dat.0(3) : clk = 1 : clk = 0
        dpin = Dat.0(2) : clk = 1 : clk = 0
        dpin = Dat.0(1) : clk = 1 : clk = 0
        dpin = Dat.0(0) : clk = 1 : clk = 0
    </code>
    This will run much faster but consume more code space. Trade-off that you have to live with.
    BTW, DATA is reserved word so therefore I changed it to Dat

    BR,
    -Gusse-
    Last edited by Gusse; - 8th May 2010 at 09:05. Reason: Crystal comment added

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