Hi all,
I'm trying to adapt a project. I have a PIC18F45K22 with an ethernet controller (ENC24J60) attached to it. It has been programmed with BASIC code to allow it to be a web-server.
The basic idea is this: Open up a browser (Firefox, Chrome etc) and enter in the IP address and a page is displayed. On the page the Led's connected to the PIC's PortD can be toggled on or off via 'toggle' links, push-buttons connected to the PIC's PortB if pushed to reflect a 'high' or 'on' state are shown as such on the page and a potentiometer connected to the PIC's analogue channel 0 (AN0) has it's reading (0-500) shown on the web-page. The PIC also sends the browser the number of web-requests and displays this as well. All this is done in the PIC using TCP (you set the MAC address, IP address, IP gateway address, dns address and subnet mask address in the PIC) the PIC only listens on Port 80 although I'm use that can be changed as well.
It uses HTTP stored on the PIC to tell the browser how to display all this information and recieves "Get requests" from the browser to toggle the Led's and/or show the state of all the items. The project can be viewed in MikroBasic and can be seen here: http://www.mikroe.com/click/# (scroll down to ETH Click).
I am beginning to dabble in Visual Studio 2010 using Visual Basic, doing tutorials from YouTube, the web and viewing the help files.
My aim is to write a program to connect to this PIC. I know I will have to change the code in the PIC, I guess I'll need to get rid of the http web-page stuff and replace it with code that receives requests from my VB program to either toggle the state of the leds and/or tell the VB program what the state of the ADC reading/push-buttons/Led's. And that's fine I can do that later.
Looking around the web I have found a lot of stuff that connects the PIC to my PC via serial communication. I do not want that, what I want is for the PIC and PC to communicate via ethernet (LAN) using the router.
So my questions are:
-Is there anyone who can direct me to a tutorial that will give me the basics on such a thing? (I've seen a few LAN chat programs using the TCPClient/TCPListener classes but have not yet understood how i can adapt these to my aim)
-Where do I start with such an undertaking? (Yes I do tend to bite off more than I can chew, but hey, bite off more and chew like crazy I say)
-This project really is about reading a byte or two from a PIC and sending it as much so it can turn on/off stuff, surely that isn't that hard to write a simple windows form program in VB for is it? (which is why I'm here. I can't find anything on the web that teaches a simple read and write to network program, maybe I've written the wrong thing into the search engine?!?)
Any and all help would be great:)
thanks
Chris
P.S. attached is a screen-shot of how I want the program to look. It shows if it's connected to the board, you enter the IP address in and can "connect" via a button, then once connected, toggle the leds (the picture box would change to a lit led from an unlit one depending upon that led's state, the pushbutton state if reflected as is the adc result.
Attachment 98203
I'm trying to adapt a project. I have a PIC18F45K22 with an ethernet controller (ENC24J60) attached to it. It has been programmed with BASIC code to allow it to be a web-server.
The basic idea is this: Open up a browser (Firefox, Chrome etc) and enter in the IP address and a page is displayed. On the page the Led's connected to the PIC's PortD can be toggled on or off via 'toggle' links, push-buttons connected to the PIC's PortB if pushed to reflect a 'high' or 'on' state are shown as such on the page and a potentiometer connected to the PIC's analogue channel 0 (AN0) has it's reading (0-500) shown on the web-page. The PIC also sends the browser the number of web-requests and displays this as well. All this is done in the PIC using TCP (you set the MAC address, IP address, IP gateway address, dns address and subnet mask address in the PIC) the PIC only listens on Port 80 although I'm use that can be changed as well.
It uses HTTP stored on the PIC to tell the browser how to display all this information and recieves "Get requests" from the browser to toggle the Led's and/or show the state of all the items. The project can be viewed in MikroBasic and can be seen here: http://www.mikroe.com/click/# (scroll down to ETH Click).
I am beginning to dabble in Visual Studio 2010 using Visual Basic, doing tutorials from YouTube, the web and viewing the help files.
My aim is to write a program to connect to this PIC. I know I will have to change the code in the PIC, I guess I'll need to get rid of the http web-page stuff and replace it with code that receives requests from my VB program to either toggle the state of the leds and/or tell the VB program what the state of the ADC reading/push-buttons/Led's. And that's fine I can do that later.
Looking around the web I have found a lot of stuff that connects the PIC to my PC via serial communication. I do not want that, what I want is for the PIC and PC to communicate via ethernet (LAN) using the router.
So my questions are:
-Is there anyone who can direct me to a tutorial that will give me the basics on such a thing? (I've seen a few LAN chat programs using the TCPClient/TCPListener classes but have not yet understood how i can adapt these to my aim)
-Where do I start with such an undertaking? (Yes I do tend to bite off more than I can chew, but hey, bite off more and chew like crazy I say)
-This project really is about reading a byte or two from a PIC and sending it as much so it can turn on/off stuff, surely that isn't that hard to write a simple windows form program in VB for is it? (which is why I'm here. I can't find anything on the web that teaches a simple read and write to network program, maybe I've written the wrong thing into the search engine?!?)
Any and all help would be great:)
thanks
Chris
P.S. attached is a screen-shot of how I want the program to look. It shows if it's connected to the board, you enter the IP address in and can "connect" via a button, then once connected, toggle the leds (the picture box would change to a lit led from an unlit one depending upon that led's state, the pushbutton state if reflected as is the adc result.
Attachment 98203