Hello Atodos a happy 2013 to all can someone help me
Hello Atodos a happy 2013 to all
I made a small program to drive a robot using the PicBasic program I made in visual basic 6
I'm with a difficulty of making the robot motors stop when I release the button on the keyboard.
I need the pic reset all ports without using VISULA basic.Eu program could do more on own pic is connecting the engine and deligando
The program's pic is here.
A hug to everyone
Include "modedefs.bas"
TRISA=1 'PORT A input
TRISB=%00001111 'PORT B output
PORTB=0
RX VAR BYTE
PROG:
SERIN PORTA.0,T9600,RX
IF RX = "A" THEN FRT
IF RX = "B" THEN TRA
IF RX = "C" THEN DIR
IF RX = "D" THEN ESQ
GOTO PROG
FRT:
HIGH 4
HIGH 6
GOTO PROG
TRA:
HIGH 5
HIGH 7
GOTO PROG
DIR:
HIGH 5
HIGH 6
GOTO PROG
ESQ:
HIGH 4
HIGH 7
GOTO PROG
Re: Hello Atodos a happy 2013 to all can someone help me
How about adding another case
IF RX = "S" THEN StopAll
StopAll:
LOW 4
LOW 5
LOW 6
LOW 7
goto PROG
Re: Hello Atodos a happy 2013 to all can someone help me
hello Jerson
in this case the letter s has to come from vb6
has another way to do this pic
thanks for the reply
Re: Hello Atodos a happy 2013 to all can someone help me
Unfortunately, there is no way you can know when the key has stopped. So, you have 2 alternatives
1 - Let each command run for a small fraction of time before going back to prog
example
Code:
FRT:
HIGH 4
HIGH 6
pause 100
LOW 4
LOW 6
GOTO PROG
2 - Put a timeout. So, if Serin does not give you a character, turn off all outputs
SERIN PORTA.0,T9600, 1000, Timeout, RX
Timeout:
Code:
LOW 4
LOW 5
LOW 6
LOW 7
goto PROG
This is from the manual
An optional Timeoutand Labelmay be included to allow the program
to continue if a character is not received within acertain amount of time.
Timeoutis specified in 1 millisecond units. If the serial input pin stays in
the idle state during the Timeouttime, the program will exit the SERIN
command and jump to Label
Re: Hello Atodos a happy 2013 to all can someone help me
Hello Jerson
Thanks for the reply
I made the example 2 it more of a lock works very well.
look at the video http://www.youtube.com/watch?v=I-_4r...ature=youtu.be
thank you
Re: Hello Atodos a happy 2013 to all can someone help me