[sdiy] help...no make8() function in Arduino...converting PIC to AVR
Martin Klang
mars at pingdynasty.com
Wed Apr 11 18:00:08 CEST 2012
what do they do on the pic?
make8 I found in the PIC C Compiler Reference:
i8 = MAKE8(var, offset)
Same as: i8 = (((var >> (offset*8)) & 0xff)
so that
> tmpbyte1 = make8(tmp1, 1);
would be
tmpbyte1 = (tmp1 >> 8) & 0xff;
and _mul() multiplies, right?
Looks like the code is specifically optimised for the pic instructions set -
tmp1 is 16 bit, right? acc1 and val1 8-bit unsigned integers?
Presumably you can replace the two lines with
uint8_t value = (uint8_t)( acc1*val1>>8);
depending on data types, but would have to see some more code to know.
hth,
/m
On 11 Apr 2012, at 16:25, dan snazelle wrote:
> can someone help me ?
>
> i am trying to convert some PIC code to AVR
>
> it is going fine except for 2 things
>
> there is no make8() function and there is no _mul()
>
>
> so code lines like this:
>
>
> tmp1 = _mul (acc1, val1);
>
> tmpbyte1 = make8(tmp1, 1);
>
>
> do not work
>
>
>
> i have been looking for the make8 function online so i can just write that function into my code but no luck
>
>
> thanks for any help!
More information about the Synth-diy
mailing list