Here is the main code, from which all this started. This is simple spinner, pausing at certain position after whole loop.
Code:
'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 15.05.2014 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
ANSEL = %00000000
CMCON0 = 7
TRISIO=%00001000
OSCCON = %01110111
'Include "Modedefs.bas"
Define OSC 8 ' Set Xtal Frequency
' Clk Var GPIO.5 ' Data is clocked on rising edge of this pin kviteli
' Dta Var GPIO.4 ' Bits are shifted out of this pin stafilosferi
ZERO var GPIO.0
ONE VAR GPIO.4
TWO VAR GPIO.1
TRE VAR GPIO.2
cik var word
x var word
cok var word
lop var word
x=50
'INIT
LOW ONE
LOW TWO
LOW TRE
HIGH ZERO
PAUSE x
LOW ZERO
'this loop does smooth full turn
xoxi:
for cik=1 to 9
high one
pause x
high two
low one
pause x
high tre
low two
pause x
low tre
next
high one 'proper finish? one and two
pause x
low one
high two
pause x
low two
high zero
pause 1000
low zero
goto xoxi
It works fine, provides smooth looped animation.
Now let's add something. Changed TRISIO=%00101000. Code works fine. Added button check loop, and it becomes messed - triggering of certain pin no longer works.
Code:
kuku:
if gpio.5=0 then goto xoxi
pause 1
goto kuku
Bookmarks