Hi All,
I need to address five ports conditionally according to the value of one variable.
I found some posts about this subject and hoped this thread would help, but unfortunately, it doesn't.
This a code extract of my current project where timing is crucial and I have to write down a lot of repeating lines of code since FOR/NEXT and GOTOs and GOSUBs take too much time (I'm driving five NeoPixel SW2812B strings with each 28 LEDs/Pixels).
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 PortPin VAR PORTA.0 X VAR BYTE X = 23 ' PORTC.7 - "PORTA.0[23]" MAIN: PORTC.7 = 1 ' OK, obviously will work but useless - just make shure the scope works too 'PORTA.0[23] = 1 ' OK but useless 'PORTA.0[X] = 1 ' No! Makes a blink in the scope and then stays LOW 'PORTA[X] = 1 ' No!, nothing happens, pin stays LOW 'PortPin[23] = 1 ' OK but useless 'PortPin[X] = 1 ' No!, nothing happens, pin stays LOW 'PortPin.0[X] = 1 ' No!, error message "Bad variable size modifier: .0" '... ASM nop nop nop ENDASM PORTC.7 = 0 ' have this syntax for tests only here ASM nop ENDASM GOTO MAIN END
How do I solve this please?




Bookmarks