I am using a 8-channel AD-convertor / interface, directly connected to the serial port. Sensitivity is 0 to 8 volts, and it is 12-bits (2mV=1 bit). It is very simple to build. The small program shows reading from one channel, it is possible to use 8 channels! ( http://www.libertybasic.0catch.com/ )
So far I use Liberty Basic, but it is far too slow. How can I get the serial port in action in Freebasic? I use WindowsXP. Here is the LB program (for one channel):
nomainwin
open "com1:9600,n,8,1" for random as #commHandle
Port = hexdec("3FC")
textbox #Meten.a, 5, 5, 200, 30
open "Meten" for Graphics_nsb as #Meten
Print #Meten, "trapclose [quit]"
  while Inkey$<>" "
      scan
      GoSub [readin]
      for slow= 1 to 100000:next slow
      Print #Meten.a, "Output: "; v1
  wend
goto [quit]
[readin]
  vout = 0: vout1 = 0
    gosub [tel]: vout = vout + 2048 * d
    gosub [tel]: vout = vout + 1024 * d
    gosub [tel]: vout = vout + 512 * d
    gosub [tel]: vout = vout + 256 * d
    gosub [tel]: vout = vout + 128 * d
    gosub [tel]: vout = vout + 64 * d
    gosub [tel]: vout = vout + 32 * d
    gosub [tels]: vout = vout + 16 * d
      gosub [tel]: vout = vout + 8 * d
      gosub [tel]: vout = vout + 4 * d
      gosub [tel]: vout = vout + 2 * d
    gosub [tels]: vout1 = vout + 1 * d
    gosub [highfg]
    v1=int((vout1)-1364)
Return
[tel]
    OUT Port, (254 And INP(Port))
    OUT Port, (253 And INP(Port))
    OUT Port, (1 Or INP(Port))
    If (INP(Port + 2) And 16) = 16 Then d = 1 Else d = 0
return
[tels]
    OUT Port, (254 And INP(Port))
    OUT Port, (2 Or INP(Port))
    OUT Port, (1 Or INP(Port))
    If (INP(Port + 2) And 16) = 16 Then d = 1 Else d = 0
return
[highfg]
    OUT Port, (254 And INP(Port))
    OUT Port, (2 Or INP(Port))
    OUT Port, (1 Or INP(Port))
    OUT Port, (254 And INP(Port))
    OUT Port, (2 Or INP(Port))
    OUT Port, (1 Or INP(Port))
    OUT Port, (254 And INP(Port))
    OUT Port, (253 And INP(Port))
    OUT Port, (1 Or INP(Port))
    OUT Port, (254 And INP(Port))
    OUT Port, (253 And INP(Port))
    OUT Port, (1 Or INP(Port))
return
[quit]
Close #commHandle
Close #Meten
End
So far I use Liberty Basic, but it is far too slow. How can I get the serial port in action in Freebasic? I use WindowsXP. Here is the LB program (for one channel):
nomainwin
open "com1:9600,n,8,1" for random as #commHandle
Port = hexdec("3FC")
textbox #Meten.a, 5, 5, 200, 30
open "Meten" for Graphics_nsb as #Meten
Print #Meten, "trapclose [quit]"
  while Inkey$<>" "
      scan
      GoSub [readin]
      for slow= 1 to 100000:next slow
      Print #Meten.a, "Output: "; v1
  wend
goto [quit]
[readin]
  vout = 0: vout1 = 0
    gosub [tel]: vout = vout + 2048 * d
    gosub [tel]: vout = vout + 1024 * d
    gosub [tel]: vout = vout + 512 * d
    gosub [tel]: vout = vout + 256 * d
    gosub [tel]: vout = vout + 128 * d
    gosub [tel]: vout = vout + 64 * d
    gosub [tel]: vout = vout + 32 * d
    gosub [tels]: vout = vout + 16 * d
      gosub [tel]: vout = vout + 8 * d
      gosub [tel]: vout = vout + 4 * d
      gosub [tel]: vout = vout + 2 * d
    gosub [tels]: vout1 = vout + 1 * d
    gosub [highfg]
    v1=int((vout1)-1364)
Return
[tel]
    OUT Port, (254 And INP(Port))
    OUT Port, (253 And INP(Port))
    OUT Port, (1 Or INP(Port))
    If (INP(Port + 2) And 16) = 16 Then d = 1 Else d = 0
return
[tels]
    OUT Port, (254 And INP(Port))
    OUT Port, (2 Or INP(Port))
    OUT Port, (1 Or INP(Port))
    If (INP(Port + 2) And 16) = 16 Then d = 1 Else d = 0
return
[highfg]
    OUT Port, (254 And INP(Port))
    OUT Port, (2 Or INP(Port))
    OUT Port, (1 Or INP(Port))
    OUT Port, (254 And INP(Port))
    OUT Port, (2 Or INP(Port))
    OUT Port, (1 Or INP(Port))
    OUT Port, (254 And INP(Port))
    OUT Port, (253 And INP(Port))
    OUT Port, (1 Or INP(Port))
    OUT Port, (254 And INP(Port))
    OUT Port, (253 And INP(Port))
    OUT Port, (1 Or INP(Port))
return
[quit]
Close #commHandle
Close #Meten
End