Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 qbasic program problem...
Index -> Programming, Visual Basic and Other Basics -> Other Basics
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ruscutie




PostPosted: Sun Mar 30, 2008 11:05 am   Post subject: qbasic program problem...

alrite i was programming my circuit which has 16 LEDs in it...
so i encountered a problem...
i will start with an example
Quote:

PRINT "my name is blah blah"
PRINT "I'm awake"
END


you know when i run this program it will print both the things.... if i want the program to put the 1st line and the 2nd line in a blank screen again, i'll have to put CLS in between them....

so i'm programming LEDs...

Quote:


for i = 1 to 10000
out &h3bc, 232
out &h3bc, 228
out &h3bc, 226
out &h3bc, 225
next i

end


"OUT" means to provide electricity to one of my pins in the parallel port... &h3bc is the address of my parallel port and the number 232... is the address of each pin...
so when the program ends at pin number 225, it keeps on sending electricity to the pin..
how do i stop it..
in other words is there anything like "CLS" or something which will help me to execute the program totally... i mean i use "END" but it tells the computer to stop reading lines but it doesn't stop sending the electricity casuing my LED to stay lit...


thnx... hopefully i explained my problem well... Smile [/quote]
Sponsor
Sponsor
Sponsor
sponsor
OneOffDriveByPoster




PostPosted: Sun Mar 30, 2008 11:25 am   Post subject: Re: qbasic program problem...

Binary == Decimal
1110 1000 232
1110 0100 228
1110 0010 226
1110 0001 225
1110 0000 224

So try sending 224.
ruscutie




PostPosted: Sun Mar 30, 2008 11:41 am   Post subject: Re: qbasic program problem...

OneOffDriveByPoster @ Sun Mar 30, 2008 9:25 pm wrote:
Binary == Decimal
1110 1000 232
1110 0100 228
1110 0010 226
1110 0001 225
1110 0000 224

So try sending 224.


well you are right... the program will work but the only problem is the teacher has asked me to flash each column thrice.... the LEDS are in a (4*4 ) formation... so 4 LEDs in one column and 4 LEDs in one row... it adds up to 16 LEDs...

well the number 224 is not one of the address for the LEDs, well i can add it but the thing is i can't flash 5 LEDs.. it just needs 2 be one column... so four of them... here is my prgram..

Quote:

for j = 1 to 3
for i = 1 to 10000
out &h3bc, 225
out &h3bc, 209
out &h3bc, 177
out &h3bc, 113

next j
SLEEP 2
next i


so it flashes the LEDs three times and after everytime the program flashes them it will wait for 2 seconds, and then flash it again.....
but the problem is the last LED at 113 stays on... the computer doesn't stop sending the signal to it... so it doesn't flash...
so if i even turn on just one LED using


Quote:

for i = 1 to 10000
out &h3bc, 232
next i


even after the program ends , the LED stays on... so i need a command to execute the program or some kind of a diversion... i don't know if delay statements would work... i don't know how to use them but our teacher asked us to use them.. i can try it... can you telll me how 2 use a delay statement or if you have some other idea...
ruscutie




PostPosted: Sun Mar 30, 2008 11:45 am   Post subject: Re: qbasic program problem...

if someone knows how to use the timer function... i think it should work...
OneOffDriveByPoster




PostPosted: Sun Mar 30, 2008 4:23 pm   Post subject: Re: qbasic program problem...

Did you try sending 224? What did and 225, 226, 228, 232 light? Your sematic is not quite making sense--you don't seem to be connecting the end of your LED columns to anything...
Anyhow, 224, 225, etc. are not really addresses... they are values you are setting (so you are really setting multiple pins--not one pin). SLEEP is fine for introducing delays.
ruscutie




PostPosted: Sun Mar 30, 2008 5:26 pm   Post subject: Re: qbasic program problem...

OneOffDriveByPoster @ Mon Mar 31, 2008 2:23 am wrote:
Did you try sending 224? What did and 225, 226, 228, 232 light? Your sematic is not quite making sense--you don't seem to be connecting the end of your LED columns to anything...
Anyhow, 224, 225, etc. are not really addresses... they are values you are setting (so you are really setting multiple pins--not one pin). SLEEP is fine for introducing delays.


thanks... i figured out a way to stop them from lighting... after i put the address of the LED and then i put
Quote:
out &h3bc, 0
then the LED stopped lighting.. i used that for all the programs i made... i guess its more of a diversion of the electrical signal...

i used sleep function... it worked pretty good...

thnx for all your help and srry about the schematic... i'm new to all this stuff, so i was not able to explain my problems properly....
OneOffDriveByPoster




PostPosted: Sun Mar 30, 2008 6:02 pm   Post subject: Re: qbasic program problem...

ruscutie @ Sun Mar 30, 2008 5:26 pm wrote:
thnx for all your help and srry about the schematic... i'm new to all this stuff, so i was not able to explain my problems properly....
No problem. Sending 0 was going to be my next suggestion anyway. Good that you were able to find that yourself.
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Other Basics
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: