Michael,
Look at it this way: The data type is always 32 bits. (1<<3) or
0x00000008 can be used as 8-bit number without data loss. ~(1<<3) or
0xFFFFFFF7 can't be used as an 8-bit number without data loss. If you
keep this in mind when coding you'll be safe.
The assembler is rather simple in parsing the input. It probably just
compares the parsed 32-bit result with the allowed range (0-255).
-- Bas
On 1-7-2014 1:02, Michael M wrote:
Hi Bas,
You are right! The following works:
AND r3.b0, r3.b0, (~(1<<3) & 0xff) // Clear bit 3
It's strange that (1<<3) is interpreted as 8-bit, but ~(1<<3) is
interpreted as 32-bit. It appears to be an undocumented quirk of using
this operator? Thanks for your help!
On Monday, June 30, 2014 2:33:51 PM UTC-7, Bas Laarhoven wrote:
Hi,
Have you tested masking the ~(1<<3) to 8-bits ? It's possible that
the assembler sees a 32-bit constant where only an 8-bit value is
allowed.
-- Bas
On 30-6-2014 22:04, Michael M wrote:
Hello,
I've written a PRU program which manipulates bits in one of the
registers. The program does not compile with PASM when I use the
~ operator.
Setting multiple bits works:
or r3.b0, r3.b0, 1<<3// Set bit 3
but clearing multiple bits does not:
and r3.b0, r3.b0, ~(1<<3)// Clear bit 3
The exact compiler error is " Error: Syntax error in parameter
3". This should work since it comes straight from the TI wiki on
the PRU:
http://processors.wiki.ti.com/index.php/PRU_Assembly_Instructions#Bitwise_AND_.28AND.29
<http://processors.wiki.ti.com/index.php/PRU_Assembly_Instructions#Bitwise_AND_.28AND.29>
Is this a bug or am I doing something wrong?
Thanks,
Michael
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the
Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected] <javascript:>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google
Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.