CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Flexible 4x20 LCD Driver and CCS C TCP IP Stack

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
drx2k



Joined: 31 Mar 2010
Posts: 10

View user's profile Send private message

Flexible 4x20 LCD Driver and CCS C TCP IP Stack
PostPosted: Wed Jun 13, 2012 9:07 am     Reply with quote

Hi! How to use properly the flexible 4x20 lcd driver and ccs c tcp ip stack together?


I tried to use it together but the lcd display don't respond.

I'm using PIC18F4620, and I connect the RS, RW, E, D4-D7 to port D of PIC18F4620.

I also tried to use the dlcd.c and it works, but it works only for 2 x 20 / 2x16 lcd.

What modification do I need to make the dlcd.c for 4x20 type lcd?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jun 13, 2012 5:18 pm     Reply with quote

dlcd.c is on pudn, and it's simply the traditional old CCS driver, called lcd.c
which he has renamed.

CCS has a 4x20 driver based on the same code, and it's in this location:
Quote:

c:\program files\picc\drivers\lcd420.c
drx2k



Joined: 31 Mar 2010
Posts: 10

View user's profile Send private message

1st problem solve
PostPosted: Sun Jun 17, 2012 9:45 am     Reply with quote

Hi! I already solve my problem regarding TCP IP and Flexible LCD

i just comment the #use fast_io(D) in hardware.h so that i can use the flexible lcd driver

my problem now is how to use FAT MMC/SD Card in TCP IP Stack

I tried to use the example (ex_st_webserver2.c) but it's not working

and I also tried to modify it and but it still not working, i can't connect to ftp, sd card is not activating


btw. I'm using Proteus ISIS to test program using TCP IP Stack in PIC18F4620

Is there any example in how to use TCP IP Stack and MMC/SD Card that are easy to understand?

TIA
drx2k



Joined: 31 Mar 2010
Posts: 10

View user's profile Send private message

My Code
PostPosted: Sun Jun 17, 2012 9:53 am     Reply with quote

webserver mmc.c
Code:
//You must set one (and only) one of these to TRUE to tell the stack what hardware layer you are using
#define STACK_USE_MAC   1      //use the nic card

//define only one of these file systems
#define STACK_USE_FAT   1     //FAT file system on MMC
#define STACK_USE_MPFS  0    //Microchip's MPFS simulated file system


//if you want to be able to upload new files, set either one of these to TRUE.
#define STACK_USE_FTP         1   //FTP Server
#define STACK_USE_TFTP        0    //TFTP Server


#define HTTP_USE_AUTHENTICATION  1


#if STACK_USE_MAC
 #define STACK_USE_DHCP  TRUE  //for auto resolution of IP address
 #define STACK_USE_ARP   TRUE  //needed to resolve MAC addresses of IP addresses
 #define STACK_USE_UDP   TRUE  //needed for dhcp
#endif


#define STACK_USE_ICMP        TRUE   //Enabled for ping support
#define STACK_USE_TCP         TRUE   //To send TCP packets (talk to HTTP clients)
#define STACK_USE_HTTP2       TRUE    //CCS webserver with MMC/MPFS
#define STACK_USE_IP_GLEANING FALSE  //Disable Microchip's propietary auto-IP configuration



#include "ccstcpip.h"
#include "flex_lcd420.h"


char g_HTTPMessageStack[20];
char g_HTTPLCDMessage[20]="CCS Webserver2";
int8 g_LEDState[2]={0,0};

//this isn't a required callback, this is an application function being
//used by http_format_char.
int http_format_char_checked(int8 flag, char *str)
{
   int len=0;

   if (flag)
   {
      sprintf(str,"checked=\"checked\"");
      len = 7;
   }

   return(len);
}

//this is a callback function to the HTTP stack. see http.c
//The following escape characters are used:
//  %0 - AN0
//  %1 - AN1
//  %2 - BUTTON0
//  %3 - BUTTON1
//  %4 - Current LCD Message
//  %5 - CHECKED if LED1 is ON
//  %6 - CHECKED if LED1 is OFF
//  %7 - CHECKED if LED2 is ON
//  %8 - CHECKED if LED2 is OFF
//  %F - Message stack
int8 http_format_char(char* file, char id, char *str, int8 max_ret) {
   char new_str[25];
   int8 len=0;
   int8 i;

   switch(id) { 
      case '0':
         set_adc_channel(0);
         delay_us(100);
         i=read_adc();
         sprintf(new_str,"<B>AN%U = </B>0x%X",0,i);
         len=strlen(new_str);
         break;

      case '1':
         set_adc_channel(1);
         delay_us(100);
         i=read_adc();
         sprintf(new_str,"<B>AN%U = </B>0x%X",1,i);
         len=strlen(new_str);
         break;

      case '2':
         sprintf(new_str,"<B></B>");
         if (!input(USER_BUTTON1))
            sprintf(&new_str[7], "DOWN");
         else
            sprintf(&new_str[7], "UP");
            len=strlen(new_str);
         break;

      case '3':
         sprintf(new_str,"<B></B>");
         if (!input(USER_BUTTON2))
            sprintf(&new_str[7], "DOWN");
         else
            sprintf(&new_str[7], "UP");
            len=strlen(new_str);
         break;


      case '4':
          //len = http_format_char_checked(g_LEDState[0], new_str);
         sprintf(new_str,"<B></B>");
         if(g_LEDState[0]==1)
            sprintf(&new_str[7], "ON");
         else
            sprintf(&new_str[7], "OFF");
            len=strlen(new_str);
         break;

      case '5':
         //len = http_format_char_checked(g_LEDState[1], new_str);
         sprintf(new_str,"<B></B>");
         if(g_LEDState[1]==1)
            sprintf(&new_str[7], "ON");
         else
            sprintf(&new_str[7], "OFF");
            len=strlen(new_str);
         break;

      case '6':
         strncpy(new_str, g_HTTPLCDMessage, sizeof(new_str));
         new_str[sizeof(new_str)-1] = 0;
         len = strlen(new_str);
         break;

      case '7':
         strncpy(new_str, g_HTTPMessageStack, sizeof(new_str));
         new_str[sizeof(new_str)-1] = 0;
         len = strlen(new_str);
         g_HTTPMessageStack[0] = 0;
         break;
   }

   if (len){
      strncpy(str, new_str, max_ret);
   }else
      *str=0;

   return(len);
}

//this is a callback function to the HTTP stack. see http.c
//in this example it verifies that "pwd" is "master", if it is
//then it sets led1 and led2 ("led1" and "led2") based on their value
//and changes the lcd screen ("lcd").
void http_exec_cgi(char* file, char *key, char *val) {
   static char led1_key[]="led1";
   static char led2_key[]="led2";
   static char lcd_key[]="lcd";
   static char msgStack_key[]="msgStack";
   int8 v;

   v=atoi(val);

   //fprintf(USER, "\r\nval: %s", val);
   if (stricmp(key,led1_key)==0)
   {
      g_LEDState[0]=v;
     
      if (g_LEDState[0])
         LED_ON(USER_LED1);
      else
         LED_OFF(USER_LED1);
   }
   
   if (stricmp(key,led2_key)==0)
   {
      g_LEDState[1]=v;
     
      if (g_LEDState[1])
         LED_ON(USER_LED2);
      else
         LED_OFF(USER_LED2);
   }
   
   if (stricmp(key, msgStack_key)==0)
   {
      strncpy(g_HTTPMessageStack, val, sizeof(g_HTTPMessageStack));
      g_HTTPMessageStack[sizeof(g_HTTPMessageStack)-1] = 0;
      printf("\f%s",val);
   }
   
   if (stricmp(key,lcd_key)==0)
   {
      strncpy(g_HTTPLCDMessage, val, sizeof(g_HTTPLCDMessage));
      g_HTTPLCDMessage[sizeof(g_HTTPLCDMessage)-1] = 0;
      lcd_gotoxy(1,4);printf(lcd_putc,"\fWEB SERVER");
      lcd_gotoxy(1,4);printf(lcd_putc,"%s",val);
 
      //printf("\f%s",val);
   }
}


#if HTTP_USE_AUTHENTICATION
//This is a callback to the HTTP stack.
//fileName is a file that has been requested over HTTP and is password
//protected, user and pwd contains the authentication login the user had
//attempted.  This function returns TRUE if the user/pwd is valid for this
//fileName.
int1 http_check_authentication(char *fileName, char *user, char *pwd)
{
   static char goodUser[]="fuzzy";
   static char goodPwd[]="bunnies";
   
   return((stricmp(goodUser,user)==0) && (stricmp(goodPwd,pwd)==0));
}
#endif


#if STACK_USE_FTP
//This is a callback to the FTP stack.
//Verify that the login and password provided by the FTP client are valid
//according to your specifications.
//This isn't terribly secure but, then again, neither is FTP.
//Return 1 if login and password are accepted, return 0 if denied.
BOOL FTPVerify(char *login, char *password){
   static char goodUser[]="fuzzy";
   static char goodPwd[]="bunnies";
   
   return((stricmp(goodUser,login)==0) && (stricmp(goodPwd,password)==0));
 
}
#endif


void LCDTask(void) {
   static TICKTYPE lastTick;
   static enum {LCD_Display=0, LCD_Wait=1} state=0;

   switch(state) {
      case LCD_Display:
         if (!MACIsLinked()) {
            printf(lcd_putc,"\fNo Ethernet\n");
         }
         else {
            printf(lcd_putc,"\fIP:%u.%u.%u.%u\n", MY_IP_BYTE1, MY_IP_BYTE2, MY_IP_BYTE3, MY_IP_BYTE4);
            printf(lcd_putc,"Subnet:%u.%u.%u.%u\n", MY_MASK_BYTE1, MY_MASK_BYTE2, MY_MASK_BYTE3, MY_MASK_BYTE4);
            printf(lcd_putc,"Gatewy:%u.%u.%u.%u", MY_GATE_BYTE1, MY_GATE_BYTE2, MY_GATE_BYTE3, MY_GATE_BYTE4);

         }

         lastTick=TickGet();
         state=LCD_Wait;
         break;

      case LCD_Wait:
         if (TickGetDiff(TickGet(), lastTick) >= TICKS_PER_SECOND) {
            //output_toggle(USER_LED1);
            state=LCD_Display;
         }
         break;
   }
}




void main(void)
{

   MACAddrInit();
   IPAddrInit();
 
   init_user_io();
   
   StackInit();
   
   lcd_init();
   
   while (TRUE)
   {
      restart_wdt();
      StackTask();
      LCDTask();
     
      if (second_counter>=1)
      {
         second_counter=0;
      }
   }
}



ccstcpip.h
Code:
#define STACK_USE_CCS_PICENS   0  //18f4620 + enc28j60
#define STACK_USE_CCS_PICNET   0  //18f6722 + realtek
#define STACK_USE_CCS_PICEEC   0  //18f97j60
#define STACK_USE_CUSTOM_HW    1  //enc28j60 + pic18   


#if STACK_USE_CCS_PICENS
   #define STACK_USE_MCPENC 1
#endif

#if STACK_USE_CCS_PICEEC
   #define STACK_USE_MCPINC 1
#endif

#if STACK_USE_CUSTOM_HW   
   #define STACK_USE_MCPENC 1
#endif


#if STACK_USE_CCS_PICENS
   #include <18F4620.h>
   #use delay(clock=40000000)
   #fuses H4, NOWDT, NOLVP, NODEBUG

#elseif STACK_USE_CCS_PICNET
   #include <18F6722.h>
   #use delay(clock=40000000)
   #fuses H4, NOWDT, NOLVP, NODEBUG

#elseif STACK_USE_CCS_PICEEC
   #include <18F67J60.h>
   //#use delay(clock=41666667)
   //#fuses NOWDT, NODEBUG, H4_SW, NOIESO, NOFCMEN, PRIMARY
   #use delay(clock=25M)
   #fuses NOWDT, NODEBUG, HS, NOIESO, NOFCMEN, PRIMARY, ETHLEDNOEMB

#elseif STACK_USE_CCS_PICNET_OLD
   #include <18F6720.h>
   #use delay(clock=20000000)
   #fuses HS, NOWDT, NOLVP, NODEBUG
   #define STACK_USE_CCS_PICNET   TRUE

#elif STACK_USE_CUSTOM_HW
   #include <18F4620.h>
   #device adc=10
   #use delay(clock=32000000)
   #fuses H4, NOWDT, NOLVP, NODEBUG, NOMCLR
   #use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

#else
   #error You need to define your custom hardware
#endif


#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)


#include "tcpip/stacktsk.c"    //include Microchip TCP/IP Stack


#if STACK_USE_CCS_PICENS
   #include "tcpip/mlcd.c"
   #define BUTTON1_PRESSED()  (!input(PIN_A4))
   #define USER_LED1    PIN_A5
   #define USER_LED2    PIN_B4
   #define USER_LED3    PIN_B5
   #define LED_ON       output_low
   #define LED_OFF      output_high
   #define STANDARD_ADC_STRING  "AN0"
   #define STANDARD_ADC_CHANNEL 0
   void init_user_io(void) {
   setup_adc(ADC_CLOCK_INTERNAL);
   setup_adc_ports(AN0);
   *0xF92=(*0xF92 & 0xDF) | 0x11;   //a5 output, a4 and a0 input
   *0xF93=*0xF93 & 0xCF;   //b4 and b5 output
   LED_OFF(USER_LED1);
   LED_OFF(USER_LED2);
   LED_OFF(USER_LED3);
   set_adc_channel(0);
 }
 
 #elif STACK_USE_CCS_PICEEC
   #include "tcpip/elcd.c"
   #define BUTTON1_PRESSED()  (!input(PIN_A4))
   #define USER_LED1    PIN_B3
   #define USER_LED2    PIN_B4
   #define USER_LED3    PIN_B5
   #define LED_ON       output_low
   #define LED_OFF      output_high
   #define STANDARD_ADC_STRING  "AN2"
   #define STANDARD_ADC_CHANNEL 2
   void init_user_io(void) {
   setup_adc(ADC_CLOCK_INTERNAL);
   setup_adc_ports(AN0_TO_AN2);
   set_adc_channel(2);
   *0xF92=*0xF92 & 0xFC;   //a0 and a1 output
   *0xF93=*0xF93 & 0xC7;   //b3, b4 and b5 output
   LED_OFF(USER_LED1);
   LED_OFF(USER_LED2);
   LED_OFF(USER_LED3);
   set_adc_channel(2);
 }
 
#elif STACK_USE_CUSTOM_HW
   //User Define
   #define USER_LED1      PIN_B0
   #define USER_LED2      PIN_B1
   
   #define USER_BUTTON1   PIN_B2
   #define USER_BUTTON2   PIN_B3         
   
   #define LED_ON         output_high
   #define LED_OFF        output_low

   #define BUTTON_PRESSED !input

   void init_user_io(void)
   {
      setup_adc(ADC_CLOCK_INTERNAL);
      setup_adc_ports(AN0);
      //*0xF92=(*0xF92 & 0xDF) | 0x11;
      *0xF93=(*0xF93 & 0xFC);   //B0 and B1 input, B2 and B4 output
      *0xF96=(*0xF96 & 0x0);
      LED_OFF(USER_LED1);
      LED_OFF(USER_LED2);
 }
 
 #else
   #include "tcpip/dlcd.c"
   #define BUTTON1_PRESSED()  (!input(PIN_B0))
   #define BUTTON2_PRESSED()  (!input(PIN_B1))
   #define USER_LED1    PIN_B2
   #define USER_LED2    PIN_B4
   #define LED_ON       output_low
   #define LED_OFF      output_high
   #define STANDARD_ADC_STRING  "AN0"
   #define STANDARD_ADC_CHANNEL 0
   void init_user_io(void)
   {
      setup_adc(ADC_CLOCK_INTERNAL );
      setup_adc_ports(ANALOG_AN0_TO_AN1);
      *0xF92=*0xF92 | 3;            //a0 and a1 input (for ADC)
      *0xF93=(*0xF93 & 0xEB) | 3;   //B0 and B1 input, B2 and B4 output
      LED_OFF(USER_LED1);
      LED_OFF(USER_LED2);
      set_adc_channel(0);
   }
#endif


void MACAddrInit(void) {
   MY_MAC_BYTE1=0;
   MY_MAC_BYTE2=2;
   MY_MAC_BYTE3=3;
   MY_MAC_BYTE4=4;
   MY_MAC_BYTE5=5;
   MY_MAC_BYTE6=6;
}

void IPAddrInit(void) {
   //IP address of this unit
   MY_IP_BYTE1=192;
   MY_IP_BYTE2=168;
   MY_IP_BYTE3=95;
   MY_IP_BYTE4=2;

   //network gateway
   MY_GATE_BYTE1=192;
   MY_GATE_BYTE2=168;
   MY_GATE_BYTE3=95;
   MY_GATE_BYTE4=1;

   //subnet mask
   MY_MASK_BYTE1=255;
   MY_MASK_BYTE2=255;
   MY_MASK_BYTE3=255;
   MY_MASK_BYTE4=0;
}


hardware.h

Code:
#IFNDEF ___TCPIP_STACK_CONFIGURATION
#define ___TCPIP_STACK_CONFIGURATION


#ifndef STACK_USE_CCS_PICNET
#define STACK_USE_CCS_PICNET  FALSE
#endif

#ifndef STACK_USE_CCS_PICENS
#define STACK_USE_CCS_PICENS  FALSE
#endif

#use fast_io(A)
#use fast_io(B)
#use fast_io(C)
#if STACK_USE_CCS_PICNET || STACK_USE_CCS_PICEEC
 #use fast_io(F)
#endif


//// VARIOUS MODEM SETTINGS.
   #DEFINE  MODEM_DCD         PIN_G3
   #DEFINE  MODEM_RESET       PIN_G4
   #define  MODEM_TX          PIN_G1
   #define  MODEM_RX          PIN_G2
   #DEFINE  MODEM_INIT_STR    "ATM1L3&K0"   //speaker on, volume high, no hw flow control
   #DEFINE  MODEM_DIAL_STR    "ATDT"
   #DEFINE  MODEM_BAUD_RATE   115200

   #DEFINE  MODEM_RESPONSE_TIMEOUT  2000     //time to wait for a response to an AT command (in ms)
   #DEFINE  MODEM_CONNECT_TIMEOUT   120000    //time to wait for modem to make a connection (in ms)


//// VARIOUS MAC/NIC SETTINGS.
   #if STACK_USE_CCS_PICNET
      //Latch and Directional control SFR locations for the 3 control pins
      #define NIC_RESET_LAT       LATE_RE7
      #define NIC_IOW_LAT         LATE_RE6
      #define NIC_IOR_LAT         LATE_RE5
      #define NIC_RESET_TRIS      TRISE_RE7
      #define NIC_IOW_TRIS        TRISE_RE6
      #define NIC_IOR_TRIS        TRISE_RE5

      //Latch and Directional control SFR locations for the 5bit address port
      #define NIC_ADDR_LAT        LATE
      #define NIC_ADDR_TRIS       TRISE

      //Latch, Directional and I/O SFR locations for the 8bit data port
      #define NIC_DATA_IO         PORTF
      #define NIC_DATA_LAT        LATF
      #define NIC_DATA_TRIS       TRISF

      //This macro takes an address and properly outputs it on the latch register, and sets proper pins to output.
      //Leaves other pins alone.
      #define WRITE_NIC_ADDR(a)   NIC_ADDR_LAT = (NIC_ADDR_LAT & 0xE0)|a; \
                                NIC_ADDR_TRIS = NIC_ADDR_TRIS & 0xE0
   #elif STACK_USE_CCS_PICENS
      #define PIN_ENC_MAC_SO  PIN_C4   // PIC <<<< ENC
      #define PIN_ENC_MAC_SI  PIN_C5   // PIC >>>> ENC
      #define PIN_ENC_MAC_CLK PIN_C3
      #define PIN_ENC_MAC_CS  PIN_D1
      #define PIN_ENC_MAC_RST PIN_D0
      #define PIN_ENC_MAC_INT PIN_B0
      #define PIN_ENC_MAC_WOL PIN_B1
      #define ENC_MAC_USE_SPI TRUE      //due to an errata in the ENC28J60, you should always use HW SPI to assure that SPI clock is over 8MHz!
      #define mac_enc_spi_tris_init()  TRISB=(TRISB | 0b11); TRISC = (TRISC & 0b11010111) | 0x10; TRISD=TRISD & 0xF4//was 0xFC
   /*   
   #elif STACK_USE_CCS_EWL5V
      #define PIN_ENC_MAC_SO  PIN_C4   // PIC <<<< ENC
      #define PIN_ENC_MAC_SI  PIN_C5   // PIC >>>> ENC
      #define PIN_ENC_MAC_CLK PIN_C3
      #define PIN_ENC_MAC_CS  PIN_A4
      #define PIN_ENC_MAC_RST PIN_B5
      #define PIN_ENC_MAC_INT PIN_B2
      #define PIN_ENC_MAC_WOL PIN_B3
      #define ENC_MAC_USE_SPI TRUE      //due to an errata in the ENC28J60, you should always use HW SPI to assure that SPI clock is over 8MHz!
      #define mac_enc_spi_tris_init()  TRISB=(TRISB | 0b00001100)&0b11011111; TRISC = (TRISC & 0b11010111) | 0x10; TRISA=TRISA & 0b11101111
   */
   #elif STACK_USE_CCS_PICEEC
      //no hardware definitions - everything is internal
     
   #elif STACK_USE_CUSTOM_HW
      #define PIN_ENC_MAC_SO  PIN_C4   // PIC <<<< ENC   PIN_ENC_MAC_SO      PIC_SDI/SDA
      #define PIN_ENC_MAC_SI  PIN_C5   // PIC >>>> ENC   PIN_ENC_MAC_SI      PIC_SDO
      #define PIN_ENC_MAC_CLK PIN_C3   // PIC <<>> ENC   PIN_ENC_MAC_CLK     PIN_SCK/SCL
      #define PIN_ENC_MAC_CS  PIN_C1   //PIN_D1 -tris-out
      #define PIN_ENC_MAC_RST PIN_C0   //PIN_DO -tris_out
      #define PIN_ENC_MAC_INT PIN_C2   //PIN_D2 -tris_in
      #define PIN_ENC_MAC_WOL PIN_E0   //PIN_D3 -tris-in
      #define ENC_MAC_USE_SPI TRUE      //due to an errata in the ENC28J60, you should always use HW SPI to assure that SPI clock is over 8MHz!
      //#define mac_enc_spi_tris_init()  TRISC = (TRISC & 0b11010111) | 0x10; TRISD=TRISD & 0xFC//was 0xFC
      #define mac_enc_spi_tris_init()  TRISC = (TRISC & 0b11010100) | 0x10;
   
   #else
      #error Please define your MAC/NIC I/O settings
   #endif



//// SET TCP_NO_WAIT_FOR_ACK TO FALSE IF TCP STACK SHOULD WAIT FOR ACK FROM
//// REMOTE HOST BEFORE TRANSMITTING ANOTHER PACKET.  THIS MAY REDUCE THROUGHPUT.
//// DEFAULT VALUE (TRUE) GETS LOADED IN TCP.H IF THIS LINE IS REMOVED.
   #define TCP_NO_WAIT_FOR_ACK   FALSE


///DEFAULT HARDCODED IP ADDRESSES.
///  FUTURE APPLICATIONS MAY WANT TO SAVE THESE TO AN EEPROM.
///  OR USE AUTO IP ASSIGNMENT (DHCP).
///  NO TWO DEVICES ON A NETwORK CAN HAVE THE SAME IP ADDRESS
   #define MY_DEFAULT_IP_ADDR_BYTE1        10   //IP ADDRESS
   #define MY_DEFAULT_IP_ADDR_BYTE2        10   // This unit's IP address.
   #define MY_DEFAULT_IP_ADDR_BYTE3        5
   #define MY_DEFAULT_IP_ADDR_BYTE4        15

   #define MY_DEFAULT_MASK_BYTE1           0xff //NETMASK
   #define MY_DEFAULT_MASK_BYTE2           0xff // Netmask tells the IP / ARP stack which
   #define MY_DEFAULT_MASK_BYTE3           0xff // IP's are on your local network.
   #define MY_DEFAULT_MASK_BYTE4           0x00

   #define MY_DEFAULT_GATE_BYTE1           192  //GATEWAY IP ADDRESS
   #define MY_DEFAULT_GATE_BYTE2           168  // Gateway acts as a conduit between two networks.
   #define MY_DEFAULT_GATE_BYTE3           100
   #define MY_DEFAULT_GATE_BYTE4           1

///DEFAULT HARDCODED MAC ADDRESS.
///  FUTURE APPLICATIONS MAY WANT TO SAVE THIS TO AN EEPROM, OR GENERATE
///  A DYNAMIC ONE BASED UPON UNIT'S SERIAL NUMBER.
///  NO TWO DEVICES ON THE SAME ETHERNET NETWORK CAN HAVE THE SAME MAC ADDRESS.
#define MY_DEFAULT_MAC_BYTE1            0x00
#define MY_DEFAULT_MAC_BYTE2            0x04
#define MY_DEFAULT_MAC_BYTE3            0xa3
#define MY_DEFAULT_MAC_BYTE4            0x00
#define MY_DEFAULT_MAC_BYTE5            0x00
#define MY_DEFAULT_MAC_BYTE6            0x00

///Maximum sockets to be defined.
/// Note that each socket consumes 36 bytes of RAM.
/// If you remove this, a default value will be loaded in stacktsk.h
   #ifndef MAX_SOCKETS
   #define MAX_SOCKETS                     5
   #endif

///Avaialble UDP Socket
/// DCHP takes 1 socket.
/// If you remove this, a default value will be loaded in stacktsk.h
   #ifndef MAX_UDP_SOCKETS
   #define MAX_UDP_SOCKETS                 2
   #endif

///BUFFER SIZE DEFINITIONS
///
/// For SLIP, there can only be one transmit and one receive buffer.
/// Both buffer must fit in one bank.  If bigger buffer is required,
/// you must manually locate tx and rx buffer in different bank
/// or modify your linker script file to support arrays bigger than
/// 256 bytes.
/// I think Microchip needs MAC_RX_BUFFER_SIZE to equal MAC_TX_BUFFER_SIZE
///
/// For PPP, there can only be one transmit and one receive buffer.
/// You can receive messages larger than the receive buffer if your
/// routines are fast enough.  You cannot transmit messages larger
/// than the TX buffer.  The larger the buffer you can make, the better.
/// BUG: MAC_RX_BUFFER_SIZE must equal MAC_TX_BUFFER_SIZE
///
/// For Ethernet, the Ethernet controler has many buffers that are
/// 1k in size.   Only one buffer is used for TX, rest are for RX.
/// Unlike SLIP and PPP, no RAM is used for these buffers.
   #if STACK_USE_MAC
       #define MAC_TX_BUFFER_SIZE          1024 //do not modify this line
       #define MAC_TX_BUFFER_COUNT         1    //do not modify this line
   #elif STACK_USE_PPP
       #define MAC_TX_BUFFER_SIZE          1024
       #define MAC_TX_BUFFER_COUNT         1
   #elif STACK_USE_SLIP
       #define MAC_TX_BUFFER_SIZE          250
       #define MAC_TX_BUFFER_COUNT         1
   #endif

   #define MAC_RX_BUFFER_SIZE              MAC_TX_BUFFER_SIZE  //do not modify this line unless you are certain you know what you're doing

#endif
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group