In the C version there's a d_mode variable which you're checking
your right of course
that's the way I eliminated the redundant loop in the c version
looks like I skipped that step for pbp
code size now 336 and functional equivalence restored
thanks for noticing that
Code:
* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 29/11/2014 *
'* Version : 1.0 *
'* Notes : *
'* : pic12f1822 *
'****************************************************************
#CONFIG
cfg1 = _FOSC_INTOSC
cfg1&= _WDTE_ON
cfg1&= _PWRTE_OFF
cfg1&= _MCLRE_ON
cfg1&= _CP_OFF
cfg1&= _CPD_OFF
cfg1&= _BOREN_ON
cfg1&= _CLKOUTEN_OFF
cfg1&= _IESO_ON
cfg1&= _FCMEN_ON
__CONFIG _CONFIG1, cfg1
cfg2 = _WRT_OFF
cfg2&= _PLLEN_OFF
cfg2&= _STVREN_ON
cfg2&= _BORV_19
cfg2&= _LVP_OFF
__CONFIG _CONFIG2, cfg2
#ENDCONFIG
DEFINE OSC 8
include "dt_ints-14.bas"
include "REENTERPBP.bas"
asm
INT_LIST macro
INT_HANDLER INT_INT, _TL, PBP,yes
endm
INT_CREATE
INT_ENABLE INT_INT
ENDASM
osccon=$70 '8 mhz
anselA=0 'dig i/o
ANSELC=0
TRISC= %11110000
TRISA= %011111
APFCON0.7=0
OPTION_REG.6=0
a var byte
b var byte
c var byte
d var byte
pin_mode var bit
d_mode var bit
x var byte
all_off var byte
pins_on var byte
led var lata.5
a=1 ;portC.0
b=2 ;portC.1
c=4 ;portC.2
d=8 ;portC.3
pin_mode=0
d_mode=1
all_off=~(a+b+c+d)
led=0
latC = latC & all_off
action:
if d_mode then
pins_on=a+b
else
pins_on=c+d
endif
for x = 1 to 5
latC = latC | pins_on
pause 200
latC = latC & all_off
pause 200
next x
if !d_mode then gosub shuffle
d_mode= !d_mode
goto action
shuffle :
pin_mode = not pin_mode
if pin_mode then
swap a,d
swap b,c
else
swap b ,d
swap c ,d
endif
return
TL:
led=!led
@ INT_RETURN
Bookmarks