General area when it fits no where else

Moderator: Mmiscool

User avatar
By Ecoli-557
#51739 Sorry, I dont see anything changed?
How does your suggestion work?
Yes, I am used to having more direct control of I/O registers directly.
While presently frustrating, once I get it, it will be pretty cool I think.
Can you elaborate?
User avatar
By forlotto
#51741 It was missing end if's

compare the two codes you will notice the lower case end if's I threw in there I also for the kicks of it said

if selected > 3

instead of

if selected = 4

This is better to me because lets say somehow or another there was a glitch that caused it to be 5 or higher your code would be dumbfounded...

Anyways you have the idea problem solved:

A note to everyone a tool that greatly helps you debug is notepad++ I never count lines I just paste my code verbatim to notepad ++ and it counts the lines for me hope this helps all this extra css fancy debugger stuff and what not just seems like a hassle to me just read the error and look at your code stop counting lines let notepad++ do it for you :P I also save a copy this way to my PC in case something were to happen etc...


Enjoy

-forlotto
User avatar
By Ecoli-557
#51781 OK, I'm like a dog with a bone here.....
1. I am trying to detect a change on a PIN which the menu button is attached to which is pulled high and looking to go low.
2. Are saying that end ifs are to be lower case?
3. I concede re the number of times the button is pushed is > than a number. I can do that.

Still lookin' for a little clarification on the best way to detect a hardware pin change. Michael suggests the interrupt route and it seems to be doing something, just not what I want - isn't it always the way when learning a new proc and code philosophy??
User avatar
By forlotto
#51783 End IF
EnD If
end if
END IF

Are all the same as far as I know END IF was made in a manner not to be case sensitive like variables or subs etc...

Hope this helps in some way shape or form.

EDIT: I only made them lower case in my example to easily reference the question you posed as to where the changes were made around line 85 ... They do not have to remain this way!

Just remember it is end"SPACE"IF not endif this is incorrect it should be end if and you should be good.


I also highly suggest you take a look at the guide in my signature it talks about interrupts and gives example on how to use it! There may be a slight difference in 3.x code I haven't really checked to see for certain but give it a look. Also reference the documentation. You should be able to make heads or tails on how to setup the interrupt eg High or Low.

Just place the interrupt code in line so that the interrupt is triggered and your high and low state jives in that manner I really have not played with interrupts much but I understand them totally I think of them like a switch that enables code to be executed based on the state of a pin 1 or 0.