Re: Addressing multiple PORTs using one Variable
By changing pinsel var you can select different portc pins
if you need the remaining portc pins then more code is needed
Code:
' PIC 16F690 @20MHz#CONFIG
__config _FCMEN_OFF &_IESO_OFF &_CPD_OFF &_WDT_OFF &_HS_OSC &_BOR_OFF &_CP_OFF &_PWRTE_OFF &_MCLRE_OFF
#ENDCONFIG
TRISC = %00000000
DEFINE OSC 20
pinsel var byte
pinsel = 128 ; 64 FOR RC:6 32 FOR RC:5 ETC
MAIN:
PORTC = PORTC | pinsel
ASM
nop
nop
nop
ENDASM
PORTC = 0 ' have this syntax for tests only here
ASM
nop
ENDASM
GOTO MAIN
END
Warning I'm not a teacher
Bookmarks