Using the Arduino Ethernet shield with AMICUS18 (Joint forum project?)


Closed Thread
Results 1 to 40 of 63

Hybrid View

  1. #1
    Join Date
    Mar 2014
    Posts
    5

    Default Re: Using the Arduino Ethernet shield with AMICUS18 (Joint forum project?)

    hello henrik

    thanks you for help and the pbp source code,

    i was modifie your code for proton basic , and i was use 18F4620 , now wprking very stabile.

    my web server
    Name:  1.bmp
Views: 2042
Size:  1,005.7 KB



    - ping it is ok!
    - web server it is ok
    - send get ang command it is ok
    - response and data it is ok

    but i have any problem,

    it is my html code,

    how to use scrip in to do code?

    index:


    Buffer = "<html>" : GoSub PutStringInTXBuffer
    Buffer = "<body>" : GoSub PutStringInTXBuffer
    Buffer = "<title>my server</title>" : GoSub PutStringInTXBuffer

    Buffer = "<h3>My Mini Web Server Alive</h3>" : GoSub PutStringInTXBuffer

    Buffer = "<img src=http://www.enkatechnology.com/12.jpg >" : GoSub PutStringInTXBuffer


    Buffer = "<p>Thenk you Henrik Olsson 2014</p>" : GoSub PutStringInTXBuffer

    Buffer = "<form name=input action=/ method=get>" : GoSub PutStringInTXBuffer
    Buffer = "<input type=submit align=center name=tst1 value=3 />" : GoSub PutStringInTXBuffer
    Buffer = "</form>" : GoSub PutStringInTXBuffer


    Buffer = "<form name=input action=/ method=get>" : GoSub PutStringInTXBuffer
    Buffer = "<input type=submit align=center name=tst2 value=5 />" : GoSub PutStringInTXBuffer
    Buffer = "</form>" : GoSub PutStringInTXBuffer


    Buffer = "<a href=http://www.google.com>Go To Google</a>" : GoSub PutStringInTXBuffer

    'Buffer = "<p> toplam request = " + Str$(Dec RequestCount) + "</p>" : GoSub PutStringInTXBuffer


    Buffer ="<p>AN2 Data= </p>" : GoSub PutStringInTXBuffer
    Buffer ="<script src=/s></script>" : GoSub PutStringInTXBuffer
    Buffer ="<p><script>document.write(AN2)</script></p>" : GoSub PutStringInTXBuffer





    Buffer = "</body></html>" : GoSub PutStringInTXBuffer



    Return


    i wat to use <script src=/s></script> and turn the back "<p><script>document.write(AN2)</script></p>" AN2 = 27 for exp. what you thing about?



    i was receive "s" and portc.2 led is blinking but, i dont send the AN2 data to back.

    my data receive code,

    data_kontrol:


    '----------------------------------
    If Buffer[11] = "3" Then
    PORTC.2 = 1'led aç
    'END
    EndIf
    '----------------------------------
    If Buffer[11] = "5" Then
    PORTC.2 = 0'led kapat
    'END
    EndIf
    '----------------------------------
    If Buffer[5] = "s" Then
    PORTC.2 =1
    DelayMS 500
    PORTC.2 =0
    EndIf


    Return
    Last edited by tayfun; - 27th April 2014 at 17:26.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612

    Default Re: Using the Arduino Ethernet shield with AMICUS18 (Joint forum project?)

    Hi,
    Nice work! I'm glad the code is getting some use!

    I know very little about HTML and even less about JAVA Script (which I suspect is what Document.Write() is?

    However, doing document.write(AN2) where I'm guessing AN2 is a variable in you PBP (Proton) program probably isn't working the way you expect. For it to work the way you've coded it the PutStringInTxBuffer routine would need to be able to decode and understand Java Script, find AN2 and put its content, as a string into the buffer - that's obviously NOT how it works or is intended to work.

    Again, I'm very green on this HTML and JAVA stuff so I may be wrong but that's how I think it works.

    In PBP, to load a "value" from a variable into an array as a string you could use ArrayWrite, I'm not sure how to do that in Proton but I'm sure there's some ToStr or whatever.

    Does that make sense?

    /Henrik.

  3. #3
    Join Date
    Mar 2014
    Posts
    5

    Default Re: Using the Arduino Ethernet shield with AMICUS18 (Joint forum project?)

    it is ok, is ok! work fine...

    i will new stage , w5100 use with sd card, and screen any picture or complicate html pages. ty .. bye.




    this is code,
    '------------------------------------------------------------------------------------------------------------------------

    send_back_result:


    RequestCount = RequestCount + 1
    GoSub GetFreeTXSize
    TotalCount = 0

    Buffer = "HTTP/1.1 200 OK "+13+10+0
    GoSub PutStringInTXBuffer
    Buffer = "Content-Type:text/html"+13+10+13+10+0
    GoSub PutStringInTXBuffer

    '---------server side------------------------------------client side----------------------------------------------------

    If Buffer[5] = "s" Then '<--------------------- send me "s" block <script src=s></script>"


    Buffer = "var AN2=" ' <------------send me AN2 variable <script>document.write(AN2)</script
    GoSub PutStringInTXBuffer

    Buffer = "1977" '-------------------> put string "1977" or any string variable
    GoSub PutStringInTXBuffer

    Buffer = ";"
    GoSub PutStringInTXBuffer' -------------------> and put end of the string.

    EndIf

    '--------------------------------------- end of the cominicate

    WizPtr = WizPtr + TotalCount ' load others... end.


    WizAdress = W5100_S0_TX_WR0 : WizData = WizPtr.HighByte : GoSub Write_W5100
    WizAdress = W5100_S0_TX_WR1 : WizData = WizPtr.LowByte : GoSub Write_W5100

    ' Issue a SEND command.
    WizAdress = W5100_S0_CR : WizData = W5100_Sn_SEND : GoSub Write_W5100

    WaitForCompletion2:
    GoSub Read_W5100
    If WizData <> 0 Then GoTo WaitForCompletion2



    ' Then disconnect from the client.
    WizAdress = W5100_S0_CR : WizData = W5100_Sn_DISCON : GoSub Write_W5100

    ' And close the socket. We'll reopen the socket again in the main routine.
    WizAdress = W5100_S0_CR : WizData = W5100_Sn_CLOSE : GoSub Write_W5100

    GetRequest = 0




    Return

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts