View previous topic :: View next topic |
Author |
Message |
Manel28
Joined: 06 May 2010 Posts: 33
|
TCP2UART project in CCS |
Posted: Thu Nov 04, 2010 5:33 am |
|
|
Does anyone know if there is some TCP2UART project migrated to CCS? I would like to have some example code to implement a ethernet to serial converter based on PIC18F25j10 and ENC28j60. Thanks |
|
|
andrewg
Joined: 17 Aug 2005 Posts: 316 Location: Perth, Western Australia
|
|
Posted: Thu Nov 04, 2010 8:29 pm |
|
|
I've done this (for a commercial project, so I can't share the source), but as projects go, it was pretty easy. It was a couple of days work from scratch.
Start with the Telnet RFC0854. Telnet basically streams raw bytes back and forth on a TCP socket, except that it uses 255 as an 'escape' character to enable extra functionality. CCS TCPIP examples 13 and 13b cover TCP client/server comms.
Then read RFC2217. That's serial port emulation extensions to Telnet. It defines extra 'escape' commands to switch baud rates and flow control. _________________ Andrew |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Fri Nov 05, 2010 8:28 am |
|
|
andrewg wrote: | I've done this (for a commercial project, so I can't share the source), but as projects go, it was pretty easy. It was a couple of days work from scratch.
Start with the Telnet RFC0854. Telnet basically streams raw bytes back and forth on a TCP socket, except that it uses 255 as an 'escape' character to enable extra functionality. CCS TCPIP examples 13 and 13b cover TCP client/server comms.
Then read RFC2217. That's serial port emulation extensions to Telnet. It defines extra 'escape' commands to switch baud rates and flow control. |
I did the same thing (with an octal UART) but was also part of a paid project, so I can't share the source. I used RAW sockets which is a little easier and a telnet interface that allowed configuring the ports speeds and such.
It's pretty straight-forward.
I started with the CCS TCPIP Stack and just used that as a template. Study the example -- in a sense, everything you need is in there. _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
Manel28
Joined: 06 May 2010 Posts: 33
|
|
Posted: Fri Nov 12, 2010 4:00 am |
|
|
The problem is that this is my first experience with ethernet in PICs and I don't know exactly how to organize the hole thing. It would be pretty easy to buy a commercial device but I want to learn something by myself. Some example code would be nice. Anyway I have decided to bring it forward . |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Fri Nov 12, 2010 2:17 pm |
|
|
Manel28 wrote: | The problem is that this is my first experience with ethernet in PICs and I don't know exactly how to organize the hole thing. It would be pretty easy to buy a commercial device but I want to learn something by myself. Some example code would be nice. Anyway I have decided to bring it forward . |
Example code?
Microchip's library. It has an example to model.
The CCS TCPIP library is Microchip's TCPIP library V3.75.
In fact, with a little cutting and pasting, I'd bet the Microchip files containing the UART "stuff" could be easily pasted over to CCS.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
andrewg
Joined: 17 Aug 2005 Posts: 316 Location: Perth, Western Australia
|
|
Posted: Fri Nov 12, 2010 9:30 pm |
|
|
A first step could be to compile the CCS examples 13/13b I mentioned above and see if you can get them working. Your PC will have a telnet client you can use for testing. I forget exactly what the example do, but just getting your PIC to echo typed characters back would probably be enough for starters.
FYI, if you do decide to implement Telnet serial port (RFC2217), then a handy PC app is http://www.hw-group.com/products/hw_vsp/index_en.html which creates a virtual COM port to your device. _________________ Andrew |
|
|
|