
Eftersom jag redan har grejjer till PIC, så är jag väl "tvungen" att stanna där, iaf just nu.

OK, men det är alltid frågan om hela mm? Således tänker du dig ngt i stil med:Jag ska inte åka nånstans med knappar eller ratt, jag ska ställa in ett värde, tex 176, sen ska stegmotorn själv stega sig fram till det.
Kod: Markera allt
^^^
X 999
***
^^^
Y 999
***
^^^
Z 999
***
Kod: Markera allt
000,0
^^^ -
111,0
-^^ -
122,0
-^^ -
133,0
-^^ -
144,0
-^^ -
155,0
-^^ -
166,0
-^- -
176,0
Nu ska vi ställa in värdet 276
176,0
^-- -
276,0
Sista värdet blir 216
276,0
-^- -
286,0
-^- -
296,0
-^- -
206,0
-^- -
216,0
Kod: Markera allt
BUTTON Pin,Down,Delay,Rate,BVar,Action,Label
Read pin and optionally performs debounce and auto-repeat. Pin is automatically made an input. Pin may be a constant, 0-15, or a variable that contains a number 0-15 (e.g. B0) or a pin name (e.g. PORTA.0).
Down State of pin when button is pressed (0..1).
Delay Cycle count before auto-repeat starts (0..255). If 0, no debounce or auto-repeat is performed. If 255, debounce, but no auto-repeat, is performed.
Rate Auto-repeat rate (0..255).
BVar Byte-sized variable used internally for delay/repeat countdown. It must be initialized to 0 prior to use and not used elsewhere in the program.
Action State of button to act on (0 if not pressed, 1 if pressed).
Label Execution resumes at this label if Action is true.
BUTTON needs to be used within a loop for auto-repeat to work properly. BUTTON accomplishes debounce by delaying program execution for a period of milliseconds to wait for the contacts to settle down. The default debounce delay is 10ms. To change the debounce to another value, use DEFINE:
Example
DEFINE BUTTON_PAUSE 50 ' button debounce delay is 50ms
Be sure that BUTTON_PAUSE is all in upper case. In general, it is easier to simply read the state of the pin in an IF..THEN than to use the BUTTON command as follows:
If PORTB.2 = 1 Then notpressed