Need help to understand code in project Web Control and Monitoring

Home Forums MikroC Pro for PIC Project Discussions Need help to understand code in project Web Control and Monitoring

Viewing 7 reply threads
  • Author
    Posts
    • #5918
      pepoversesa
      Participant

      Hello! I’m very new to this type of project: Web-based control and monitoring with pic microcontroller. There are some lines in that project make me confuse.

      In SPI_Ethernet_UserTCP function has these lines:

      if(!memcmp(getRequest+6,"TA",2))RD0_bit = ~ RD0_bit;
      else if(!memcmp(getRequest+6,"TB",2))RD1_bit = ~ RD1_bit;

      From what I know: If 2 characters starting at index 6 are “TA” or “TB” => toggle Relay A or Relay B.

      My noob question is Why is index 6? Where that come from?

    • #5933
      Bitahwa Bindu
      Keymaster

      If Relay A is pressed, the web browser will send the following command to the PIC:

      GET /?TA = TOGGLE + RELAY + A

      ‘TA’ here starts at index 6.

    • #5935
      pepoversesa
      Participant

      Thanks for your reply sir. I have one more question. Is it possible to public my IP address so that other devices ( like smartphone with 3G/4G) can access it and control relay? I heard that Dynamic DNS can solve the problem but still I have no idea.

    • #5936
      Bitahwa Bindu
      Keymaster

      You can use the SPI_Ethernet_confNetwork() to configure the subnet mask, gateway and DNS server address.

      Read this to learn more: http://www.studentcompanion.co.za/interfacing-enc28j60-ethernet-controller-with-pic-microcontroller-mikroc/

      The rest is settings in your router but setting up the NAT.

      You can Google: “How to access local ip from outside network” to learn more.

    • #5937
      pepoversesa
      Participant

      Thank you. I have done some research. In NAT port, I saw 2 method from now. There are DMZ and Port Forwarding. So both methods are fine?

    • #5938
      Bitahwa Bindu
      Keymaster

      Use the one that works for you.

      This is computer networking and it’s got nothing to do with microcontroller programming.

    • #5942
      pepoversesa
      Participant

      Sorry for bothering you with serie of questions. Now if I want to store my webpage on cloud server (webpage is still the one you used in tutorial), what will change in the code? Thank you

    • #5943
      Bitahwa Bindu
      Keymaster

      Your question does not make sense. If you want to store the webpage in the cloud then it simple, store it in the cloud, you don’t need a microcontroller for that. Just use any cloud services and upload your webpage, you will be able to access it everywhere in the world.

      And again, this is not a microcontroller question, you can’t use our code in this scenario.

      If you need to access your webpage stored in cloud, you may use internet with maybe a wifi device like the ESP32 or ESP8266. This is a different project altogether different from this one.

      You can Google to learn more about that.

Viewing 7 reply threads
  • You must be logged in to reply to this topic.
Select your currency
EUR Euro
USD United States (US) dollar