So So but I can't find the answer on it
I misread your post before...
Send K and another value from the PC " K3 " for example.Code:SERIN PORT?.?,N9600,[K],myVar IF myVar = 3 THEN gosomeplace or dosomething
The PIC will wait for the "K". When the PIC receives a "K" the next character will be written to myVar.
Dave
Always wear safety glasses while programming.
Hi..
thank u alot I lik [Always wear safety glasses while programming]
I forget to tell u I am new in PICBASIC PRO now only 2 weeks. I think the code will be like this:
define osc 4
include "bs2defs.bas"
wait:
SERIN PORTa.1,N9600,["K3"],myVar
IF myVar = 3 THEN out
out:
HIGH PORTb.7
PAUSE 300
LOW PORTb.7
goto wait
but I cant understand [myvar]. How I can decide it???
Thank u in advance.
Code:define osc 4 include "bs2defs.bas" wait: SERIN PORTa.1,N9600,["K"],myVar IF myVar = 51 THEN out ' Ascii 51 = decimal 3 (When you type 3 myvar will be 51) goto Wait ' this line is esential otherwise any key will activate the function out: HIGH PORTb.7 PAUSE 300 LOW PORTb.7 goto wait
This is the code that Dave suggested.
From keyboard type K3 to activate portB.7 for 300 millisecs.
Al.
Last edited by aratti; - 11th July 2009 at 16:35.
All progress began with an idea
Now I am using windows hyper terminal to send serial signal. When I am sending [k] from it the terminal send it in ascii or in hex??
I think send it in Ascii!!!
so I have to send [k] or [k3]??
and becuse I am new in PICBASIC PRO I can't understand how I can decide [myvar]
Can u help ??
Read the post from Al very carefully. He has everything there you need.
Not sure what you mean by deciding "myVar". It is just a variable
to store a value. The serin command will write data to that
variable and the if/then part checks to see what the value is.
Oh, the safety glasses thing. It is not a joke.
Dave
Always wear safety glasses while programming.
Bookmarks