Long time lurker first time poster!!
Been playing about with the picaxe experimenter board with the 18X i got for xmas.
Haven't played with microcontrollers since the mid 90's when it was .asm code. So a couple of questions....
First of all how do i put a input into a register (ie PIN0 into b1) so I can use it later. I would have done it with 'push' in asm but can't seem to find out how to do it in the tutorial guides
Secondly, I wrote a program so when a button was pushed a lamp would light but first go from off to full brightness via a PWM subroutine, but I want the light to stay lit at full brightness until I let go of the button. As at the moment once the subroutine has finished it will loop back to the start. I suspect its a stupid mistake but any help would be appreciated.
Been playing about with the picaxe experimenter board with the 18X i got for xmas.
Haven't played with microcontrollers since the mid 90's when it was .asm code. So a couple of questions....
First of all how do i put a input into a register (ie PIN0 into b1) so I can use it later. I would have done it with 'push' in asm but can't seem to find out how to do it in the tutorial guides
Secondly, I wrote a program so when a button was pushed a lamp would light but first go from off to full brightness via a PWM subroutine, but I want the light to stay lit at full brightness until I let go of the button. As at the moment once the subroutine has finished it will loop back to the start. I suspect its a stupid mistake but any help would be appreciated.
Thanks in advance.main:
if pin0 = 1 then lit 'if SW1 is pressed goto lit
if pin0 = 0 then unlit 'if SW1 is not pressed goto unlit
goto main
lit:
gosub brightup
high 1
goto main
unlit:
low 0
goto main
brightup:
for b1 = 1 to 400
pwmout 3,99,b1
pause 10
next b1
goto main
Last edited: