Qbasicnews.com
April 22, 2018, 07:46:38 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Serial port with Max186  (Read 10718 times)
ptkindt
New Member

Posts: 6


« on: July 08, 2008, 03:14:08 PM »

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
« Last Edit: July 09, 2008, 12:32:52 PM by ptkindt » Logged
ptkindt
New Member

Posts: 6


« Reply #1 on: July 12, 2008, 07:39:04 AM »

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? :-)
Logged
roy
Member
*
Posts: 33


« Reply #2 on: July 12, 2008, 01:33:36 PM »

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.
Logged
ptkindt
New Member

Posts: 6


« Reply #3 on: July 12, 2008, 02:30:02 PM »

Hello, my name there is tkpatric.

Many greetings,
Patric.
Logged
roy
Member
*
Posts: 33


« Reply #4 on: July 12, 2008, 03:00:40 PM »

I found your posts and am glad that counting_pine was able to help. He is someone that is respected in both communities.
Logged
ptkindt
New Member

Posts: 6


« Reply #5 on: July 12, 2008, 03:25:32 PM »

For me he is a saint! Cheesy
Logged
ptkindt
New Member

Posts: 6


« Reply #6 on: July 21, 2008, 06:07:08 AM »

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.
Logged
Clippy
Member
*
Posts: 84



« Reply #7 on: September 29, 2008, 04:07:40 PM »

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
Logged

ptkindt
New Member

Posts: 6


« Reply #8 on: November 18, 2008, 01:07:29 PM »

The Zip-files are always removed from my website...Huh? So this is the new adress for the 'Zipped programs': http://transparant.esmartweb.com/pagina8.html
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!