131,072 SHIFTOUTs in that loop and it is shifting the same value 15 times, getting another value and shifting that 15 times, again ,again.... That will tale some time.
Unless I am looking at it cross eyed...
Is the above really what you want to do?
131,072 SHIFTOUTs in that loop and it is shifting the same value 15 times, getting another value and shifting that 15 times, again ,again.... That will tale some time.
Unless I am looking at it cross eyed...
Is the above really what you want to do?
Dave
Always wear safety glasses while programming.
I wonder if SHIFTING all 16 values at once would be faster than looping? Darn zeros
Code:shiftout dpin,clk,1,[DATA,DATA,DATA,DATA,DATA,...]
Dave
Always wear safety glasses while programming.
Nope The Same
The part that is slow is going from SUB1 to SUB2 not the looping through them 4096 times
I just tried taking out the GOSUB's and still the same thing
There are couple of workarounds available:
1) changed crystal to 20MHz
2) If Shiftout command is too slow
then don't use it. Do it other way (e.g code below).Code:<code><font color="#000000"> <b>SHIFTOUT </b>dpin,clk,1,[Dat] </code>
This will run much faster but consume more code space. Trade-off that you have to live with.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>
BTW, DATA is reserved word so therefore I changed it to Dat
BR,
-Gusse-
Last edited by Gusse; - 8th May 2010 at 10:05. Reason: Crystal comment added
Nope the same.
20 MHz Clock will still be too slow with SHIFTOUT.
I am assuming your code has something to do with accessing per bit in the word sized Dat variable. So if I wanted to access the 11th bit I would do this Dat.1(2) right?
Would anyone have a faster way in Assembly I could do this?
Also Does anyone know how many clock pulses SHIFTOUT uses?
Last edited by wolwil; - 8th May 2010 at 18:16.
Bookmarks