Positron Compiler Documentation

PinGet (GetPin)

Source: Positron16 Compiler User Manual, PDF page 193

Syntax

Assignment Variable = PinGet Pin Number

Overview

Examine a pin of a port.

Parameters

Pin Number is a constant, variable, or expression that points to the pin of a port that requires reading. A value of 0 will read PORTA.0, a value of 1 will read PORTA.1, a value of 16 will read PORTB.0 etc… The pin will be made an input before reading commences. Assignment Variable is a user defined variable.

Example

' Examine and display each pin of PORTB
  Device = 24FJ64GA002
                                     ' Select the device to compile for
  Declare Xtal = 16
  Declare Hserial_Baud = 9600      ' USART1 Baud rate
  Declare Hrsout1_Pin = PORTB.14   ' Select the pin for TX with USART1
  Dim PinNumber as Byte
  Dim Var1 as Byte
  RPOR7 = 3
                                     ' Make PPS Pin RP14 U1TX
  Do
     For PinNumber = 16 to 31
                                     ' Create a loop for 16 pins
       Var1 = PinGet PinNumber
                                     ' Examine each pin of PORTB
       Hrsout Dec1 Var1
                                     ' Display the result
     Next
                                     ' Close the loop
     DelayMs 100
                                     ' Slow things down to see what's happening
     Hrsout 13
  Loop
                                     ' Do it forever