nice pic , what I was really think is , will a I bit shift on a long execute quicker than doing a 1 bit shift through 4 bytes
nice pic , what I was really think is , will a I bit shift on a long execute quicker than doing a 1 bit shift through 4 bytes
Art,why not give an 18F a try at 64MHz? Wouldn't that be a bit faster than 20MHz chips?
Robert
Speed doesn’t address the problem Robert ( convenient floating point math),
but I should have tried out some faster pics years ago yes!
Richard, you’re probably right, and I didn’t think of that.
At least 16 bit rotation should take the same time, and in this instance the bytes don’t have to be bytes.
I don’t think C can create an alias of another variable type like PBP does (it might cost more time to access them)
but accessing an array out of bounds has worked on every platform I’ve tried, and probably for PBP too although not needed.
Code:unsigned char bytearray[2]; long longarray[2]; Now bytearray[2],bytearray[3], etc. can access the bytes of longarray.
you use a union
eg
union U32_
{
unsigned long l; // For accessing the whole 32-bits
unsigned char b[4]; // For accessing as individual bytes
};
char mybyte;
union u32_ my_array;
my_array.l= 0b00001111000011110000111100001111
mybyte=my_array.b[3];
Last edited by richard; - 16th May 2015 at 02:56. Reason: can't count o's and ones
ThanksI’m sure that will be handy.
Bookmarks