Bob or Dana,
Do either of you two wise pillars of knowledge have a PSoC1 Eval kit?
I have a strange problem with my current project.
Yes, I've got one. What is your problem?
The lesser pillar of knowledge also has one.
Still larning, Dana.
I have a strange problem with an if statement.
I have attached the project. It checks P0,0 for a logic '0' and if the value "power " is less than 255 it increments that value by 1.
It also checks P0,1 for a logic '0' and if the "Power" is greater than 0 it decrements the value by 1. It displays these changes on the LCD.
Look at line 46 for the increment and it works fine.
Now look at line 55. That also works.
However If I change line 55 to the same format as line 46 "if ((~PTR0DR & 0x02) & (Power>0))" recompile , rebuild and program, the decrement fails?
Can you see if you can reproduce this anomoly?
Archive is broken, please re-post.
@Dana: why "lesser pillar"? Just because I am for 5 minutes on place# 1 and you on place# 2?? That's going to change back within a matter of hours...
Bob, Dana try this from IE
And btw: Did you intend to write &&(Power < 0)
Please re-create the .zip, still archive is broken
Actually no. The line 46 works without the "ogical and"
Don't know what happened there. This should be OK
PTR0DR & 0x01 will deliver 0x01 when pin0 is high. Binary anded with 0x01 (which is "TRUE") will result in 0x01 which is still TRUE.
Use the logical AND as requred since you use a logical comparision on one side.