Page 1 of 1

Webserver

Posted: Fri Feb 23, 2007 6:02 pm
by luyg
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

Posted: Mon Feb 26, 2007 10:29 am
by Benj
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.

Posted: Mon Feb 26, 2007 10:40 am
by Steve
Flowcode has TCP/IP and UDP macros - these may help.

Posted: Mon Feb 26, 2007 9:28 pm
by luyg
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.
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.

Posted: Tue Feb 27, 2007 1:45 pm
by Benj
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.

Posted: Tue Feb 27, 2007 6:30 pm
by luyg
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.
Thank you, I'll work my way through.

Posted: Fri Dec 07, 2007 5:28 pm
by gromax
I have the same problem. Friends who use picbasic give me this code :
<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>
but i couldn't adapt it to the pic16F877A.
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:

Posted: Sat Dec 08, 2007 1:12 pm
by luyg
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.

Posted: Sat Dec 08, 2007 6:16 pm
by gromax
Thanks for this answer
i didn't see the guide for tcp-ip. I've just read it and it will be very helpfull, not only for my problem with control by web interface, but to study ethernet transmission too.