The following functions and subroutines are available for the ADC module.


Function Read(portPin As Bit) As UShort
  • portPin - Firewing analog port pin. Can be A0, A1, A2, A3, A4 and A5.

Calling this function will sample an analog signal on a given analog port (A0..A5) and return a number between 0 to 1023. For example:

' import LCD module
imports LCDDogm

' program entry point...
sub Main()

   ' clear LCD and set backlight...

   ' loop forever...   
   while true
      dim sensor as ushort = Adc.Read(A1) ' read sensor
      Dogm.WriteAt(1,1,Str(sensor,4))     ' display result
      delayms(500)                        ' delay
   end while 
end sub


 Sub SetReference(aref As Byte)
  • aref - Select the analog pin reference voltage pin. Allowable numbers are 0 and 1.

The subroutine enables or disables the analog reference pin. In simplest terms, passing a zero (0) disables the reference pin. If a one (1) is passed, the voltage applied to the AREF pin (0 to 3.3V only) is used as the voltage reference.