peek and poke timer

johnlong

Senior Member
Hi All
was just having a play too see if I could
make a simple on off timer with the minimum
came up with using 1 variable and peek and poke
it gives equal high low periods

Code:
symbol cfon=8
symbol cfoff=9
in:
dirsB=%11111111
b12=0
inti:
poke cfon,0
poke cfoff,b12

main:
do
   			
  			peek cfoff,@bptr 'checks to see if b12 loaded
			if @bptr>0 then
			peek cfon,@bptr 'controlls select case value	
 			select case @bptr
		case< b12			
				high B.0				
			 @bptr=@bptr+1 'count up
			 poke cfon,@bptr
		case>=b12 
				low B.0				
				peek cfoff,@bptr
	 			@bptr=@bptr-1
				poke cfoff,@bptr	'count dwn			
				if @bptr=0 then
					poke cfon,0'reset 
					poke cfoff,b12
			endif 
		end select 
		endif 
		if pinD.7=1 then'just for simulation
			b12=9     
			goto inti
			endif
	
loop
thats my mornings play over with
regards
john
 

hippy

Technical Support
Staff member
was just having a play too see if I could make a simple on off timer with the minimum
That sure looks quite complicated for a 'minimum' though I am not exactly sure what it is intended to do in functional terms.
 
Top