Malapit na malapit na. Im working on my ARDUINO na para sa scrolling message. +1 boy femfem para sa working code. +1 sir lurker para sa lahat-lahat. +1 kay sir PICUSER sa costumer support.
galing mo prof! may scrolling kapa ha! bongga! complete na yung project mo sa summer.. ginamit mo ba yung tx nung ENC module prof?
Ang galing ni boy femfem ahh!
Eto yung SOIC na PIC sir Lurker. Kaya medjo mahirap mag-solder.
Here was the output mga sir.
Congrats lang2... :-) d ko glng napatapos ang video.. Hinay b ang youtube..
^^ Galing daw sayo yung codes ni prof. Na post ko na ang dapat baguhin sir, please read back nalang.Dalawang araw ko yan dini debug.
Yup si boy femfem nga... +1 pala sa video prof.
Yung ginawa ko, digicam lang gamit ko pagkuha ng video sa hardware.Then ini embed ko lang sa screen capture using PIP.Nandoon sa site nila maraming tutorial to get you started.
Share mo na yang buong codes mo prof.
// duplex config flags#include "__EthEnc28j60.h"//#pragma orgall 0x200#define Spi_Ethernet_HALFDUPLEX 0x00 // half duplex#define Spi_Ethernet_FULLDUPLEX 0x01 // full duplex// mE ehternet NIC pinoutsfr sbit SPI_Ethernet_Rst at LATC0_bit; // for writing to output pin always use latch (PIC18 family)sfr sbit SPI_Ethernet_CS at LATC1_bit; // for writing to output pin always use latch (PIC18 family)sfr sbit SPI_Ethernet_Rst_Direction at TRISC0_bit;sfr sbit SPI_Ethernet_CS_Direction at TRISC1_bit;// end ethernet NIC definitions/************************************************************ * ROM constant strings */const code unsigned char httpHeader[] = "HTTP/1.1 200 OKnContent-type: " ; // HTTP headerconst code unsigned char httpMimeTypeHTML[] = "text/htmlnn" ; // HTML MIME typeconst code unsigned char httpMimeTypeScript[] = "text/plainnn" ; // TEXT MIME typeunsigned char httpMethod[] = "GET /";// const codechar automation[] ="<HTML><form name="input" action="/" method="get"><title>ASIMO</title><HEAD></HEAD><BODY><center><table width="500" border="0"><td colspan="2" style="background-color:#FFA500;"><h1 align="center">ETHERNET DISPLAY by ASIMO</h1><tr valign="top"><br><form name="input" action="/" method="get"><td align=center bgcolor=#FFD700 <font size=5><b>Message to be displayed:</b></font><input name="1" width=120 maxlength=30 type="text" ><bgcolor=#FFD700><input name="~" width=60 type="submit" value="DISPLAY"></td><br></tr></form><tr></center><td colspan="2" style="background-color:#FFA500;text-align:center;">Copyright © <a href=http://www.electronicslab.ph/forum/>[url=http://www.electronicslab.ph]www.electronicslab.ph[/url]</a></tr></table></BODY></HTML>";/***********************************<script type="text/javascript">function startTime(){var today=new Date();var h=today.getHours();var m=today.getMinutes();var s=today.getSeconds();m=checkTime(m);s=checkTime(s);document.getElementById('txt').innerHTML=h ":" m ":" s;t=setTimeout('startTime()',500);}function checkTime(i){if (i<10){i="0" i;}return i;}</script></head><body onload="startTime()"><div id="txt"></div>*//*********************************** * RAM variables */unsigned char myMacAddr[6] = {0x00, 0x14, 0xA5, 0x76, 0x19, 0x3f} ; // my MAC addressunsigned char myIpAddr[4] = {192, 168, 2, 60 } ; // my IP addressunsigned char gwIpAddr[4] = {192, 168, 2, 144 } ; // gateway (router) IP addressunsigned char ipMask[4] = {255, 255, 255, 0 } ; // network mask (for example : 255.255.255.0)unsigned char dnsIpAddr[4] = {192, 168, 2, 1 } ; // DNS server IP addressunsigned char getRequest[15]; //absolute 0x0A00; // HTTP request bufferunsigned char dyna[29] ; // buffer for dynamic responsechar color1[] = "#FFFF00"; // Color yellow. More colors @ http://www.computerhope.com/htmcolor.htmchar color2[] = "#4974E2"; // Color blueunsigned char dummy[2] ; // HTTP request bufferbit flag2;bit flag1;#define putConstString SPI_Ethernet_putConstString#define putString SPI_Ethernet_putStringunsigned int SPI_Ethernet_UserTCP (unsigned char *remoteHost, unsigned int remotePort, unsigned int localPort, unsigned int reqLength, TEthPktFlags *flags) //org 0x200 { unsigned int len; // my reply length if(localPort != 80) // I listen only to web request on port 80 { return(0) ; } // get 7 first bytes only of the request, the rest does not matter here for(len = 0 ; len < 8 ; len ) { getRequest[len] = SPI_Ethernet_getByte() ; } getRequest[len] = 0 ; len = 0; if(memcmp(getRequest, httpMethod, 5)) // only GET method is supported here { return(0) ; } for(len = 0 ; len < 25 ; len ) // Get the rest of the characters. These are the actual characters inputed by // by the user on the textbox. Increase this value if you expect more characters. { getRequest[len] = SPI_Ethernet_getByte() ; // Get the next character. if (getRequest[len]==0x26) // exit if "&" is detected. break; if (getRequest[len]==0x2B) // Detects " ". When the user input a "Hi elabers", the enc receives a "Hi elabers" string. getRequest[len]=0x20; // Replace the " " with the actual character "space". if (getRequest[len]==0x25) {{ getRequest[len] = SPI_Ethernet_getByte(); // Replace the "%" with the next character. switch (getRequest[len]) { case 0x34: // the first char of the hexa value is 4 getRequest[len] = 0x40; // @ dummy[0] = SPI_Ethernet_getByte(); // trash it!!! break; case 0x36: // the first char of the hexa value is 6 getRequest[len] = 0x60; // ' dummy[0] = SPI_Ethernet_getByte(); // trash it!!! break; case 0x32: // the first char of the hexa value is 2 getRequest[len] = SPI_Ethernet_getByte(); // Replace the last character with the next character. switch (getRequest[len]) { // The next line of codes will replace it with the actual character. case 0x31: // the second char of the hexa value is 1 getRequest[len] = 0x21; // ! break; case 0x32: // the second char of the hexa value is 2 getRequest[len] = 0x22; // " break; case 0x33: // the second char of the hexa value is 3 getRequest[len] = 0x23; // # break; case 0x34: // the second char of the hexa value is 4 getRequest[len] = 0x24; // $ break; case 0x35: // the second char of the hexa value is 5 getRequest[len] = 0x25; //% break; case 0x36: // the second char of the hexa value is 6 getRequest[len] = 0x26; // & flag2 = 1; // "&" is detected break; case 0x37: // the second char of the hexa value is 7 getRequest[len] = 0x27; // ' break; case 0x38: // the second char of the hexa value is 8 getRequest[len] = 0x28; // ( break; case 0x39: // the second char of the hexa value is 9 getRequest[len] = 0x29; // ) break; case 0x42: // the second char of the hexa value is B getRequest[len] = 0x2B; // break; case 0x43: // the second char of the hexa value is C getRequest[len] = 0x2C; // , break; case 0x46: // the second char of the hexa value is F getRequest[len] = 0x2F; // / break; default: break; } break; case 0x33: // the first char of the hexa value is 3 getRequest[len] = SPI_Ethernet_getByte(); // Replace the last character with the next character. switch (getRequest[len]) { // The next line of codes will replace it with the actual character. case 0x41: // the second char of the hexa value is A getRequest[len] = 0x3A; // : break; case 0x42: // the second char of the hexa value is B getRequest[len] = 0x3B; // ; break; case 0x43: // the second char of the hexa value is C getRequest[len] = 0x3C; // < break; case 0x44: // the second char of the hexa value is D getRequest[len] = 0x3D; // = break; case 0x45: // the second char of the hexa value is E getRequest[len] = 0x3E; // > break; case 0x46: // the second char of the hexa value is F getRequest[len] = 0x3F; // ? break; default: break; } break; default: break; } } } } getRequest[len] = 0 ; len = 0; UART1_Write_Text(getRequest); if(!memcmp(getRequest, "1=ON", 4)) // do we have ON command {PORTB.B5 = 1;}//LATC6_bit = 1; // set PORTD bit7 if(!memcmp(getRequest, "1=OFF", 5)) // do we have OFF command {PORTB.B5 = 0;}//LATC6_bit = 0; if(!memcmp(getRequest, "reset", 5)) // do we have OFF command { len = putConstString(httpHeader) ; // HTTP header len = putConstString(httpMimeTypeHTML) ; // with HTML MIME type len = SPI_Ethernet_putString(automation) ; flag1=1; return(len); }//LATC6_bit = 0; //UART1_Write_Text(getRequest); UART1_Write(13); len = putConstString(httpHeader) ; // HTTP header len = putConstString(httpMimeTypeHTML) ; // with HTML MIME type len = SPI_Ethernet_putString(automation) ; //SPI_Ethernet_putConstString if(len == 0) // what do to by default { len = putConstString(httpHeader) ; // HTTP header len = putConstString(httpMimeTypeHTML) ; // with HTML MIME type len = SPI_Ethernet_putString(automation) ; } return(len) ; // return to the library with the number of bytes to transmit }unsigned int SPI_Ethernet_UserUDP(unsigned char *remoteHost, unsigned int remotePort, unsigned int destPort, unsigned int reqLength, TEthPktFlags *flags) { return(0) ; // no UDP reply }/* * main entry */long i;void main() { CMCON |=7; // Comparators off (see pp. 236 of the datasheet) ADCON1 = 0x0F ; // ADC convertors not will be used (see pp. 226 of the datasheet) PORTA = 0; // initialize PORTA to all low TRISA = 0x00 ; // set PORTA as output (see pp. 93 of the datasheet) TRISC.B0 =0; // PORTC.B0 is output. This is the reset pin for the ENC. TRISC.B1 =0; // PORTC.B1 is output. This is the chip select(CS) pin. // PORTB = 0 ; // initialize PORTB to all low //TRISB = 0x00 ; // set PORTB as output (see pp. 96 of the datasheet) PORTB.B5 = 0 ; TRISB.B5 = 0; UART1_Init(9600); Delay_ms(100); // Wait for UART module to stabilize PORTB.B5 = 1; delay_ms(100); PORTB.B5 = 0; delay_ms(100); //LATC6_bit=1; UART1_Write_Text("READY"); Delay_ms(100); //LATC6_bit=0; UART1_Write_Text("1234567891bcdefg"); flag1=0; flag2=0; /* * starts ENC28J60 with : * reset bit on RC0 * CS bit on RC1 * my MAC & IP address * full duplex */ SPI1_Init(); SPI_Rd_Ptr = SPI1_Read; SPI_Ethernet_Init(myMacAddr, myIpAddr, Spi_Ethernet_FULLDUPLEX) ; // dhcp will not be used here, so use preconfigured addresses SPI_Ethernet_confNetwork(ipMask, gwIpAddr, dnsIpAddr) ; while(1) // do forever { /* * if necessary, test the return value to get error code */ /* PORTB.B5 = 1; delay_ms(1000); PORTB.B5 = 0; delay_ms(1000); */ if (flag1) asm reset; SPI_Ethernet_doPacket() ; // process incoming Ethernet packets } }
// Receives data from the serial port#include <LiquidCrystal.h>LiquidCrystal lcd(12, 11, 5, 4, 3, 2);char inChar;int num=0;void setup(){ lcd.clear(); lcd.begin(16, 2); lcd.print(" hello ASIMO =)"); Serial.begin(9600); }void loop(){ lcd.setCursor(16,0); while (Serial.available()>0) { inChar = Serial.read(); num = inChar; if (num==13) { Serial.flush(); break; } else { lcd.autoscroll(); lcd.print(inChar); delay(1000); } } lcd.noAutoscroll(); delay(10000); lcd.clear(); lcd.setCursor(16,0);}
Ahhh. Sige sir. Pag-aralan ko lang yun muna. Maganda kasing pag video tutorial eh. May basbas na galing sa author. Sige sir.Here is the complete code in PIC where the ENC is connected.Code: [Select]// duplex config flags#include "__EthEnc28j60.h"//#pragma orgall 0x200#define Spi_Ethernet_HALFDUPLEX 0x00 // half duplex#define Spi_Ethernet_FULLDUPLEX 0x01 // full duplex// mE ehternet NIC pinoutsfr sbit SPI_Ethernet_Rst at LATC0_bit; // for writing to output pin always use latch (PIC18 family)sfr sbit SPI_Ethernet_CS at LATC1_bit; // for writing to output pin always use latch (PIC18 family)sfr sbit SPI_Ethernet_Rst_Direction at TRISC0_bit;sfr sbit SPI_Ethernet_CS_Direction at TRISC1_bit;// end ethernet NIC definitions/************************************************************ * ROM constant strings */const code unsigned char httpHeader[] = "HTTP/1.1 200 OKnContent-type: " ; // HTTP headerconst code unsigned char httpMimeTypeHTML[] = "text/htmlnn" ; // HTML MIME typeconst code unsigned char httpMimeTypeScript[] = "text/plainnn" ; // TEXT MIME typeunsigned char httpMethod[] = "GET /";// const codechar automation[] ="<HTML><form name="input" action="/" method="get"><title>ASIMO</title><HEAD></HEAD><BODY><center><table width="500" border="0"><td colspan="2" style="background-color:#FFA500;"><h1 align="center">ETHERNET DISPLAY by ASIMO</h1><tr valign="top"><br><form name="input" action="/" method="get"><td align=center bgcolor=#FFD700 <font size=5><b>Message to be displayed:</b></font><input name="1" width=120 maxlength=30 type="text" ><bgcolor=#FFD700><input name="~" width=60 type="submit" value="DISPLAY"></td><br></tr></form><tr></center><td colspan="2" style="background-color:#FFA500;text-align:center;">Copyright © <a href=http://www.electronicslab.ph/forum/>[url=http://www.electronicslab.ph]www.electronicslab.ph[/url]</a></tr></table></BODY></HTML>";/***********************************<script type="text/javascript">function startTime(){var today=new Date();var h=today.getHours();var m=today.getMinutes();var s=today.getSeconds();m=checkTime(m);s=checkTime(s);document.getElementById('txt').innerHTML=h ":" m ":" s;t=setTimeout('startTime()',500);}function checkTime(i){if (i<10){i="0" i;}return i;}</script></head><body onload="startTime()"><div id="txt"></div>*//*********************************** * RAM variables */unsigned char myMacAddr[6] = {0x00, 0x14, 0xA5, 0x76, 0x19, 0x3f} ; // my MAC addressunsigned char myIpAddr[4] = {192, 168, 2, 60 } ; // my IP addressunsigned char gwIpAddr[4] = {192, 168, 2, 144 } ; // gateway (router) IP addressunsigned char ipMask[4] = {255, 255, 255, 0 } ; // network mask (for example : 255.255.255.0)unsigned char dnsIpAddr[4] = {192, 168, 2, 1 } ; // DNS server IP addressunsigned char getRequest[15]; //absolute 0x0A00; // HTTP request bufferunsigned char dyna[29] ; // buffer for dynamic responsechar color1[] = "#FFFF00"; // Color yellow. More colors @ http://www.computerhope.com/htmcolor.htmchar color2[] = "#4974E2"; // Color blueunsigned char dummy[2] ; // HTTP request bufferbit flag2;bit flag1;#define putConstString SPI_Ethernet_putConstString#define putString SPI_Ethernet_putStringunsigned int SPI_Ethernet_UserTCP (unsigned char *remoteHost, unsigned int remotePort, unsigned int localPort, unsigned int reqLength, TEthPktFlags *flags) //org 0x200 { unsigned int len; // my reply length if(localPort != 80) // I listen only to web request on port 80 { return(0) ; } // get 7 first bytes only of the request, the rest does not matter here for(len = 0 ; len < 8 ; len ) { getRequest[len] = SPI_Ethernet_getByte() ; } getRequest[len] = 0 ; len = 0; if(memcmp(getRequest, httpMethod, 5)) // only GET method is supported here { return(0) ; } for(len = 0 ; len < 25 ; len ) // Get the rest of the characters. These are the actual characters inputed by // by the user on the textbox. Increase this value if you expect more characters. { getRequest[len] = SPI_Ethernet_getByte() ; // Get the next character. if (getRequest[len]==0x26) // exit if "&" is detected. break; if (getRequest[len]==0x2B) // Detects " ". When the user input a "Hi elabers", the enc receives a "Hi elabers" string. getRequest[len]=0x20; // Replace the " " with the actual character "space". if (getRequest[len]==0x25) {{ getRequest[len] = SPI_Ethernet_getByte(); // Replace the "%" with the next character. switch (getRequest[len]) { case 0x34: // the first char of the hexa value is 4 getRequest[len] = 0x40; // @ dummy[0] = SPI_Ethernet_getByte(); // trash it!!! break; case 0x36: // the first char of the hexa value is 6 getRequest[len] = 0x60; // ' dummy[0] = SPI_Ethernet_getByte(); // trash it!!! break; case 0x32: // the first char of the hexa value is 2 getRequest[len] = SPI_Ethernet_getByte(); // Replace the last character with the next character. switch (getRequest[len]) { // The next line of codes will replace it with the actual character. case 0x31: // the second char of the hexa value is 1 getRequest[len] = 0x21; // ! break; case 0x32: // the second char of the hexa value is 2 getRequest[len] = 0x22; // " break; case 0x33: // the second char of the hexa value is 3 getRequest[len] = 0x23; // # break; case 0x34: // the second char of the hexa value is 4 getRequest[len] = 0x24; // $ break; case 0x35: // the second char of the hexa value is 5 getRequest[len] = 0x25; //% break; case 0x36: // the second char of the hexa value is 6 getRequest[len] = 0x26; // & flag2 = 1; // "&" is detected break; case 0x37: // the second char of the hexa value is 7 getRequest[len] = 0x27; // ' break; case 0x38: // the second char of the hexa value is 8 getRequest[len] = 0x28; // ( break; case 0x39: // the second char of the hexa value is 9 getRequest[len] = 0x29; // ) break; case 0x42: // the second char of the hexa value is B getRequest[len] = 0x2B; // break; case 0x43: // the second char of the hexa value is C getRequest[len] = 0x2C; // , break; case 0x46: // the second char of the hexa value is F getRequest[len] = 0x2F; // / break; default: break; } break; case 0x33: // the first char of the hexa value is 3 getRequest[len] = SPI_Ethernet_getByte(); // Replace the last character with the next character. switch (getRequest[len]) { // The next line of codes will replace it with the actual character. case 0x41: // the second char of the hexa value is A getRequest[len] = 0x3A; // : break; case 0x42: // the second char of the hexa value is B getRequest[len] = 0x3B; // ; break; case 0x43: // the second char of the hexa value is C getRequest[len] = 0x3C; // < break; case 0x44: // the second char of the hexa value is D getRequest[len] = 0x3D; // = break; case 0x45: // the second char of the hexa value is E getRequest[len] = 0x3E; // > break; case 0x46: // the second char of the hexa value is F getRequest[len] = 0x3F; // ? break; default: break; } break; default: break; } } } } getRequest[len] = 0 ; len = 0; UART1_Write_Text(getRequest); if(!memcmp(getRequest, "1=ON", 4)) // do we have ON command {PORTB.B5 = 1;}//LATC6_bit = 1; // set PORTD bit7 if(!memcmp(getRequest, "1=OFF", 5)) // do we have OFF command {PORTB.B5 = 0;}//LATC6_bit = 0; if(!memcmp(getRequest, "reset", 5)) // do we have OFF command { len = putConstString(httpHeader) ; // HTTP header len = putConstString(httpMimeTypeHTML) ; // with HTML MIME type len = SPI_Ethernet_putString(automation) ; flag1=1; return(len); }//LATC6_bit = 0; //UART1_Write_Text(getRequest); UART1_Write(13); len = putConstString(httpHeader) ; // HTTP header len = putConstString(httpMimeTypeHTML) ; // with HTML MIME type len = SPI_Ethernet_putString(automation) ; //SPI_Ethernet_putConstString if(len == 0) // what do to by default { len = putConstString(httpHeader) ; // HTTP header len = putConstString(httpMimeTypeHTML) ; // with HTML MIME type len = SPI_Ethernet_putString(automation) ; } return(len) ; // return to the library with the number of bytes to transmit }unsigned int SPI_Ethernet_UserUDP(unsigned char *remoteHost, unsigned int remotePort, unsigned int destPort, unsigned int reqLength, TEthPktFlags *flags) { return(0) ; // no UDP reply }/* * main entry */long i;void main() { CMCON |=7; // Comparators off (see pp. 236 of the datasheet) ADCON1 = 0x0F ; // ADC convertors not will be used (see pp. 226 of the datasheet) PORTA = 0; // initialize PORTA to all low TRISA = 0x00 ; // set PORTA as output (see pp. 93 of the datasheet) TRISC.B0 =0; // PORTC.B0 is output. This is the reset pin for the ENC. TRISC.B1 =0; // PORTC.B1 is output. This is the chip select(CS) pin. // PORTB = 0 ; // initialize PORTB to all low //TRISB = 0x00 ; // set PORTB as output (see pp. 96 of the datasheet) PORTB.B5 = 0 ; TRISB.B5 = 0; UART1_Init(9600); Delay_ms(100); // Wait for UART module to stabilize PORTB.B5 = 1; delay_ms(100); PORTB.B5 = 0; delay_ms(100); //LATC6_bit=1; UART1_Write_Text("READY"); Delay_ms(100); //LATC6_bit=0; UART1_Write_Text("1234567891bcdefg"); flag1=0; flag2=0; /* * starts ENC28J60 with : * reset bit on RC0 * CS bit on RC1 * my MAC & IP address * full duplex */ SPI1_Init(); SPI_Rd_Ptr = SPI1_Read; SPI_Ethernet_Init(myMacAddr, myIpAddr, Spi_Ethernet_FULLDUPLEX) ; // dhcp will not be used here, so use preconfigured addresses SPI_Ethernet_confNetwork(ipMask, gwIpAddr, dnsIpAddr) ; while(1) // do forever { /* * if necessary, test the return value to get error code */ /* PORTB.B5 = 1; delay_ms(1000); PORTB.B5 = 0; delay_ms(1000); */ if (flag1) asm reset; SPI_Ethernet_doPacket() ; // process incoming Ethernet packets } }Credits to _Lurker_ and carlsberg11 a.k.a. boy femfem.Here is the complete code in ARDUINO:Code: [Select]// Receives data from the serial port#include <LiquidCrystal.h>LiquidCrystal lcd(12, 11, 5, 4, 3, 2);char inChar;int num=0;void setup(){ lcd.clear(); lcd.begin(16, 2); lcd.print(" hello ASIMO =)"); Serial.begin(9600); }void loop(){ lcd.setCursor(16,0); while (Serial.available()>0) { inChar = Serial.read(); num = inChar; if (num==13) { Serial.flush(); break; } else { lcd.autoscroll(); lcd.print(inChar); delay(1000); } } lcd.noAutoscroll(); delay(10000); lcd.clear(); lcd.setCursor(16,0);}Credits to alyas and glutnix_neo for the Serial.flush() code.And also, thanks to PICUSER for the hardware.
Parang merong dot matrix driver sa gizmo prof.Then mag DIY nalang ng dot matrix LEDs.Matagal ko na rin gustong gumawa ng dot matrix display.Pero para sa akin yung serial lcd ang the best pa rin na gamitin.
ang gagaling nyo naman mga master. ang gaganda ng mga ginagawa nyo. sana turuan nyo kaming mga newbie. hindi ung kayong mga masters lang ang nag uusap dito.