Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Serial port with Max186
#1
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
Reply
#2
Hello all, I went to the forum of FreeBasic.net, and there I got my answers. Now it works, alltough there is many programming to do.
I you are interested in measuring (volt, light, temperature....) with a pc, feel free to visite my website. It is in Dutch, but there is a circuit witha Max186 AD-converter, very easy to build.
Where are the technicians? :-)
Reply
#3
LOL at response to your initial question.
As you will have found out by now, FB people are a dying breed and the chance of finding one here or at QBasic.com is unlikely. The in thing now is QB64.
Joking aside, if you want an FB question answered then the FB site is your only hope.
PS
What name did you go under at FB, because I could not find your name.
Reply
#4
Hello, my name there is tkpatric.

Many greetings,
Patric.
Reply
#5
I found your posts and am glad that counting_pine was able to help. He is someone that is respected in both communities.
Reply
#6
For me he is a saint! Big Grin
Reply
#7
If someone is interessed in a pc-interface to measure 8 channels at the same time, on a very cheap and simple wise, feel free to visit my website( http://www.libertybasic.0catch.com/ )
Thanks to counting_pine, there is now a little program in FB for measuring one channel, and there is a very small program to do something with the parallel port. Thanks again.
Reply
#8
If you want to play with ports, you should see my Q-Basics.zip Demo at:

www.qbasicstation.com

In MEMBER Files /Demos. Read Chapter 11. The Qbasic code can be adapted to FB.

Ted
Get my QB demonstrator here: http://dl.dropbox.com/u/8440706/Q-Basics.zip
Reply
#9
The Zip-files are always removed from my website...???? So this is the new adress for the 'Zipped programs': http://transparant.esmartweb.com/pagina8.html
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)