Sorry, Rob, little mistake:
You need to check the PORTC register. The LATC register contains the output 
pattern, not the input state of the port pins.
Otherwise a good idea :-)
Greets,Kiste
    Am Donnerstag, 12. Januar 2023 um 19:11:43 MEZ hat flyway38 
<[email protected]> Folgendes geschrieben:  
 
 Hi Rob,
WOW, nice trick.Will check if works.Thank you very much.
Cheers,FS

On Thursday, January 12, 2023 at 6:06:35 PM UTC [email protected] wrote:

Hi Filipe,
I never tried this but here is a thought.
The pin on a specific port can be found in the LATx register, example below for 
portc this is LATC.
You find this in your device file for e.g. pin_C2var volatile bit    LATC_LATC2 
               at LATC : 2var volatile bit    pin_C2                    at 
PORTC : 2
So if you have for example your buttons on port C you could pass a 'mask' as 
parameter to the procedure. Example below (not compiled):
function pin_active(byte in pin_mask) return bit   return (LATC & pin_mask)end 
function
So if you want to if test pin C1 is active (HIGH) or pin C7 is active (HIGH) 
you do:
    if  pin_active(0b0000_0010) then       -- Do something for bin C1   end if  
  if pin_active(0b1000_0000) then      --  Do something for pin C7    end if 
Kind regards,
Rob
Van: [email protected] <[email protected]> namens flyway38 
<[email protected]>
Verzonden: donderdag 12 januari 2023 12:07
Aan: jallib <[email protected]>
Onderwerp: [jallib] PIC16F19176 use same function to check 2 input pins Hello,
Need help to use same function wich cheks for an input pin as a buttn.But now 
need to implement new input pin as another button.How to pass to that function 
which pin to read?Can I use "byte in device" in its input parameters?Thank you 
very much.
Kind regards,Filipe Santos


-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
[email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/f5fa42aa-c132-49d8-b5ae-5b141a9d927fn%40googlegroups.com.



-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/404b1de4-c3cd-47b4-a12e-1f7dce577e91n%40googlegroups.com.
  

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/1273200153.331767.1673548195785%40mail.yahoo.com.

Reply via email to