Author Topic: how to control PIC I/O with many Web buttons ?  (Read 5144 times)

lcoulon

  • Newbie
  • *
  • Posts: 2
    • View Profile
how to control PIC I/O with many Web buttons ?
« on: October 05, 2008, 01:55:09 AM »
Hello

I'm using  C18 Micropchip compiler with Ethernet stack 3.75

I've problem to add more than 10 web buttons in my web page due to cgi command codes 1 numercical digit limitation.


i spent much time on how adding more than 10 cases, but it still won't work  :?


Here what is tried, as only 1 numerical value has to be set for cgi command codes i tried to declare another CGI Command codes serie named (CGI_CMD_DIGOUT1)
This should allow me to get 10 more cases , isn't it ?

Can someone be kind to tell what i done wrong ?

The second serie ( CGI_CMD_DIGOUT1 ) does not work : when i click to the associate web button nothing happens ...
i put as comment for each case what i've wrote in index.htm, maybe there a problem here ?

Please help to find what is wrong, i will really appreciate your help.


Code: [Select]
// CGI Command Codes

#define CGI_CMD_DIGOUT      (0)
#define CGI_CMD_DIGOUT1     (3)

// // CGI Command codes (CGI_CMD_DIGOUT)

#define CMD_LED0           (0x0)       
#define CMD_PORTAIL        (0x1)       
#define CMD_ECLAIRAGE      (0x2)
#define CMD_OPTION         (0x3)
#define CMD_GARAGE1        (0x4)
#define CMD_GARAGE2        (0x5)
#define CMD_IR_learn_2     (0x6)         
#define CMD_IR_read_2      (0x7)       
#define CMD_IR_learn_3     (0x8)       
#define CMD_IR_read_3      (0x9)       

// CGI Command codes (CGI_CMD_DIGOUT1)

#define CMD_IR_learn_4        (0x0)       
#define CMD_IR_learn_5        (0x1)       





void HTTPExecCmd(BYTE** argv, BYTE argc)
{
 BYTE command, var;

#if defined(ENABLE_REMOTE_CONFIG)
 BYTE CurrentArg;
 WORD_VAL TmpWord;
#endif

 // Design your pages such that they contain command code as a one
 // character numerical value.
 // Being a one character numerical value greatly simplifies the job
 command = argv[0][0] - '0';

 // Find out the cgi file name and interpret parameters accordingly
 switch(command)
 {
 case CGI_CMD_DIGOUT:     // ACTION = 0
   
    // Identify the parameters. Compare it in upper case format
    var = argv[1][0] - '0';

    switch(var)
    {

                                                 // NAME=0
     case CMD_LED0:       
        LED0_IO ^= 1;                            // Toggle LED
        break;


     case CMD_PORTAIL:                            // NAME=1            check the case in index.htm :     GetServerFile('0?1=I01','')
        TEMPO_PORTAIL ^= 1;                      // toggle RB1 = 1
         break;

     
    case CMD_ECLAIRAGE:                          // NAME=2            check the case in index.htm :     GetServerFile('0?2=I02','')
        TEMPO_ECLAIRAGE ^= 1;                    // toggle RA4 = 1
        break;


     case CMD_OPTION:                              // NAME=3            check the case in index.htm :     GetServerFile('0?3=I03','')
        TEMPO_OPTION ^= 1;                        // toggle RA5 = 1
        TEMPO_OPTION_TickSample = TickGet();      // Initializes the counter for timer
         break;


     case CMD_GARAGE1:                              // NAME=4            check the case in index.htm :     GetServerFile('0?4=I04,'')
        TEMPO_GARAGE1 ^= 1;                        // toggle RA0 = 1
        break;


     case CMD_GARAGE2:                              // NAME=5            check the case in index.htm :     GetServerFile('0?5I05,'')
        TEMPO_GARAGE2 ^= 1;                       // toggle RA1 = 1
        break;


     case CMD_IR_learn_2:                          // NAME=6            check the case in index.htm :     GetServerFile('0?6I06,'')
       UART_TXREG = 0b00110010;
        //DelayMs(3000);                       
        break;

     case CMD_IR_read_2:                          // NAME=7            check the case in index.htm :     GetServerFile('0?7I07,'')
       UART_TXREG = 0b01110010;
        break;
     

     case CMD_IR_learn_3:                           // NAME=8           check the case in index.htm :     GetServerFile('0?8I08,'')
       UART_TXREG = 0b00110011;
        break;


     case CMD_IR_read_3:                          // NAME=9            check the case in index.htm :     GetServerFile('0?9I09,'')
       UART_TXREG = 0b01110011;
        break;
     }

 
// Goes to another case series in order to get more Web button to perform actions :


 command = argv[0][0] - '0';

    switch(command)
 {

 var = argv[1][0] - '0';



 case CGI_CMD_DIGOUT1:                     // ACTION = 0           
   
    switch(var)
    {

     
     case CMD_IR_learn_4:                  // NAME=0                check the case in index.htm :     GetServerFile('3?0=J00,'')
       //UART_TXREG = 0b00110100;
         TEMPO_GARAGE1 = 1;
        break;



     case CMD_IR_learn_5:                  // NAME=1                check the case in index.htm :     GetServerFile('3?1=J01,'')
       //UART_TXREG = 0b00110100;
         TEMPO_GARAGE1 = 1;
        break;


     }

 }


cbektas

  • Full Member
  • ***
  • Posts: 10
    • View Profile
Re: how to control PIC I/O with many Web buttons ?
« Reply #1 on: October 05, 2008, 03:46:18 AM »
hello ,
i dont have microchip stack 3.75 only from modtronix so maybe what i say is wrong.
principial is it possible i do it with my http.
Can u send me your microchip stack complete  i would take time and see with u.
By the way why do u use httpexeccmd(**) wirt pointer of pointer ???
best regards
cbektas

my mail adress : [email protected]

lcoulon

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: how to control PIC I/O with many Web buttons ?
« Reply #2 on: October 05, 2008, 07:43:54 AM »
Thanks for your response,

the stack i use is from Microchip and can be find here : http://www.ljcv.net/projects/mchptcp3.75/index.html

the board i use that one : http://www.ljcv.net/eip10/


My problem regards how adding more than 10 Web buttons to pilot Pic I/O. ( as i explained in my post )
The main code of the program is located in src folder / main.c file.

Many thanks for your help,


Bipsype09

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
    • single russian brides
how to control PIC I/O with many Web buttons
« Reply #3 on: December 28, 2009, 03:55:34 PM »
hi, i have a few buttons that i can successfully control my Stack component with. this part work perfectly. but i want to have a "selected" state in my buttons, so as the slideshow runs from one slide to another, the corresponding buttons will switch to their selected states.

so, is there a way to fire off a command when a slide is selected that I can then tap into my button code?

maybe an if statement? Im not sure how to pull this off in as3

thanks