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 3 reply threads
  • Author
    • #5918

      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

      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

      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

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

      Read this to learn more:

      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.

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