Small tutorial W7100 and Bascom-8051

Moderator: Victor

Small tutorial W7100 and Bascom-8051

Postby bzijlstra » Tue Dec 22, 2009 3:32 pm

Got my iMCU7100EVB and started programming in Bascom-8051. Made a DAT-file to be used with Bascom, made an include-file with all W7100 registers and made some examples. You can find a small tutorial on my homepage at http://members.home.nl/bzijlstra

PING, UDP and HTTP, piece of cake with this nice microcontroller :D

Have fun
Ben Zijlstra
bzijlstra
 
Posts: 38
Joined: Wed Jun 24, 2009 2:09 pm
Location: Tilburg, Netherlands
Blog: http://benshobbycorner.nl

Re: Small tutorial W7100 and Bascom-8051

Postby leepoult » Fri Mar 05, 2010 12:46 am

Wow you did many great things!!
Especially the W7100 HTTP server, I wondered how many size of the code??
I interest HTTPS the secured HTTP server or client.
I will implement SSL or TLS on W7100 but its footprint is very big.
I hope your reply~~ thanks!!
leepoult
 
Posts: 42
Joined: Fri Jun 19, 2009 3:18 am
Blog: http://

Re: Small tutorial W7100 and Bascom-8051

Postby bzijlstra » Thu Mar 25, 2010 9:30 am

Well it is going very well. Made a very nice application for the W7100. At first I thought I had some problems trying to get hold of the XRAM, but after some test it is working. The application I have written is about 10 Kbytes of flash and uses about 1 kbytes of XRAM. Made a add-on for the iMCU7100 to combine wired and wireless. The W7100 is contacted every 10 seconds from the Internet without any problems. Later on you will see the application I have made....

Here a picture of the add-on prototype board:
Image

Who would ever thought to have a 8051 with 64 kbyte flash, with 64 kbyte RAM and with a build-in TCP/IP.... Bascom-8051 has been some kind of sleeping product, compared to Bascom-AVR, but it is well awake at the moment ;)

Have fun
Ben Zijlstra
Last edited by bzijlstra on Sun May 09, 2010 8:15 am, edited 1 time in total.
bzijlstra
 
Posts: 38
Joined: Wed Jun 24, 2009 2:09 pm
Location: Tilburg, Netherlands
Blog: http://benshobbycorner.nl

Re: Small tutorial W7100 and Bascom-8051

Postby p1t1x_grg » Fri Apr 09, 2010 10:12 am

Hi,

when i try to download hex file from this code
Code: Select all
$regfile = "W7100.DAT"
$crystal = 11059200

Do
Set P0.3
Set P0.4
Set P0.5
Wait 1
Reset P0.3
Reset P0.4
Reset P0.5
Wait 1
Loop
End


three LEDs can't go on for 1 second and off for 1 second.
All of this led blink fast of 1 second.
what's wrong?
can you help me?
p1t1x_grg
 
Posts: 3
Joined: Fri Apr 09, 2010 10:04 am
Blog: http://

Re: Small tutorial W7100 and Bascom-8051

Postby bzijlstra » Fri Apr 09, 2010 8:46 pm

Got three files for you:

http://benshobbycorner.nl/W7100_test/w7100_LCD.TXT the source for Bascom-8051
http://benshobbycorner.nl/W7100_test/W7100_LCD.HEX the hex-file from this source
http://benshobbycorner.nl/W7100_test/W7100.DAT the Bascom-8051 dat-file with registers for W7100

It is working here like it should, some text on the LCD, some text out the serial port and three blinking LEDs one second on one second off.

The complete W7100 no mystery to me anymore. Working with the Bootrom from within Bascom-8051, writing and reading to the Dataflash, accessing internal and external RAM, TCP/IP etc. etc.
There is only one issue, strings in XRAM, but I will get that working later on.

Have fun
Ben Zijlstra
http://benshobbycorner.nl
http://members.home.nl/bzijlstra
bzijlstra
 
Posts: 38
Joined: Wed Jun 24, 2009 2:09 pm
Location: Tilburg, Netherlands
Blog: http://benshobbycorner.nl

Re: Small tutorial W7100 and Bascom-8051

Postby buddy.smith » Fri Apr 09, 2010 10:58 pm

bzijlstra wrote:Got three files for you:
There is only one issue, strings in XRAM, but I will get that working later on.

Have fun
Ben Zijlstra
http://benshobbycorner.nl
http://members.home.nl/bzijlstra


Hi Ben,

If you look at my HTTP post, you can find a wizmemcpy.c that works with CODE pointers (which your strings probably are).

Feel free to port the concept over to your platform. Basically, you have to use MOVC to get it to a register, before using MOVX to put it back. My code uses the 'top' address byte of generic pointers to determine if it's a CODE pointer or an XDATA pointer. I don't recall if it works on pointers that are neither.

SDCC and/or BASCOM might use different ways of handling CODE/XDATA/NEAR pointers, so I can't promise it'll work the same for you.

--buddy
buddy.smith
 
Posts: 42
Joined: Tue Nov 24, 2009 5:38 am
Blog: http://

Re: Small tutorial W7100 and Bascom-8051

Postby p1t1x_grg » Mon May 17, 2010 5:54 am

Hi Ben,

I has been download the hex file from you into W7100 chip. That's right... three blinking LEDs one second on one second off.

But, if i copy-paste text "w7100_LCD.TXT " into w7100.BAS(BASCOM 8051), include file W7100.DAT in the folder MCS-Electronics and i compile this file (w7100.bas). I get a file w7100.hex. I download this hex file into w7100. the result is error. LED can't blinking every 1 second.

When i compare my hex file (w7100.HEX) with hex file from you (W7100_LCD.HEX), that's is different.
Maybe you can give me information about version of BASCOM 8051 wich compatible with your tutorial.

i using BASCOM 8051 version 2.0.13.0 DEMO Version
p1t1x_grg
 
Posts: 3
Joined: Fri Apr 09, 2010 10:04 am
Blog: http://

Re: Small tutorial W7100 and Bascom-8051

Postby bzijlstra » Mon May 17, 2010 3:54 pm

Am using the Bascom-8051 2.0.14 registered.

That will explain why the hex-files are not the same, but I think I haven't used any specific Bascom-8051 2.0.14 commands.

If you follow the tutorial and just use this:
Code: Select all
$regfile = "W7100.DAT"
$crystal = 11059200

Do
Set P0.3
Set P0.4
Set P0.5
Wait 1
Reset P0.3
Reset P0.4
Reset P0.5
Wait 1
Loop
End


You see blinking leds?

Ben Zijlstra
bzijlstra
 
Posts: 38
Joined: Wed Jun 24, 2009 2:09 pm
Location: Tilburg, Netherlands
Blog: http://benshobbycorner.nl

Re: Small tutorial W7100 and Bascom-8051

Postby p1t1x_grg » Fri May 21, 2010 6:57 am

Hi Ben,

Thank you for your information.
I am using BASCOM 8051 version 2.0.14, and the problem is resolved.

Now i have some problem to access dataflash W7100 using BASCOM-8051.

I was reading at your blog and you say that you successfull writing an array of 256 bytes to the W7100 dataflash.

Can you give that's source code for me?
p1t1x_grg
 
Posts: 3
Joined: Fri Apr 09, 2010 10:04 am
Blog: http://

Re: Small tutorial W7100 and Bascom-8051

Postby bzijlstra » Fri May 21, 2010 7:38 am

The W7100 has 256 byte of dataflash. It can be used to store IP-number, NetMask, Gateway, MAC etc. during configuration. You can access it by using a routine in the W7100-bootrom

Here is the code:

Code: Select all
$regfile = "W7100.DAT"
$crystal = 11059200
$baud = 115200
$default XRAM
$large

Tl1=&HFC
Th1=&HFE

$romstart = &H0800

Dim Dataflash(256) as byte
Dim Q as word

Q = varptr(Dataflash(1))
Wconf.7 = 0 'no reboot
Wconf.6 = 0 'activate bootrom
Tmpr0 = low(q)
Tmpr1 = high(q)
Ispaddrh = Tmpr1
Ispaddrl = Tmpr0
Ispid = &HD2 'read
Call &H07FD
Wconf.6 = 1 'deactivate bootrom

End


In the code an array called Dataflash is dimensioned and a pointer is set to the address where it is stored in external SRAM (Q). The write is almost the same, you only have to change the Ispid.

The $romstart = &H0800 is done to allow the bootrom code to be loaded in the lower part of Code memory. With Wconf.7 you can tell the microcontroller you want a restart after finishing the bootrom-access, or you don't want a reset. With the Wconf.6 you activate the bootrom.

I also found out that $default Xram can be used for all variables but the strings. The strings has to be stored in internal SRAM.

It still is a very nice chip.
Ben Zijlstra
bzijlstra
 
Posts: 38
Joined: Wed Jun 24, 2009 2:09 pm
Location: Tilburg, Netherlands
Blog: http://benshobbycorner.nl


Return to WIZnet Education Center

Who is online

Users browsing this forum: No registered users and 1 guest

cron