AVR BUG!
Moderator: Benj
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: AVR BUG!
On PIC ! always works for me,
Did it work for you?
Have you checked on hardware, or just simulation?
Did it work for you?
Have you checked on hardware, or just simulation?
Martin
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: AVR BUG!
Hello,
The C code being produced is this.
~ and ! are slightly different in their operations though your program looks to me like it should work. Hmm.
From stack overflow.
The C code being produced is this.
Code: Select all
//Calculation:
// b = NOT b
FCV_B = ~FCV_B;
From stack overflow.
As far as I know ~ should flip all the bits in the value so 0x00 would become 0xFF which should work. I may however be wrong on this if its not working on the hardware.For integral types, ! returns true if the operand is zero, and false otherwise.
So !b here just means b == 0.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel