View previous topic :: View next topic |
Author |
Message |
dbrown
Joined: 24 Jul 2004 Posts: 20
|
HTTP Usage |
Posted: Sun Aug 10, 2008 8:09 pm |
|
|
Hello,
I have just started to experiment with HTTP and the 3.3V ethernet controller. I have got the web server to work.
I would like to know if it is possible to get the data from the ADC without requesting the entire page. I am trying to display the data from the ADC in a Visual Basic form without having to use the entire web page? I have tried to use GET, but I was not able to get it to work.
Thanks for the help
David Brown |
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Mon Aug 11, 2008 2:36 am |
|
|
Your explanation is not very good.
Do you mean you want a web page to show the ADC data and update without constantly getting the entire page! OR you want a Visual Basic application to retrieve the ADC data and display it ?
Web page
The easiest way to do this would be to use AJAX. This is javascript within your web page that can request data from a source and display it.
Visual Basic.
You can either write a routine on the PIC which accepts UDP or TCP (easier) connection and send the data, you then write your VB app to make a connection and dislplay the data.
If you want to use the web interface then VB will need to do a "GET" or "POST" request, the PIC will then respond to this with the data from the ADC. It doesn't need to be a complete HTML formatted page, it can just be the ADC data you send back. Neither the PIC nor the VB app care if it has any HTML in it! The header which the PIC code should add is the important bit, your VB code should strip this, if you are using a built in object then this may well do it for you. I forget what they are in VB but there are some objects which make it very easy to request a page and retrieve the body data. |
|
|
dbrown
Joined: 24 Jul 2004 Posts: 20
|
HTTP usage |
Posted: Mon Aug 11, 2008 9:12 am |
|
|
Hello Wayne_
Thanks for the reply. I intend to have a Visual Basic form to display the data retrieved from the PIC as you have described in the Visual Basic Paragraph of your response.
If you could show me what the request to the pic would look like it would help a lot.
Thanks
Dave |
|
|
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
RE: |
Posted: Tue Aug 12, 2008 9:42 am |
|
|
You could consider using UDP instead of TCP. But UDP does not have any facility for detecting lost packages, you may have to implement this yourself.
But UDP is definitely faster as only the relevant data needs to be sent, if you are using Visual Basic it is quite easy to implement a UDP connection to the PIC.
thanks
arunb |
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Wed Aug 13, 2008 2:28 am |
|
|
This is not realy a question for this forum but,
Unfortunately I don't have access to VB at this time only VB.Net which is somewhat different, It may also depend on what versio of VB you are using !
Basically, on the tool bar there is an HTTP object which you plave on your form. You can then use this to make requests to a server (The PIC).
You specify a URL which will be something like "http://192.168.1.1/adc.html"
Where the IP address is the address of your PIC and the page is the request that will make your pic send the ADC data back.
After you issue the request you can access the data using the Body attribute of the HTTP object.
So after you place the object on the form and call it HTTP you will do something like
HTTP.URL = "http://192.168.1.1/adc.html"
HTTP.Get()
AnsiString adcData = HTTP.Body.Text
or it may be
HTTP.Get("http://192.168.1.1/adc.html")
AnsiString adcData = HTTP.Body.Text
Like I said, I don't have access to VB so this will not be quite right
You could ask on a VB forum somewhere, but this is very easy to do using VB. |
|
|
|