IN PBP we will write something like this...
IN PBC, IMO it will look something like.. please correct me someone if i'm wrongCode:TRISB=0 ' set PORTB as output TRISA=%11111101 ' set PORTA as input except PORTA.1 a VAR BYTE a=1 Loop: Toggle PORTA.1 IF PORTA.0=0 then Gosub DoSomething ' testing PORTA.0 status goto Loop DoSomething: PORTB=a ' send to PORTB if a<255 then a=a+1 else a=1 endif return
this will toggle the PORTA.1 pin untill PORTA.0 go low, once it go to low, it will send the value of b0 var to PORTB.... well it's suppose toCode:POKE $86,0 ' set PORTB as output POKE $85,253 ' set PORTA.1 as output other as input b0=0 loop: toggle 0 PEEK $05,b1 ' read PORTA status b1=b1 & 1 ' keep only bit 0 of PORTA ' well i don't know if you can use something like ' if b1.0=0 then gosub DoSomething... worth to give a try if b1=0 then gosub DoSomething goto loop DoSomething: POKE $06,b0 ' send to PORTB if b0<255 then b0=b0+1 else b0=1 endif return![]()




Bookmarks