Page 1 of 1

ENC28J60 - Ip Address

Posted: Thu Jun 23, 2016 5:38 am
by Roy Johnston
Morning All.
does someone know how to set the IP address in the TCPIP_ENC28J60 component from a variable.
thank you

Re: ENC28J60 - Ip Address

Posted: Thu Jun 23, 2016 4:30 pm
by Benj
Hello Roy,

You should be able to call the initialise command and pass in the IP address you want to use.

Re: ENC28J60 - Ip Address

Posted: Thu Jun 23, 2016 7:07 pm
by Roy Johnston
Evening Benj,
Thanks for your response,
if I call the initialise command there are no parameters to set.
What I am trying to do is the following,
1) check eeprom for a value,
2) if not exist use a standard ip address.
3) if a value exist then use the value.
4) I could even use an input to default back to standard ip.

this way I can write my own ip address with a small app in msaccess to suit the customers local ip subnet.
reading into the eeprom and all that is not a problem , just manipulating the ip of the component is a problem.

thanks in advance

Re: ENC28J60 - Ip Address

Posted: Fri Jun 24, 2016 9:58 am
by Rudi
EDIT:
forget this post ;-)
see the next post.
or this link
enc28J60 ( may 2016 )
the enc28J60 compo is updated long time ago

*********


hi guys

if you want to set the ip in compile time before a enc28j60_init() is done
you can use the properties from enc28j60 to set it by edit the textlines.

if you want to save this in Vars for a Backup in eeprom, then you can
use the EV_compile and save the Ip's setting in your Project Vars.

if you want to set the ip in runtime mode before init the enc28j60 in code
then you can use the write and read register doings for init
and call only the things what you need then byself.

if you want to set the ip like beni sayed, like i have understand ( language translate )
not sure, but think we need a Var "Server IP" update :) or he means the things like on top
descripted.

@roy:

see in the vba example, how the port is done.
go to panel properties and you see a server port 255
this var is then use for the check
"CheckForTCPPort"
and is defined in the code with (FCM ups..sorry must be FCV :) but it was a example.. )

Code: Select all

  #define FCV_00000_panel__FCM_SERVERPORT (255)

and this var you use then with
"CheckForTCPPort" and answere it if match..

btw:

Code: Select all

 MX_GLOBAL MX_UINT8 FCV_XXXX_TCPIP_ENC28J60__BUFFER[FCVsz_XXXX_TCPIP_ENC28J60__BUFFER

Code: Select all

 void FCD_XXXX_TCPIP_ENC28J60__MakeArpRequest(MX_UINT8 *FCL_SERVERIP, MX_UINT16 FCLsz_SERVERIP)


is your friend.

btw, do a view c
and see the other macros, that are not listed in the icon
but still there, you can follow the instruction for a setup the enc28j60
start with

Code: Select all


void FCD_XXXX_TCPIP_ENC28J60__Initialise();



and follow the instruction, what this function call.

then you find the setup procdure for IP and MAC..

IP Code:

Code: Select all

void FCD_XXXX_TCPIP_ENC28J60__IpMakeIp()
{
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[0x1E] = FCV_XXXX_TCPIP_ENC28J60__BUFFER[0x1A];
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[0x1F] = FCV_XXXX_TCPIP_ENC28J60__BUFFER[0x1B];
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[0x20] = FCV_XXXX_TCPIP_ENC28J60__BUFFER[0x1C];
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[0x21] = FCV_XXXX_TCPIP_ENC28J60__BUFFER[0x1D];

    FCV_XXXX_TCPIP_ENC28J60__BUFFER[0x1A] = 192;       ///< ? FCV_MyIpVar0
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[0x1B] = 168;       ///< ? FCV_MyIpVar1
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[0x1C] = 0;          ///< ? FCV_MyIpVar2
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[0x1D] = 90;        ///< ? FCV_MyIpVar3

    FCV_XXXX_TCPIP_ENC28J60__BUFFER[0x14] = 0x40;
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[0x15] = 0;

    FCV_XXXX_TCPIP_ENC28J60__BUFFER[0x12] = FCV_XXXX_TCPIP_ENC28J60__IP_IDENTIFIER >> 8;
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[0x13] = FCV_XXXX_TCPIP_ENC28J60__IP_IDENTIFIER;
    FCV_XXXX_TCPIP_ENC28J60__IP_IDENTIFIER = FCV_XXXX_TCPIP_ENC28J60__IP_IDENTIFIER + 1;

    FCD_XXXX_TCPIP_ENC28J60__IpFillIpHdrChecksum();

}


MAC Code:

Code: Select all


void FCD_XXXX_TCPIP_ENC28J60__IpMakeEth()
{

    FCV_XXXX_TCPIP_ENC28J60__BUFFER[0] = FCV_XXXX_TCPIP_ENC28J60__BUFFER[6];
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[1] = FCV_XXXX_TCPIP_ENC28J60__BUFFER[7];
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[2] = FCV_XXXX_TCPIP_ENC28J60__BUFFER[8];
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[3] = FCV_XXXX_TCPIP_ENC28J60__BUFFER[9];
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[4] = FCV_XXXX_TCPIP_ENC28J60__BUFFER[10];
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[5] = FCV_XXXX_TCPIP_ENC28J60__BUFFER[11];

    FCV_XXXX_TCPIP_ENC28J60__BUFFER[6] = 100;      /// < ? FCV_MyMAC0
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[7] = 101;      /// < ? FCV_MyMAC1
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[8] = 102;      /// < ? FCV_MyMAC2
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[9] = 103;      /// < ? FCV_MyMAC3
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[10] = 104;      /// < ? FCV_MyMAC4
    FCV_XXXX_TCPIP_ENC28J60__BUFFER[11] = 105;      /// < ? FCV_MyMAC5

}



what to do is,
create IP vars for the
BUFFER[1E] / BUFFER[1A]
BUFFER[1F] / BUFFER[1B]
BUFFER[20] / BUFFER[1C]
BUFFER[21] / BUFFER[1D]

create MAC vars for the
BUFFER[0] / BUFFER[6]
BUFFER[1] / BUFFER[7]
BUFFER[2] / BUFFER[8]
BUFFER[3] / BUFFER[9]
BUFFER[4] / BUFFER[10]
BUFFER[5] / BUFFER[11]

and do a setup/init routine with the same function and your overrides
and call it.

or check the

Code: Select all

MX_GLOBAL MX_UINT8 FCV_XXXX_TCPIP_ENC28J60__BUFFER[FCVsz_XXXX_TCPIP_ENC28J60__BUFFER];

at begin in your code after start it and do an [idx]override simple for IP / MAC with your "Project Vars"

if you want relax situation:

Code: Select all

 void FCD_XXXX_TCPIP_ENC28J60__MakeArpRequest(MX_UINT8 *FCL_SERVERIP, MX_UINT16 FCLsz_SERVERIP)


simple check your IP Vars with this.

hope this helps.

nice weekend
best wishes
rudi ;-)

request:

want a

Code: Select all

 void FCD_XXXX_TCPIP_ENC28J60__Initialise(  MyIP );


too

:mrgreen:

Re: ENC28J60 - Ip Address

Posted: Fri Jun 24, 2016 3:29 pm
by Rudi
ah...damm....;-)
now i know, why benj do not response again ;)
which is always a good sign.
"check yours again since a fault with you must be and if it still does not go, then let me know again"
..i have learned in the past .. :mrgreen:

benj was, is and stay the hero, we are "junk dealer" / "dawdler" / "laggard"... roy ;) ( fun )

see here :
now i understand benj's message

long done!
our_best_hero.png

;-)

we use tcp icon from februar 2016, there is a new on board :)
had download this last time, but not used at time.. so i saw today first time the goodies you have make benj.
thank you benj again!!!

( i wish the same guy in my wrk team )

best wishes
rudi ;-)

Re: ENC28J60 - Ip Address

Posted: Sun Jul 03, 2016 1:06 pm
by Roy Johnston
Sorry Guys where can I download this component as my FC 6.1.3.2 does not have it.

Re: ENC28J60 - Ip Address

Posted: Sun Jul 03, 2016 1:27 pm
by Rudi
Roy Johnston wrote:Sorry Guys where can I download this component as my FC 6.1.3.2 does not have it.


read the post over yours,
i wrote:

Rudi wrote:..
see here :
now i understand benj's message

long done!


and click in the "now i understand benj's message" link
(you must click on the blue underline text)

then you come to the post message from benj and the link to compo you search
just in time there are 53 downloads done.

or see the last post from me in your VBA thread
(you must click on the blue underline text)

Re: ENC28J60 - Ip Address

Posted: Sun Jul 03, 2016 1:59 pm
by Rudi
-> your drive\....Flowcode 6\components
make a backup from your existing "TCPIP_ENC28J60.fcpx" example rename it to "TCPIP_ENC28J60.fcpx.bak"

you must download the "TCPIP_ENC28J60.fcpx" and save it on your flowcode install
-> Flowcode 6\components

folder


link_click.jpg

Re: ENC28J60 - Ip Address

Posted: Sun Jul 03, 2016 3:02 pm
by Roy Johnston
Thank you,
I did not realise it was a component download and not a different version of FC

Re: ENC28J60 - Ip Address

Posted: Tue Oct 18, 2016 5:04 am
by Zalat88
Hi everybody
I'm new on flowcode, and I need a help about ENC28J60 - Ip Address :( :(
how to arrange such a transfer, how to set the ip address, where to get ip address ENC28J60 etc.
I use flowcode 5

Re: ENC28J60 - Ip Address

Posted: Tue Oct 18, 2016 11:20 am
by Benj
Hello Zalat,

Flowcode 5 has support for the SPI peripheral. The ENC28J60 is a SPI to Ethernet adapter. By using SPI communications you can create macros to allow you to use the ENC28J60 e.g. setting the IP address. The datasheet should show you how to use the SPI interface to talk to the module.

Flowcode 6 and 7 already has these macros in the form of a new component which may help to get you up and running faster.