ETHERNET LIBRARY WITH WEB SERVER EXAMPLE FOR PIC18F97J60 FAM

General discussion on mikroPascal.
Author
Message
kayh
Posts: 63
Joined: 22 Apr 2005 03:12

#46 Post by kayh » 25 Jun 2008 13:25

radiofm wrote:IE (IE7) have too much info in header and when we request from the pic page we lost 1 packet and unfortunetly .... on IE it not working.
Do I understand correct, IE7's HTTP header is too long and causes a packet to be dropped? py the pic :cry:
Or is the response header not readable by IE7?

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#47 Post by yo2lio » 02 Aug 2008 21:47

Hello all,

New version of Ethernet library is available.

With full open source code, examples and documentations.

You can download this library from here :
http://www.microelemente.ro/MikroPascal ... amples.zip

It's strongly recommended to DO NOT RECOMPILE SOURCE LIBRARY with other version of compiler than MikroPascal 7.0 !!!!

Enjoy !
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#48 Post by yo2lio » 20 Aug 2008 12:20

Library updated !

Added hw_cksum flag, default state false (Ethernet checksum in software)
User can modify this flag on the fly, (can chose between software checksum and hardware checksum)
Regarding ERRATA (JUL 2008) :? , hardware checksum is not recommended !

You can download this library from here :
http://www.microelemente.ro/MikroPascal ... amples.zip

It's strongly recommended to DO NOT RECOMPILE SOURCE LIBRARY with other version of compiler than MikroPascal 7.0 !!!!

Enjoy !
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#49 Post by yo2lio » 17 Oct 2008 13:28

Hello ALL,

Good News (17 OCTOBER 2008) , implemented :

- New Firewall Rules and Policy( drop or reject ) for unwanted packets.
- TCP Client (TCP_Open_Connection, TCP_Send, TCP_Close_Connection)
- TELNET Client.
- SMTP Client.
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#50 Post by yo2lio » 18 Oct 2008 21:14

SMTP Client example.

Display Number of available Messages in your Mail Box.

This example use incoming Eth_V4_0 / ENC_V4_0 library.

Image

Code example :

Code: Select all

  if dest_port_T = 110 then
    begin
      i := 0;
      while i < 32 do
        begin
          getRequest[i] := Eth_GetByte;
          inc(i);
        end;
      txt31 := '+OK Hello there.';
      if Mem_Cmp(@getRequest, @txt31, Str_Len(txt31)) = 0 then
        begin
          len_tcp_resp := CopyRamStringToEthMem_CP('USER office@yahoo.com);
          Eth_PutByte($0D);
          Eth_PutByte($0A);
          result := len_tcp_resp + 2;
          exit;
        end;
      txt31 := '+OK Password required.';
      if Mem_Cmp(@getRequest, @txt31, Str_Len(txt31)) = 0 then
        begin
          len_tcp_resp := CopyRamStringToEthMem_CP('PASS 7654TRGarT');
          Eth_PutByte($0D);
          Eth_PutByte($0A);
          result := len_tcp_resp + 2;
          exit;
        end;
      txt31 := '+OK logged in.';
      if Mem_Cmp(@getRequest, @txt31, Str_Len(txt31)) = 0 then
        begin
          len_tcp_resp := CopyRamStringToEthMem_CP('STAT');
          Eth_PutByte($0D);
          Eth_PutByte($0A);
          result := len_tcp_resp + 2;
          exit;
        end;
      txt31 := '+OK Bye-bye.';
      if Mem_Cmp(@getRequest, @txt31, Str_Len(txt31)) = 0 then
        begin
          result := 0;
          exit;
        end;
      txt31 := '+OK ';
      if Mem_Cmp(@getRequest, @txt31, Str_Len(txt31)) = 0 then
        begin
          i := 4;
          while getRequest[i] <> ' ' do
            begin
              messages_nb[i-4] := getRequest[i];
              inc(i);
            end;
          messages_nb[i-4] := 0;
          len_tcp_resp := CopyRamStringToEthMem_CP('QUIT');
          Eth_PutByte($0D);
          Eth_PutByte($0A);
          result := len_tcp_resp + 2;
          exit;
        end;
      exit;
    end;
main routine :

Code: Select all

    begin
      Eth_DoPacket;
      if NTP_Sync = false then Ntp_query;
      if TickCounter2 > 999 then
        begin
          TickCounter2 := 0;
          Get_Time;
          RemoveFirstNChr(TTime.Str, 10);
          text_ := ' Time ';
          Str_Cat(text_, TTime.Str);
          LcdOut(2,1,text_);
        end;
      if count_mess > 600 then
        begin

          messages_nb := '-1';

          if inc(TCP_opened_port) > 65000 then TCP_opened_port := 5000;
          
          TCP_Open_Port(TCP_opened_port);
          
          Open_TCP_Connection(user_ip_addr, dest_port, TCP_opened_port);
          
          count_mess := 0;
          while count_mess < 40 do
            begin
              Eth_DoPacket;
              if messages_nb[0] <> '-' then break;
            end;
            
          text_ := 'You have ';
          Str_Cat(text_, messages_nb);
          Str_Cat(text_, ' new messages');
          Str_Cat(text_, EOL);
          
          Send_UDP(user_ip_addr1, 10003, eth_port, Str_Len(text_), text_);
          
          TCP_Close_Port(TCP_opened_port);
          
          TickCounter2 := 0;
          if Str_Len(messages_nb) < 2 then Str_AppendPre(messages_nb, ' ');
          LcdOut(1,1,messages_nb);
        end;
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

rainer
Posts: 320
Joined: 07 Dec 2006 11:00
Location: Vienna, Austria
Contact:

#51 Post by rainer » 19 Oct 2008 08:15

Florin,

I am watching your work on Ethernet since a long while. Really impressing! Thumbs up! :D

It is really sad that this Ethernet.PICs have such a fine pin pitch, this always makes me afraid to use them with self built boards (where I have no soldering mask and the lines are also extremely fine). :(

Can you please tell me ...
a.) why MP7.0 has to be used _only_
b.) Which PICs are working with your library.
c.) how big the code of the above sample is? (How much ROM in the PIC is used)

Rainer

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#52 Post by yo2lio » 19 Oct 2008 08:29

Hello Rainer.

Library use 1.5 Kb of RAM and 25 Kb of Flash.

For developing I use PIC18F67J60, but ENC28J60 will work with any MCU which have more than 2Kb of RAM and 32 Kb of Flash. (PIC18F2620, PIC18F4620 for example).

Why MP 7.0 ? because is a very stable platform. You can use any version but with *.mcl file compiled by me.
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

rainer
Posts: 320
Joined: 07 Dec 2006 11:00
Location: Vienna, Austria
Contact:

#53 Post by rainer » 19 Oct 2008 09:53

Florin,

the ENC28J60 is an external device, and still working with the same library? Must have a look on your library.

Do you have a complete wiring scheme for a PIC (i.e. an 18F2685) using an ENC28J60? Pairing this two PICs results in a maximum of FLASH with simple "through-holes" wiring, so I can build up that without too many problems.
If you would possibly have an example of using such a setup, it would be excellent, because I never tried that before - so I want to exclude at least wrong wiring.

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#54 Post by yo2lio » 19 Oct 2008 10:42

rainer wrote:the ENC28J60 is an external device, and still working with the same library?
Yes it is, but part of library is the same for both ENC28J60 and PIC18F67J60 series.

Unfortunately I can't provide schematic for ENC28J60, I work now only with Ethernet inside MCU and soldering TQFP64 package it's not a problem for me.
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

rainer
Posts: 320
Joined: 07 Dec 2006 11:00
Location: Vienna, Austria
Contact:

#55 Post by rainer » 29 Nov 2008 13:01

Florin,
I'll get possibly a new project. Nothing extraordinary, only a WEB based mutiline switch.

Because I never used Ethernet PICs (TQFP), and this must be a special device, I must build my own PCB for it. It would be very kind if you could show me the schematic of one of your projects. This could prevent me from doing some stupid mistakes.

Rainer

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#56 Post by yo2lio » 29 Nov 2008 17:16

Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

jurizato
Posts: 6
Joined: 13 Feb 2009 00:20

Web Page

#57 Post by jurizato » 19 Feb 2009 04:30

Hello Florin.
Congratulation for yours infos!
I need some help. I planing to make a web server with a web page embeded, like your "Mini Web".
I have some questions:
1. What is the best html editor to make my page?
2. After ready, how I translate de html code to asm/hex Pic code?
3. How I ready and wirte values from/to variables from my application on the PIC? What code must I write in html page?
4. I will write some code in Pascal to the PIC18F87J60 make something, so how joint I theses codes? (code from Pascal and code from web page).
5. Have You or the another friends here, some tutorial about it?

Thank You very much!

cj_tomekk
Posts: 12
Joined: 20 Apr 2009 09:56

Re: ETHERNET LIBRARY WITH WEB SERVER EXAMPLE FOR PIC18F97J60

#58 Post by cj_tomekk » 01 Jun 2010 16:59

Hello, could you tell me if there is a limitation of tcp http responce from PIC i.e. can theoretical html file be larger than on packet size?

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

Re: ETHERNET LIBRARY WITH WEB SERVER EXAMPLE FOR PIC18F97J60

#59 Post by yo2lio » 01 Jun 2010 17:07

cj_tomekk wrote:Hello, could you tell me if there is a limitation of tcp http responce from PIC i.e. can theoretical html file be larger than on packet size?
No limitations, HTML page can have any size.
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

cj_tomekk
Posts: 12
Joined: 20 Apr 2009 09:56

Re: ETHERNET LIBRARY WITH WEB SERVER EXAMPLE FOR PIC18F97J60

#60 Post by cj_tomekk » 01 Jun 2010 17:44

Ok, nice to hear that :-) same for example for a picture? 64k or so :-)?

Post Reply

Return to “mikroPascal General”