?
Solved

BASIC Programming

Posted on 2003-03-27
11
Medium Priority
?
190 Views
Last Modified: 2010-04-17
Hi,

I have another question regarding Basic Programming, if I have an external button, when I press that button, it pauses the device that's running the basic program.  Now, I'm stuck on how the syntax going to be... like how can I capture that signal to tell the program that once you got the signal to pause, do this sub routine... Hope you guys know what I mean.
0
Comment
Question by:famtrad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 3
  • +2
11 Comments
 

Expert Comment

by:8_digits
ID: 8223811
I've ran into this problem before when I was making an excuse for a password program... for security reasons it can't be done.  Something that you could try to do is catch the computer in a loop by using a batch file with your program.  You could do this by typing:

:1
yourprog.exe
rem you can put qbasic /run yourprog.bas if you cant
rem compile to an exe
if errorlevel 1 goto 1

in anything.bat and then run anything.bat

This would only force the program to run again if they tried ctrl + break... but would punish them  


______________________________________________
"There is a crack in everything, that is how the light gets in"
--Leonard Cohen
0
 

Expert Comment

by:8_digits
ID: 8223818
I've ran into this problem before when I was making an excuse for a password program... for security reasons it can't be done.  Something that you could try to do is catch the computer in a loop by using a batch file with your program.  You could do this by typing:

:1
yourprog.exe
rem you can put qbasic /run yourprog.bas if you cant
rem compile to an exe
if errorlevel 1 goto 1

in anything.bat and then run anything.bat

This would only force the program to run again if they tried ctrl + break... but would punish them :)


______________________________________________
"There is a crack in everything, that is how the light gets in"
--Leonard Cohen
0
 

Expert Comment

by:8_digits
ID: 8223842
....Just read your profile in further depth; I didn't know you were a Visual Basic programmer.  I know limmited VB (as in 5 hours of study).

Sorry for the confusion.  :(
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:famtrad
ID: 8224271
oh no, don't be sorry, thanks for the input though.

But I think it's possible because I've read articles of people doing it but they didn't say how.

Don't know if you know or anybody know, the button that I'm talking about is physically added to the device through the electrical part to pause the scale.  Once the scale's paused by pressing that button, I'm suppose to capture that signal, how would I do that? What's the syntax?  By the way, to be more specific, the language I'm using is GW-BASIC.

Thanks
0
 
LVL 11

Expert Comment

by:pratap_r
ID: 8228618
hi famtrad

hmm.. long time since i worked with GW-Basic.. ;) let me see if i can take this one..

you can use the inp function to read from the port. btw which port are you using? and which pins?

you will have to use IN command in your for loop to check if you have any signals incomming...

+Pratap
0
 
LVL 11

Expert Comment

by:pratap_r
ID: 8228623
sorry typo, its not "INP" its just "IN".
0
 

Author Comment

by:famtrad
ID: 8232966
What kind of pin are you talking about? The serial pins?  I'm not sure, the electrician takes care of that and I take care of the programming part.

If we put the syntax code on the side, could you explain the logical side of this program, like what am I suppose to look for in order to write the syntax out?  How am I suppose to capture that incoming signal?

Thanks
0
 

Expert Comment

by:raseniero
ID: 8255635
put a break on a certain line of code!

you may put the mouse over a variable to see its value

in the intermediate window
try to print your variables or trace you algo!
0
 
LVL 11

Accepted Solution

by:
pratap_r earned 750 total points
ID: 8255757
raseniero, famtard is using GWBASIC no VisualBasic.. :)

anyway.. famtrad here is what you needed

the in or inp function takes one paramenter. the port number and waits for signals on that port. for example the com port is 1020.

the code might look like
while 1
  if inp(1020) <> 0 then
     'got a signal on one of the 8 bits
  end if
wend

thats the logic part.

by pins i meant the physical pins, they control how the signal is sent to your port (software port) on which inp is querying.

enjoy
pratap
0
 

Expert Comment

by:CleanupPing
ID: 9446712
famtrad:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 

Author Comment

by:famtrad
ID: 9448517
Actually I've solved this problem already.  I forgot to close this question.  The way I did it was, at the beginning of the program, it waits for a signal to come though, like a i/o to be pressed, once it's pressed, it goes down to this subroutine.  This subroutine will keep on looping until a i/o button is pressed again, then it will return to the program.  This is similar to what pratap_r logic, but the coding is different.  So I'm giving my points to him.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question