Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Call signature does not match SPI_Ethernet_UserUDP

Status
Not open for further replies.

hungrymind

Newbie level 5
Joined
Jan 6, 2013
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,346
Hi,
I'm trying to use SPI Ethernet Library for my project.

But when I compiling it it shows error as "Call signature does not match the function definition signature 'SPI_Ethernet_UserUDP'"
When I search about this problem I found a solution as enable SSA Optimization in output setting. But I couldn't able to find that checkbox in Option windows.
I'm using mikroC PRO version 5.61
How to solve this trouble?

Code:
// duplex config flags
#define Spi_Ethernet_HALFDUPLEX     0x00  // half duplex
#define Spi_Ethernet_FULLDUPLEX     0x01  // full duplex
// mE ehternet NIC pinout
sfr sbit SPI_Ethernet_Rst at RC0_bit;
sfr sbit SPI_Ethernet_CS  at RC1_bit;
sfr sbit SPI_Ethernet_Rst_Direction at TRISC0_bit;
sfr sbit SPI_Ethernet_CS_Direction  at TRISC1_bit;
// end ethernet NIC definitions


// Lcd pinout settings
sbit LCD_RS at RD0_bit;
sbit LCD_EN at RD1_bit;
sbit LCD_D4 at RD2_bit;
sbit LCD_D5 at RD3_bit;
sbit LCD_D6 at RD4_bit;
sbit LCD_D7 at RD5_bit;

// Pin direction
sbit LCD_RS_Direction at TRISD0_bit;
sbit LCD_EN_Direction at TRISD1_bit;
sbit LCD_D4_Direction at TRISD2_bit;
sbit LCD_D5_Direction at TRISD3_bit;
sbit LCD_D6_Direction at TRISD4_bit;
sbit LCD_D7_Direction at TRISD5_bit;

const unsigned char httpHeader[] = "HTTP/1.1 200 OK Content-type: " ;  // HTTP header
//const unsigned char httpMimeTypeHTML[] = "text/html" ;              // HTML MIME type
const unsigned char httpMimeTypeScript[] = "text/plain" ;           // TEXT MIME type
unsigned char httpMethod[] = "GET /";

unsigned char   myMacAddr[6] = {0x00, 0x14, 0xA5, 0x76, 0x19, 0x3f} ;   // my MAC address
unsigned char   myIpAddr[4]  = {192, 168, 30, 50} ;                     // my IP address  192.168.30.50
unsigned char   getRequest[15] ;                                        // HTTP request buffer
unsigned char   dyna[30] ;                                              // buffer for dynamic response
unsigned long   httpCounter = 0 ;                                       // counter of HTTP requests

unsigned int    putConstString(const char *s)
        {
        unsigned int ctr = 0 ;

        while(*s)
                {
                Spi_Ethernet_putByte(*s++) ;
                ctr++ ;
                }
        return(ctr) ;
        }
 
 //#define putConstString  SPI_Ethernet_putConstString

        
unsigned int    putString(char *s)
        {
        unsigned int ctr = 0 ;

        while(*s)
                {
                Spi_Ethernet_putByte(*s++) ;

                ctr++ ;
                }
        return(ctr) ;
        }
//#define putString  SPI_Ethernet_putString

unsigned int SPI_Ethernet_UserTCP(unsigned char *remoteHost, unsigned int remotePort,   unsigned int localPort, unsigned int reqLength, char *canClose)
        {
        unsigned int    len;            // my reply length

        // should we close tcp socket after response is sent?
        // library closes tcp socket by default if canClose flag is not reset here
        // *canClose = 0; // 0 - do not close socket
                          // otherwise - close socket


        httpCounter++ ;                             // one more request done
        len=0;
        len = putConstString(httpHeader) ;              // HTTP header
        len += putConstString(httpMimeTypeScript) ;     // with text MIME type

        // add Hello World to reply
        len += putConstString("Hello World") ;

       // return to the library with the number of bytes to transmit
        return(len);
        }

unsigned int SPI_Ethernet_UserUDP(unsigned char *remoteHost, unsigned int remotePort, unsigned int destPort, unsigned int reqLength)
        {
        unsigned int    len ;                           // my reply length

        // reply is made of the remote host IP address in human readable format
        ByteToStr(remoteHost[0], dyna) ;                // first IP address byte
        dyna[3] = '.' ;
        ByteToStr(remoteHost[1], dyna + 4) ;            // second
        dyna[7] = '.' ;
        ByteToStr(remoteHost[2], dyna + 8) ;            // third
        dyna[11] = '.' ;
        ByteToStr(remoteHost[3], dyna + 12) ;           // fourth

        dyna[15] = ':' ;                                // add separator

        // then remote host port number
        WordToStr(remotePort, dyna + 16) ;
        dyna[21] = '[' ;
        WordToStr(destPort, dyna + 22) ;
        dyna[27] = ']' ;
        dyna[28] = 0 ;

        // the total length of the request is the length
        // of the dynamic string plus the text of the request
        len = 28 + reqLength;

        // puts the dynamic string into the transmit buffer
        SPI_Ethernet_putBytes(dyna, 28) ;

        // then puts the request string converted into upper char into the transmit buffer
        while(reqLength--)
                {
                SPI_Ethernet_putByte(toupper(SPI_Ethernet_getByte())) ;
                }

        return(len) ;           // back to the library with the length of the UDP reply
        }

void main(){
     TRISD=0x00;
     PORTD=0xAA;

      SPI1_Init();
      SPI_Ethernet_Init(myMacAddr, myIpAddr, Spi_Ethernet_FULLDUPLEX) ;
      
      //Initialize LCD
      Lcd_Init();
      Lcd_Cmd(_LCD_CLEAR);
      Lcd_Cmd(_LCD_CURSOR_OFF );
      Lcd_Out(1, 1, "IP");
      Lcd_Cmd(_LCD_SECOND_ROW);
      
     while(1){
              SPI_Ethernet_doPacket();
              

     }
}
 

hungrymind

Newbie level 5
Joined
Jan 6, 2013
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,346
Sorry guys. I forgot to include headers :-( Now ok it is compiling. But it is not simulating in proteus. :-( Is there any way to debug it?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top