×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Serial communication port, QBasic Code for photobooth fundraiser?

Serial communication port, QBasic Code for photobooth fundraiser?

Serial communication port, QBasic Code for photobooth fundraiser?

(OP)
So I am TRYING to help our local photographic museum,

http://www.lightfactory.org/exhibitions/index.htm

with a little fundraiser for their self portrait exhibition starting a mere 13 days from now.

They want to have a photobooth as a fundraiser, which is easy enough for me to supply, I am a professional photographer who has a photobooth.

However they want to have it act as an automatic vending machine.

I have bought a program that controls my photobooth, but the vending section of code is not yet complete.

All I need to do is have my dollar bill acceptor write a number "1" to a text or dat file so the program can know how many dollars have been inserted. As more dollars are inserted the machine simply adds the numbers up. Two dollars would write the number 2 to the text file. Sounds easy enough?

The manufacturer of the bill acceptor has posted free qbasic code on their website:

http://www.upstatenetworks.com/kiosk/

I downloaded quickBasic 4.5
from:
http://qbnz.com/pages/downloads/software/

Extract it and there is a file called QB.exe that runs quickbasic.

Next I created a *.bas file in the same directory that Qbasic is located in and called it money.bas using the following code

code:
OPEN "com1: 300, n, 8, 1,cd0,cs0,ds0,op0,rs,rb2048" FOR INPUT AS #1

OPEN "c:\photoboof\credits.txt FOR OUTPUT AS #2

PRINT #2, 0

CLOSE #2

OPEN "c:\photoboof\credits.txt" FOR OUTPUT AS #2

delay = 0

  
COLOR 15, 1, 1

CLS

PRINT "       Please insert $1 BILLS FOR PHOTOS"

PRINT

PRINT " When you are done inserting all of your bills, press any key to continue..."

LOCATE 5, 35

PRINT "Credit: $"; credit

ON COM(1) GOSUB getbill

COM(1) ON

credit = 0

  

OUT &H3F8, 1

DO WHILE INKEY$ = ""

LOOP

  

OUT &H3F8, 0

REM PRINT "Total Credit: "; credit

PRINT #2, credit

CLOSE

REM DO WHILE INKEY$ = "": LOOP

REM stop

SYSTEM

  

getbill:

REM PRINT HEX$(ASC(INPUT$(1, 1)))

credit = credit + 1

LOCATE 5, 35

PRINT "Credit: $"; credit

RETURN
 
 


Now I opened up the QB.exe program and open up the money.bas file in it.
Hit F5 and the program should runs.

I am attatching my serial based Bill Acceptor, model. # coinco ba30b to my computer using this device:
http://www.upstatenetworks.com/kiosk/

Note the Bill Acceptor will NOT function until you run the above quickbasic program which activates the com port and sets the voltage correctly to activate the bill acceptor.

The major issue is I have three of these bill acceptors and two adapter cables and the machines simply do not give the customer a credit when money is inserted. I think it changed the credit file from 0 to 1, once the very first time I tried it, but never since and I have tried this on 3 different PC's.

I am beginning to think something is wrong with the serial com comamnds in my source code? the bill collector can be set to receive short pulses 50 or standard 150ms on/off pulses, any recommendations?

RE: Serial communication port, QBasic Code for photobooth fundraiser?

I wonder what OS you have on your target machine. I'm afraid what Windows NT, Windows 2000 and Windows XP just don't allow QBasic talk to I/O ports directly.
You probably need DOS or Windows 95/98.
(btw qbasic is small enough to run from DOS bootable diskette)

hope this helps.

RE: Serial communication port, QBasic Code for photobooth fundraiser?

(OP)
I am using Windows XP and I really need to run windows because my photobooth software was written in python.

Thanks for the potential tip/problem advice.

RE: Serial communication port, QBasic Code for photobooth fundraiser?

Have you looked into doing this in Python?

The answer is "42"

RE: Serial communication port, QBasic Code for photobooth fundraiser?

Note this is QBASIC and not QuickBasic code.
And you have tsh73's issue.

RE: Serial communication port, QBasic Code for photobooth fundraiser?

Here is my 2 cents worth ...

Since your application requires XP...

I suggest you use MS Access.  Access can then display a GUI screen for your prompting.  Then use VBA (plenty examples on the net) to read the COM1 port.  

The data can we written to a text file (again simple examples on the net).

If needed you can use the API to launch other Windows applications, etc.

By using MS Access you can quickly create the interfaces you need..

I hope this gives you another alternative.

RE: Serial communication port, QBasic Code for photobooth fundraiser?

I know this is late...but it may server for "next" year's fundrasier.

in the code you posted, you didn't have cycle through the number of credits.

Also, you may want to write out some code to keep a seperate file as to how much money you sould have in the til.  This will also server to let you know where your mistake lies; especially if it says you received a total of 5 bills and your "Credits" on the screen show 0 or 1.

--> It's a bird!  It's a plane!  No, it's an OS update patch! Ahh!! <--

RE: Serial communication port, QBasic Code for photobooth fundraiser?

(OP)
Upstate Networks wanted $3800 to write this program for me. They estimated the work to be 60 hours, which is I think is 54 hours too much.

It would take me 60 hours, a good programmer should be able to do this fairly easily I would think?

Am I totally wrong?

RE: Serial communication port, QBasic Code for photobooth fundraiser?

Not necessarily.    I think they said +/-60 hours because they will probably hire out the work and then have to test the code for your particular use/situation.

In the meantime, you can try out the code below.  I noticed that you have a directory listing that did not meet the 8.3 specs.  I reworked your code and modified it for a directory call FotoBox. See below.

CODE

'
' ------
' -- The code posted on their web site is incomplete (for both
' -- the QB and VB4 codes).  That's how they get you to acquire
' -- their services.
' -- To use the "saving of credits", create a folder in the root
' -- of your C drive called "FOTOBOX".  After that, you can try this.
' ------
' Hope this helps (HTH).
' -- MiggyD  (www.tek-tips.com/viewthread.cfm?qid=1263352)

' Activate communication port 1
OPEN "com1: 300, n, 8, 1, cd0, cs0, ds0, op0, rs, rb2048" FOR INPUT AS #11
' User-defined event
ON COM(1) GOSUB getbill
' Activate user-defined event
COM(1) ON

' Start Daily Bookkeeping
OPEN "c:\FotoBox\tally.txt" FOR APPEND AS #14
PRINT #14,
PRINT #14, "Activation Date: ";
PRINT #14, DATE$
PRINT #14, "Activation Time: ";
PRINT #14, TIME$

' Create temp workspace for current patron
OPEN "c:\FotoBox\credits.txt" FOR OUTPUT AS #10

' Main loop
Credit = 0
EOD = 0     'EOD = End Of Day (for when you close up shop)
DO
    COLOR 7, 0, 0
    CLS
    PRINT "       Please insert $1 BILLS FOR PHOTOS"
    PRINT
    PRINT " When you are done inserting all of your bills, press any key to continue..."
    OUT &H3F8, 1
    COLOR 31, 1, 1
    DO WHILE INKEY$ = ""
         LOCATE 5, 35
         PRINT "Credit: $"; Credit
         ' if ESC key is pressed then end program
         ' obviously you should modify this as needed
         ' if this doesn't work right away, just hold
         ' down the escape key.

         IF INKEY$ = CHR$(27) THEN EOD = 1
    LOOP
    OUT &H3F8, 0
    ' Save number of credits incase of power failure
    PRINT #10, Credit
    ' Show how many photos allowed
    LOCATE 5, 35
    PRINT "Total Credit(s): $"; Credit
    PRINT #10, Credit
    '------
    '-- I guess that this must be the section
    '-- that will actually take the picture and
    '-- you'll probally have to remove credits
    '-- as well.
    '------

    REM DO WHILE INKEY$ = "": LOOP
    REM stop
    ' Reset credits to zero for the next patron.
    Credit = 0
LOOP WHILE EOD = 0
' Deactivate user-defined event
COM(1) OFF
' Close all OPENed I/O activities & terminate program
CLOSE 10, 11, 14
CLS
SYSTEM


getbill:
    COLOR 15, 1
    Credit = Credit + 1
RETURN

After you run the code, you can check out the FotoBox folder and see the TXT files.

Again, HTH.
--MiggyD

--> It's a bird!  It's a plane!  No, it's an OS update patch! Ahh!! <--

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close