Mr.Henrik, I need Your advice, again ...
I make some "experiments" with my specific matrix ... searching for best solution.
I use the code from previous post, with good results.
But now I need to have a little different function of buttons.
I need to have portb.x = 1 while correspondent button.x is pressed.
I don't understand why the code don't work proper ...
I KNOW I made some mistakes, but I DONT KNOW where ... Please, can You help me ?! Thank You so much !Code:@ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON & _LVP_OFF include "alldigital.pbp" Define OSC 4 ' 4MHz CMCON = 7 ' Disable on-chip comparator, PORTA in digital mode TRISA = %00011100 ; coloane la RA2, 3, 4 ; randuri la RA1, 0 ,7 PORTA = %00011100 PORTB = %00000000 TRISB = %00000000 status_1 VAR BYTE Main: ;reading buttons on row 1 PortA.0 = 0 TrisA.1 = 1 pause 10 status_1 = PortA & %00011100 ; PortA.0 = 1 ; TrisA.1 = 0 select case status_1 case 12 while status_1 = 12 portb.1 = 1 wend portb.2 = 0 case 20 while status_1 = 20 portb.2 = 1 wend portb.2 = 0 case 24 while status_1 = 24 portb.3 = 1 wend portb.3 = 0 end select PortA.0 = 1 TrisA.1 = 0 Goto main




Bookmarks