'2) Sensor/Ethernet'에 해당되는 글 1건

  1. 2016.09.17 ENC28J60 Ethernet Module (ENC28J60) [S058]

ENC28J60 Ethernet Module (ENC28J60) [S058]





https://www.youtube.com/watch?v=CQpMqNqUW_8


*GitHubhttps://github.com/rdiot/rdiot-s058.git


* Specs

The ENC28J60 Ethernet Module utilizes the new Microchip ENC28J60 Stand-Alone Ethernet Controller IC featuring a host of features to handle most of the network protocol requirements. The board connects directly to most microcontrollers with a standard SPI interface with a transfer speed of up to 20MHz.

ENC28J60 Ethernet chips, SOP28 package

SPI Interface

2X5 connector, can be easily mounted with the MCU

Power indicator

Single Supply: +3.3 V

PCB size: 55x36 mm


* Contents

- Connect (Uno)

VCC -   3.3V

SCK - Pin 13

SO  - Pin 12

SI  - Pin 11

CS  - Pin  8 # Selectable with the ether.begin() function

GND - GND


- Connect (Mega)

VCC -   3.3V

GND -    GND

SCK - Pin 52

SO  - Pin 50

SI  - Pin 51

CS  - Pin 53 # Selectable with the ether.begin() function

# The default CS pin defaults to 8, so you have to set it on a mega:

ether.begin(sizeof Ethernet::buffer, mymac, 53)


- Library : https://github.com/ice3x2/ethercard

- Library Download : https://github.com/jcw/ethercard/archive/master.zip


- Key Code

#include <EtherCard.h>

#define REQUEST_RATE 5000 // milliseconds


// ethernet interface mac address

static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };

// remote website name

const char website[] PROGMEM = "sports.news.naver.com";


byte Ethernet::buffer[700];

static long timer;


  if (!ether.dhcpSetup())

    Serial.println("DHCP failed");

  

  ether.printIp("My IP: ", ether.myip);

  // ether.printIp("Netmask: ", ether.mymask);

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

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


  timer = - REQUEST_RATE; // start timing out right away


// called when the client request is complete

static void my_result_cb (byte status, word off, word len) {

  Serial.print("<<< reply ");

  int val = millis() - timer;

  Serial.print(val);

  Serial.println(" ms");

  Serial.println((const char*) Ethernet::buffer + off);


  lcd.setCursor(0,3);

  lcd.print("reply=" + (String)val + " ms   ");

}

'2) Sensor > Ethernet' 카테고리의 다른 글

ENC28J60 Ethernet Module (ENC28J60) [S058]  (0) 2016.09.17
Posted by RD IoT RDIoT

댓글을 달아 주세요