My K8048 is working fine with the supplied examples, and I’m getting a little understanding of the assemblerlanguage.
One thing I do not understand. I would expect that the testswitches are read as a binairy code of PortA, so Sw1=1 (B’00000001’), Sw2=2, SW3=4 and SW4=8 (B’00001000’)
But in the Demo2 example is stated:
SW1 EQU H’00’ ;SW1 is triggering RA0
SW2 EQU H’01’ ;SW2 is triggering RA1
SW3 EQU H’02’ ;SW3 is triggering RA2
SW4 EQU H’03’ ;SW4 is triggering RA3
So this puzzles me. Who can explain this?
And how can I use 2 buttons pressed simultaneously.
Answering such questions is beyond the scope of this forum, but as a one-time favour:
MPLAB allows you to assign a name to each bit.
In this case:
PortA bit0: SW1
PortA bit1: SW2
Then you can write e.g. BTFSS PORTA,SW1 instead of BTFSS PORTA,0
Thanks for the answer. I think I understand it (a little). In fact you could say ‘What’s in a name!’.
I will play around with the assignments and maybe I’ll see the light.