Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SNTPClient WIZnet_Library mbed
Fork of SNTP_Ethernet_W5500 by
Revision 0:2176bc9b0007, committed 2014-12-19
- Comitter:
- xeon011
- Date:
- Fri Dec 19 05:49:31 2014 +0000
- Child:
- 1:c4d6fee8d958
- Commit message:
- The Example of SNTP for W5500
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SNTPClient.lib Fri Dec 19 05:49:31 2014 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/xeon011/code/SNTPClient/#137fc24033c4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/W5500Interface.lib Fri Dec 19 05:49:31 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/teams/EthernetInterfaceW5500-makers/code/W5500Interface/#713b6d2aaefb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Dec 19 05:49:31 2014 +0000
@@ -0,0 +1,54 @@
+#include "mbed.h"
+#include "EthernetInterface.h"
+#include "SNTPClient.h"
+
+
+int main() {
+// EthernetInterface eth;
+// change for W5500 interface.
+#if defined(TARGET_LPC1114)
+ SPI spi(dp2, dp1, dp6); // mosi, miso, sclk
+ EthernetInterface eth(&spi, dp25, dp26); // spi, cs, reset
+
+#elif defined(TARGET_LPC1768)
+ SPI spi(p11, p12, p13); // mosi, miso, sclk
+ EthernetInterface eth(&spi, p14, p15); // spi, cs, reset
+
+#elif defined(TARGET_LPC11U68)
+ SPI spi(P0_9, P0_8, P1_29); // mosi, miso, sclk
+ EthernetInterface eth(&spi, P0_2, P1_28);//, nRESET(p9); // reset pin is dummy, don't affect any pin of WIZ550io
+
+#else
+ #warning "The Device is Undefined"
+#endif
+
+ spi.format(8,0); // 8bit, mode 0
+ spi.frequency(7000000); // 7MHz
+ wait(1); // 1 second for stable state
+
+ eth.init(); //Use DHCP
+ //eth.init("192.168.11.111", "255.255.255.0", "192.168.11.1"); //Use Static IP
+ eth.connect();
+ printf("IP Address is %s\n\r", eth.getIPAddress());
+
+ SNTPClient sntp("time.nist.gov", 40); // timezone: Korea, Republic of
+ sntp.connect();
+
+ datetime time;
+#if 0 // execute once..
+ while (sntp.getTime(&time) != true) {
+ ;
+ }
+ printf("%d-%d-%d, %d:%d:%d\r\n", time.yy, time.mo, time.dd, time.hh, time.mm, time.ss);
+#else // infinete loop..
+ while (1) {
+ if(sntp.getTime(&time) == true) {
+ printf("%d-%d-%d, %d:%d:%d\r\n", time.yy, time.mo, time.dd, time.hh, time.mm, time.ss);
+ wait(1.0);
+ }
+ else {
+ printf("failed receive..\r\n");
+ }
+ }
+#endif
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Dec 19 05:49:31 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file
