I am using the internet board and i am trying to send data from a webpage to a controller (showing values on a webpage works fine). However, I can't find out how to do this.. can anybody help me?
Thanks
Webserver
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Hello Luyg
Your best bet is probably to use HTML based forms. Then when the suubmit button is pressed use a second page to catch the data and then get the PICmicro to scan for certain characters in the text. Not entirely sure how this is achieved at the moment.
Your best bet is probably to use HTML based forms. Then when the suubmit button is pressed use a second page to catch the data and then get the PICmicro to scan for certain characters in the text. Not entirely sure how this is achieved at the moment.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Hi, this is exactly where I get stuck. When I press send, the second page doesn't open but explorer says it can't find the page with the arguments.Benj wrote:Hello Luyg
Your best bet is probably to use HTML based forms. Then when the suubmit button is pressed use a second page to catch the data and then get the PICmicro to scan for certain characters in the text. Not entirely sure how this is achieved at the moment.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Maybe try google for answers. There must be a way of sending data through to the embedded system. Here is an example with a diagram of exactly how the data interacts with the protocols.
This example uses a PC to act as a server.
http://gdansk.bradley.edu/olekmali/proj ... ebRBot.htm
Obviously this is not what you want to achieve but it does contain information that I think is relevant to helping to get your system up and running.
This example uses a PC to act as a server.
http://gdansk.bradley.edu/olekmali/proj ... ebRBot.htm
Obviously this is not what you want to achieve but it does contain information that I think is relevant to helping to get your system up and running.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Thank you, I'll work my way through.Benj wrote:Maybe try google for answers. There must be a way of sending data through to the embedded system. Here is an example with a diagram of exactly how the data interacts with the protocols.
This example uses a PC to act as a server.
http://gdansk.bradley.edu/olekmali/proj ... ebRBot.htm
Obviously this is not what you want to achieve but it does contain information that I think is relevant to helping to get your system up and running.
I have the same problem. Friends who use picbasic give me this code :
No problem to show state of pic's variables on the web page
but i can't change a variable by a web button
in this code, it seems javascript doesn't work.
If any of you had an idea...![Wink :wink:](./images/smilies/icon_wink.gif)
but i couldn't adapt it to the pic16F877A.<html>
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Exprires" content="-1">
<title>Picbasic Web Server</title>
<style type="text/css">
.aff
{
BACKGROUND-COLOR:black;
COLOR:lime;
font-weight:bold;
}
.led1
{
BACKGROUND-COLOR:red;
COLOR:black;
font-weight:bold;
}
.led0
{
BACKGROUND-COLOR:silver;
COLOR:black;
font-weight:bold;
}
.LCD
{
BACKGROUND-COLOR:#6AD500;
COLOR:black;
font-weight:bold;
}
td
{
width:150
}
</style>
<script type="text/javascript">
function t(obj)
{
if(obj.value.length>32)
obj.value=obj.value.substring(0,32);
}
function env()
{
var a="";
var b=document.forms.F2;
for (i=0;i<4;i++) if (document.forms.F1.elements['O'+i].checked==true) a=a+1; else a=a+0;
b.elements['O'].value=a;
var T=b.elements['T'].value;
if (T.length<32)
{
for (i=T.length;i<32;i++) T=T+" ";
b.elements['T'].value=T;
}
b.submit();
}
</script>
</head>
<body>
<center><h1>Picbasic Web Server</h1>
<table cellpadding=10 border=1>
<tr>
<td>
<B>EntrΓ©es analogiques</B><br><br>
A0 = <input type=text name=A0 value=" $A0" size=5 class=aff readonly> v<br>
A1 = <input type=text name=A1 value=" $A1" size=5 class=aff readonly> v<br>
A2 = <input type=text name=A2 value=" $A2" size=5 class=aff readonly> v<br>
A3 = <input type=text name=A3 value=" $A3" size=5 class=aff readonly> v<br>
</td>
<td>
<B>EntrΓ©es logiques</B><br><br>
I0 = <input type=text name=I0 value=" $I0" size=1 class=led$I0 readonly><br>
I1 = <input type=text name=I1 value=" $I1" size=1 class=led$I1 readonly><br>
I2 = <input type=text name=I2 value=" $I2" size=1 class=led$I2 readonly><br>
I3 = <input type=text name=I3 value=" $I3" size=1 class=led$I3 readonly><br>
</td>
</tr>
<tr valign=top>
<td>
<form name=F1>
<B>Sorties logiques</B><br><br>
<script type="text/javascript">
var v=new Array("$O0","$O1","$O2","$O3");
for (n=0; n<v.length; n++)
{
if (v[n]=="1") s=" checked"; else s="";
document.write("O"+n+" = <input type='checkbox' name='O"+n+"' value='1'"+s+"><br>");
}
</script>
</td>
<td>
</form>
<B>Ecran LCD</B><br><br>
<form name=F2 method=get><input type=hidden name=O value="">
<textarea name=T rows=2 cols=16 class=LCD OnkeyUp="t(this)" OnkeyDown="t(this)">$T0</textarea>
</td>
</tr>
</table>
<small>$CP connexion(s) depuis la dernière remise à zéro du serveur.<br>
<br>
<input type=button name=ENV value="ENVOYER" OnClick="env()">
</form>
<a href="http://www.rdelectronique.com" target="_blank">www.RDElectronique.com</a>
</body>
</html>
No problem to show state of pic's variables on the web page
but i can't change a variable by a web button
in this code, it seems javascript doesn't work.
If any of you had an idea...
![Wink :wink:](./images/smilies/icon_wink.gif)
I don't think it works that way with the E-block webserver element. I found a way around it, but I needed to study the TCP/IP solution Teacher note manual for the E-blocks. You can find the manual on this website.
By using the tcp/ip element instead of the webserver element you can write html pages to a pc or read html pages from a webserver (in the latter case, I used TinyWeb as server on a pc and it enabled me to get data from a webpage on the pc to the pic), due to a lack of time however I did not work further on it.
By using the tcp/ip element instead of the webserver element you can write html pages to a pc or read html pages from a webserver (in the latter case, I used TinyWeb as server on a pc and it enabled me to get data from a webpage on the pc to the pic), due to a lack of time however I did not work further on it.