Page 1 of 1

EB023 sending GET request

Posted: Thu Oct 08, 2015 1:57 pm
by lawliet
HALO GUYS
I'm trying to load a webpage from a EB-023-00-2 card controlled by a PIC16F877A
I'm using Flowcode V6. I tried in so many way but still doesn't work. I should load the page "/add.php?intru=2" on 10.65.225.104
Could you please help me ? Thanks.

Re: EB023 sending GET request

Posted: Thu Oct 08, 2015 3:24 pm
by LeighM
Hi
I'm not sure from your comment if you are using the EB-023-00-2 card controlled by a PIC16F877A as a web page server,
or if you are using it as a client to GET a page from another server?


Have you looked at some of our examples, such as the WiKi ...
http://www.matrixtsl.com/wiki/index.php ... tion_Guide

It would help if you could you post your Flowcode file?

Re: EB023 sending GET request

Posted: Fri Oct 09, 2015 7:19 am
by lawliet
Hello LeighM,
Basically what i want to achieve is to get the EB023002 Card to load the "/add.php?intru=2" page hosted on an external server,
that page is so that it adds a line too the Index page of the server, saying there has been a break in on the alarm system.
For the files, i just messed around with the TCP/IP component so I won't bother posting it.
Hopefully you can help me, thanks, Lawliet.

Re: EB023 sending GET request

Posted: Fri Oct 09, 2015 8:59 am
by LeighM
Setup your TCP/IP component properties (local IP, MAC, Gateway etc)

Call CreateTCPSocket macro to create the local socket,
then call TCPConnect macro with the remote IP and Port
use TxSendByte to put your request string into the send buffer (i.e. "GET /add.php?intru=2 HTTP/1.0\r\n\r\n")
call TxEnd to send the data to the remote server

Use RxDataAvailable macro to test for the reply, call that in a loop with delay and timeout,
if it returns non-zero then use RxReadByte to get the reply.

You can use GetSocketStatus macro to test for the socket status

Finally close the link with TCPClose

Hope that helps
Leigh

Re: EB023 sending GET request

Posted: Thu Oct 15, 2015 1:37 pm
by lawliet
Image
This is what i did and it still doesn't work, first, i can't use TxSendByte because i don't send a octet.
Anyway i tried with TxSendString, no success.
What's wrong with my Flowcode ?

Re: EB023 sending GET request

Posted: Fri Oct 16, 2015 8:34 am
by LeighM
Check your server socket details in TCPConnect(), most HTTP servers run on port 80, so Hi=0, Lo=80.
It might be worth testing the retval after TCPConnect() to check that the connection has been successful.
The GET request needs terminating with CR/LF (twice as I recall), so you need to add TxSendByte(13) and (10)
Also, after TxEnd it is best to wait for the reply, before closing the socket.

Do you have a display attached to your project?
It would help you to put the return values from the macros onto the display.

Re: EB023

Posted: Sat Oct 24, 2015 11:25 am
by bats23
I work with ECIO 40 and E023 (ENC28J60), when i try to create the hex file,with flocode 6, there is a trouble.
The message is:
Ping0ECIO4.c(124): error: total number of array elements can not exceed 0x100 (use -idx 2 compiler command line argument to remove this restriction)
...
How to procede ?

Re: EB023 sending GET request

Posted: Sat Oct 24, 2015 8:47 pm
by kersing
You need to reduce the size of the buffers/arrays to < 256 bytes.