Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

BASIC Programming

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
famtrad
Asked:
famtrad
  • 3
  • 3
  • 3
  • +2
1 Solution
 
8_digitsCommented:
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
 
8_digitsCommented:
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
 
8_digitsCommented:
....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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
famtradAuthor Commented:
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
 
pratap_rCommented:
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
 
pratap_rCommented:
sorry typo, its not "INP" its just "IN".
0
 
famtradAuthor Commented:
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
 
rasenieroCommented:
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
 
pratap_rCommented:
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
 
CleanupPingCommented:
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
 
famtradAuthor Commented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 3
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now