Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Enc28j60 And Atmega32
Goto page Previous  1, 2
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP
View previous topic :: View next topic  
Author Message
hoerspieler

Bascom Member



Joined: 17 May 2008
Posts: 3

germany.gif
PostPosted: Thu Dec 18, 2008 10:36 am    Post subject: ENC28J60 and newer Bascom-versions... Reply with quote

Hi,
to get it to work with Bascom 1.11.9.2 I changed the following in Ben's code:

Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0

changed into

Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 1

and in the Sub Enc28j60readcontrolregbyte I changed

If Mcphy = 1 Then
Enc28j60_data = A(2)
Else
Enc28j60_data = A(3)
End If

into

If Mcphy = 1 Then
Enc28j60_data = A(2)
Else
Enc28j60_data = A(1)
End If


Perhaps you can try this. I think the older Bascom versions have had a bug in handling of the spi.

Regards,
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Thu Dec 18, 2008 1:30 pm    Post subject: A big THANKS Reply with quote

Thanks for fixing that.

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
pashe007

Bascom Member



Joined: 28 Dec 2006
Posts: 7

iran.gif
PostPosted: Sat Dec 20, 2008 10:20 am    Post subject: Reply with quote

thank you for your code.
i try this code for my ethernet device.

is code work at bascom 1.11.9.0 ?
Back to top
View user's profile
pashe007

Bascom Member



Joined: 28 Dec 2006
Posts: 7

iran.gif
PostPosted: Sun Dec 21, 2008 4:40 am    Post subject: Reply with quote

thank you ben .
your code is very good & working on my circuit.
i have one litile bug in my circuit .

best regard
Back to top
View user's profile
huetti

Bascom Member



Joined: 25 Feb 2007
Posts: 9

germany.gif
PostPosted: Sun Dec 28, 2008 8:59 pm    Post subject: Reply with quote

@hoerspieler

Hi
versuche gerade das pollin-board als Webserver zum laufen zu
bringen. Mit deinen Änderungen geht das ping-reply einwandfrei.
http geht nicht, UDP mangels Zeit noch nicht geprüft.

Geht bei dir die Ausgabe von http-Seiten ?

Grüße

Hütti
Back to top
View user's profile
Ajaxelectronic

Bascom Member



Joined: 22 Nov 2009
Posts: 171
Location: Iran

iran.gif
PostPosted: Thu Apr 03, 2014 10:44 pm    Post subject: Reply with quote

Hi

first tanks to Ben for nice code and subroutines. i make a circuit with atmega32 and it work nice. i could send and receive data in TCP mode.now i want 2 question!

1. how can i read from AVR every 10 second?
now i can read my PORT or ADC data with SUBMIT button. but i want to reading be automatic. for example every 10 second. i test several ways,but i can't get a result.

2. how can i connect to my board from the internet?
now i can connect to my board in the local area network,but i can't connect to it from the internet.


Best Regards

_________________
www.mrkelectronic.blogfa.com

Best Regards
Back to top
View user's profile Visit poster's website Yahoo Messenger
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1257
Location: SYDNEY

australia.gif
PostPosted: Fri Apr 04, 2014 3:01 am    Post subject: Reply with quote

Hello Ajaxelectronic
If you look at the blog section you will find my ENC28J60 webserver project this has a lot of information in the comments.
There is a problem with internet explorer and the ENC28J60 I have two projects one with a DsPIC33 and the AVR both have the problem but have totaly diffrent code so you are better to use firefox or chrome. Now the DsPIC33 project is called Webserver In a Box (WIB) by silicon chip magazine in australia and it uses Ajax code to poll the little server to get the ADC and digital readings from it updating on the page using a timer this could be changed to work with the AVR but not used in a comercial project due to copyright , though it will show how to use java script then you can write your own java script. I have been working on an Arduino board with the Wiznet W5100 moving the code over to use it as I met a dead end with the ENC28J60 not being able to send multiple packets which the Wiznet chip can as it does all the TCPIP work and will publish it in the Blog section when I get it stable and working properly.

Regards Paul
Back to top
View user's profile
Ajaxelectronic

Bascom Member



Joined: 22 Nov 2009
Posts: 171
Location: Iran

iran.gif
PostPosted: Fri Apr 04, 2014 9:00 am    Post subject: Reply with quote

thanks a lot Paulvk

i saw your project and iframe code and RestartJava. i used from a little HTML code that can refresh my page every 10 second (NOTE, refresh time is changeable easily).

but i can't understand how can i connect to my board from internet. for example my board is in the my home and i am i my little office in the other city.how can i connect to my board ,now? Question

Best Regards

_________________
www.mrkelectronic.blogfa.com

Best Regards
Back to top
View user's profile Visit poster's website Yahoo Messenger
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1257
Location: SYDNEY

australia.gif
PostPosted: Fri Apr 04, 2014 9:45 am    Post subject: Reply with quote

You will have to do port forwarding in you internet modem/router but this will expose it to the net, the best way is with Virtual Private Network (VPN) for this you need a VPN server where the unit is, this enables you to use a username and password to log into your network and make as if you are connected at home it also hides what you do using encryption. Some modem/routers have this built in or you need a small computer on your network to run the server so do some research on port forwarding And VPN.

Regards Paul
Back to top
View user's profile
Ajaxelectronic

Bascom Member



Joined: 22 Nov 2009
Posts: 171
Location: Iran

iran.gif
PostPosted: Fri Apr 04, 2014 10:26 am    Post subject: Reply with quote

ok. i search about it.

what is your idea about Valid IP ? is it possible?

_________________
www.mrkelectronic.blogfa.com

Best Regards
Back to top
View user's profile Visit poster's website Yahoo Messenger
whoman

Bascom Member



Joined: 25 Jul 2014
Posts: 2

PostPosted: Fri Jul 25, 2014 12:34 pm    Post subject: hi Mr BEN Reply with quote

hi

im going to simulate a enc28j60 and atmega in proteus
(in help of proteus says we can this in real networke or...)

im reed your code in

http://members.home.nl/bzijlstra/software/examples/enc28j60.htm

and i really mixed up hardly for you sub and i cant understand :

Sub Enc28j60selectbank(bank As Byte)
'get ECON1 (BSEL1 en BSEL0)
A(1) = &B000_11111
Enc28j60_cs = 0
Spiout A(1) , 1
Spiin A(1) , 2
Enc28j60_cs = 1
A(2) = A(2) And &B1111_1100 'strip bank part
A(2) = A(2) Or Bank
A(1) = &B010_11111
Enc28j60_cs = 0
Spiout A(1) , 2
Enc28j60_cs = 1
End Sub

A(1) will contain the dummybyte, so in A(2) the value of register ECON1. We strip BSEL1 and BSEL0 bits, put in the bank we want to switch to, and send the result back to the ENC28J60. The instruction for a write control register is &B010 followed by the register we want to write.

when A(2) = A(2) And &B1111_1100
A(2) = A(2) Or Bank

who A(2) the value of register ECON1 ??????????????????????????????????????????????????
u spiin A(1) and
A(2) = A(2) And &B1111_1100
A(2) = A(2) Or Bank

then say A(2) a value of econ1 !!!!!!!!!!!!!!!!

plz help me

AND I HAVE ONE REQUEST FOR U MR BEN PLZ PLZ ATTACH ME A SIMPLE AND EASY PROGRAM OF THIS CODE FOR ME IM REALLY TIERD TO UNDERSTAN THIS CODE

best regurad for u and have fun
Back to top
View user's profile
whoman

Bascom Member



Joined: 25 Jul 2014
Posts: 2

PostPosted: Mon Jul 28, 2014 8:29 am    Post subject: Reply with quote

this simulate is done if every one need help im ready Laughing
Back to top
View user's profile
Debu

Bascom Member



Joined: 06 Jan 2008
Posts: 21
Location: Dhaka

bangladesh.gif
PostPosted: Thu Aug 21, 2014 12:36 pm    Post subject: Reply with quote

Hallo
Ben
Do you try this code in Xmega ?
Back to top
View user's profile AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum