PDA

View Full Version : push button problem



ngeronikolos
- 2nd June 2005, 14:56
hello boys and girls,

I am using pic16F627 20Mhz.I have 3 push buttons conected in :
porta.2-->MOVE LEFT
porta.3-->UP
porta.4-->DOWN
I have 8 dot matrix leds connected with my pic.I want pressing 1 time the putton in porta.2 to do changes in the first led UP or DOWN,pressing two times changes to the second led...
The adresse of the of the first led is SerData[2],second SerData[3]...last SerData[9].


.................................................. ..................
i = 1
STATIC:
BUTTON PORTA.2,1,250,250,B0,0,main
i = i + 1
BUTTON PORTA.3,1,250,250,B0,1,INCREASE
BUTTON PORTA.4,1,250,250,B0,1,DECREASE
GOTO MAIN

INCREASE: ASCII = ASCII+1
IF ASCII > 127 THEN ASCII = 0
SerData[i] = ASCII
GOSUB OUT
GOTO STATIC
DECREASE: ASCII = ASCII-1
IF ASCII > 127 THEN ASCII = 0
SerData[i] = ASCII
GOSUB OUT
GOTO STATIC

.................................................. ...................................

Somethinf is not working propertly!!
Any idea
Thanks

Nikos Geronikolos

Dwayne
- 2nd June 2005, 19:44
Hello Nger,

Nger>>Somethinf is not working propertly!!
Any idea<<

First of all...What is the beginning value of ASCII??? Zero?? Random number?. Maybe assign ASCII a value of dec 42 first (I believe that is the number "0").

I see increase, I see decrease, and I see static... But I do not see the label for main. Should it be where static is?

Arrays start with zero, not one. Thus I=0 probably should be the correct starting number. (Instead of "1").


Where do you output your data? Do not see this either. Unless there are other hidden things I am not aware of <g>.



Dwayne