stoyanoff
Full Member level 4
I`m using 18F66J60. Here is my header for the tcpip stack adjustments:
The complier compiles it. So I don`t know where is the problem. In my code or in the hardware. Here is a simple chart of my hardware. I`m using a RJ connector with integrated internet transformer. I`m uploading it`s pdf.
Can someone give me an advice where to look for the mistake??
Thanks!View attachment TS8P8C-PCB-ETH TRAF.pdfView attachment chart.pdf
Code:
#if STACK_USE_CCS_PICENS
#define STACK_USE_MCPENC 1
#endif
#if STACK_USE_CCS_PICEEC
#define STACK_USE_MCPINC 1
#endif
#include <18F66J60.h>
#fuses NOWDT, NODEBUG,HS, NOIESO, NOFCMEN, PRIMARY
#use delay(clock=25M)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#include "tcpip/stacktsk.c" //include Microchip TCP/IP Stack
#if STACK_USE_CCS_PICEEC
#include "tcpip/elcd.c"
#define BUTTON1_PRESSED() (!input(PIN_A4))
#define USER_LED1 PIN_A0
#define USER_LED2 PIN_A1
#define USER_LED3 PIN_A2
#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 & 0x00; //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);
}
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=0;
MY_IP_BYTE4=7;
//network gateway
MY_GATE_BYTE1=192;
MY_GATE_BYTE2=168;
MY_GATE_BYTE3=0;
MY_GATE_BYTE4=1;
//subnet mask
MY_MASK_BYTE1=255;
MY_MASK_BYTE2=255;
MY_MASK_BYTE3=255;
MY_MASK_BYTE4=0;
}
char ExampleIPDatagram[] = {
0x45, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
0x64, 0x11, 0x2A, 0x9D, 0x0A, 0x0B, 0x0C, 0x0D,
0x0A, 0x0B, 0x0C, 0x0E
};
char ExampleUDPPacket[] = {
0x04, 0x00, 0x04, 0x01, 0x00, 0x08, 0x00, 0x00,
0x01, 0x02, 0x03, 0x04
};
Can someone give me an advice where to look for the mistake??
Thanks!View attachment TS8P8C-PCB-ETH TRAF.pdfView attachment chart.pdf