ENC28J60 Ethenet Module

ENC28J60 Ethenet Module

ENC28J60 IC가 내장된 모듈
AVR,PIC 등의 MCU, Arduino 등 SPI 통신이 가능한 모든 제품에서 사용가능

특징

Ethernet LAN Module for Arduino/AVR/LPC/STM3
ENC28J60 Ethernet chips
Can be easily mounted with the MCU
Network Interface: HR911105A
Supply Voltage: 3.3 V (5V Tolerant DIO)
25Mhz crystal oscillator
Size (L x W x H): Approx. 2.3 x 1.3 x 0.7 inch / 58 x 34 x 17 mm

핀 맵

12핀이며 보드에 표기되어 있습니다.
핀번호 핀명 기능 핀번호 핀명 기능
1 5.0V 5V INPUT 2 GND Ground
3 INT Interrupt 4 CLK Clock Out
5 SO MISO 6 WOL No Connect
7 SCK SPI SCK 8 SI MOSI
9 RST Reset 10 CS SPI CS
11 3.3V 3.3V OUT 12 GND Ground

WAT-Arduino128에 연결

 

부품 목록
번호 부품명 수량 기능 판매처
 1 WAT-Arduino128  1 아두이노 https://kit128.com/goods/view?no=64
 2 ENC28J60 Module  1 TCP/IP https://kit128.com/goods/view?no=66

WAT-Arduino128 ENC28J60 Module

 

 

WAT-Arduino128 와 ENC28J60 Module 간의 연결 예입니다.

핀번호 WAT-Arduino128 핀 번호 핀번호 WAT-Arduino128 핀 번호
1 5.0V 2 GND
3 No Connect 4 No Connect
5 PB3 (MISO) 6 No Connect
7 PB1 (SCK) 8 PB2 (MOSI)
9 Reset 10 PB4
11 No Connect 12 No Connect (or GND)

전체 예제
// whiteat.com 에서 5초마다 현재 시간을 가져오는 예제입니다.
//
// PIN MAP
// WAT-Arduino128   <->  ENC28J60 Ethernet Module
//             5V   <->  5V
//            GND   <->  GND
//            PB1   <->  SCK
//            PB2   <->  SI
//            PB3   <->  SO
//          Reset   <->  RST



#include <EtherCard.h>

// ethernet interface mac address, must be unique on the LAN
static byte mymac[] ={  0x24,0x2C,0x2F,0x4,0x2,0x3}; 

byte Ethernet::buffer[700];
static uint32_t timer;

const char website[] PROGMEM = "whiteat.com";

// called when the client request is complete
static void my_callback (byte status, word off, word len) {
  Serial.println(">>>");
  Ethernet::buffer[off+300] = 0;
  Serial.print((const char*) Ethernet::buffer + off);
  Serial.println("...");
}

void setup () {
  Serial.begin(115200);
  Serial.println(F("\n[getServerTime] - http://whiteat.com"));

  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) 
    Serial.println(F("Failed to access Ethernet controller"));
  if (!ether.dhcpSetup())
    Serial.println(F("DHCP failed"));

  ether.printIp("IP:  ", ether.myip);
  ether.printIp("GW:  ", ether.gwip);  
  ether.printIp("DNS: ", ether.dnsip);  

  if (!ether.dnsLookup(website))
    Serial.println("DNS failed");
    
  ether.printIp("SRV: ", ether.hisip);
}

void loop () {
  ether.packetLoop(ether.packetReceive());
  
  if (millis() > timer) {
    timer = millis() + 5000;
    Serial.println();
    Serial.print("<<< REQ ");
    ether.browseUrl(PSTR("/time/"), "time.php", website, my_callback);
  }
}

 

결과

주기적으로 서버(watclean7.com) 시간을 가져와 디버깅 창에 출력합니다.

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다