ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 12.06.2025

Просмотров: 8183

Скачиваний: 1

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

© MCS Electronics, 1995-2007

CONFIG TCPIP = int , MAC = mac , IP = ip, SUBMASK = mask, GATEWAY = gateway, LOCALPORT= port, TX= tx, RX= rx , NOINIT= 0|1 , TWI=address , Clock =speed [, baseaddress = address]

Remarks

Int

The interrupt to use such as INT0 or INT1.

For the Easy TCP/IP PCB, use INT0.

MAC

The MAC address you want to assign to the W3100A.

The MAC address is a unique number that identifies your chip. You must

use a different address for every W3100A chip in your network.

Example : 123.00.12.34.56.78

You need to specify 6 bytes that must be separated by dots. The bytes

must be specified in decimal notation.

IP

The IP address you want to assign to the W3100A.

The IP address must be unique for every W3100A in your network. When

you have a LAN, 192.168.0.10 can be used. 192.168.0.x is used for LAN’s

since the address is not an assigned internet address.

SUBMASK

The submask you want to assign to the W3100A.

The submask is in most cases 255.255.255.0

GATEWAY

This is the gateway address of the W3100A.

The gateway address you can determine with the IPCONFIG command at

the command prompt :

C:\>ipconfig

Windows 2000 IP Configuration

Ethernet adapter Local Area Connection 2:

Connection-specific DNS Suffix . :

IP Address. . . . . . . . . . . . : 192.168.0.3

Subnet Mask . . . . . . . . . . . : 255.255.255.0

Default Gateway . . . . . . . . . : 192.168.0.1

Use 192.168.0.1 in this case.

LOCALPORT

A word value that is assigned to the LOCAL_PORT internal variable. See

also Getsocket.

As a default you can assign a value of 5000.

TX

A byte which specifies the transmit buffer size of the W3100A. The

W3100A has 4 sockets.

A value of 00 will assign 1024 bytes, a value of 01 will assign 2048 bytes.

A value of 10 will assign 4096 bytes and a value of 11 will assign 8192

bytes.

This is binary notation. And the Msbits specify the size of socket 3.

For example, you want to assign 2048 bytes to each socket for

transmission : TX = &B01010101

page -386-


© MCS Electronics, 1995-2007

RX

Noinit

Since the transmission buffer size may be 8KB in total, you can split them up in 4 parts of 2048 bytes : 01.

When you want to use 1 socket with 8KB size, you would use : TX = &B11. You can use only 1 socket in that case : socket 0.

A byte which specifies the receive buffer size of the W3100A. The W3100A has 4 sockets.

A value of 00 will assign 1024 bytes, a value of 01 will assign 2048 bytes. A value of 10 will assign 4096 bytes and a value of 11 will assign 8192 bytes.

This is binary notation. And the Msbits specify the size of socket 3.

For example, you want to assign 2048 bytes to each socket for reception : RX = &B01010101

Since the receive buffer size may be 8KB in total, you can split them up in 4 parts of 2048 bytes : 01.

When you want to use 1 socket with 8KB size, you would use : RX = &B11. You can use only 1 socket in that case : socket 0.

Consult the W3100A pdf for more info.

Make this 1 when you want to configure the TCP, MAC, Subnetmask and GateWay dymanic. Noinit will only make some important settings and you need to use SETTCP in order to finish the setup.

TWI

The slave address of the W3100A/NM7010. When you specify TWI, your

micro must have a TWI interface such as Mega128, Mega88, Mega32.

Clock

The clock frequency to use with the TWI interface

Baseaddress An optional value for the chip select of the W3100A. This is default &H8000 when not specified. When you create your own board, you can override it.

The CONFIG TCPIP statement may be used only once.

Interrupts must be enabled before you use CONFIG TCPIP.

Configuring the W3100A will init the chip.

After the CONFIG TCPIP, you can already PING the chip!

The TWI mode works only when your micro support the TWI mode. You need to have 4k7 pull up resistors.

MCS Electronics has a small adapter PCB and KIT available that can be connected easily to your microprocessor.

The new TWI mode makes your PCB design much simpler. TWI is not as fast as bus mode. While you can use every supported TCP/IP function, it will run at a lower speed.

See also

GETSOCKET , SOCKETCONNECT, SOCKETSTAT , TCPWRITE, TCPWRITESTR, TCPREAD, CLOSESOCKET , SOCKETLISTEN

Syntax Example

Config Tcpip = Int0 , Mac = 00.00.12.34.56.78 , Ip = 192.168.0.8 , Submask = 255.255.255.0 , Gateway = 192.168.0.1 , Localport = 1000 , Tx = $55 , Rx = $55

page -387-


© MCS Electronics, 1995-2007

‘Now use PING at the command line to send a ping:

PING 192.168.0.8

Or use the easytcp application to ping the chip.

CONFIG TIMER0

Action

Configure TIMER0.

Syntax

CONFIG TIMER0 = COUNTER , PRESCALE= 1|8|64|256|1024 ,

EDGE=RISING/FALLING , CLEAR TIMER = 1|0

CONFIG TIMER0 = TIMER , PRESCALE= 1|8|64|256|1024

Remarks

TIMER0 is a 8 bit counter. See the hardware description of TIMER0.

When configured as a COUNTER:

EDGE

You can select whether the TIMER will count on the falling or rising

edge.

When configured as a TIMER:

PRESCALE

The TIMER is connected to the system clock in this case. You can select

the division of the system clock with this parameter.

Valid values are 1 , 8, 64, 256 or 1024

Note that some new AVR chips have different prescale values. You can use these.

Notice that the Help was written with the AT90S2313 and AT90S8515 timers in mind.

When you use the CONFIG TIMER0 statement, the mode is stored by the compiler and the TCCRO register is set.

When you use the STOP TIMER0 statement, the TIMER is stopped.

When you use the START TIMER0 statement, the TIMER TCCR0 register is loaded with the last value that was configured with the CONFIG TIMER0 statement.

So before using the START and STOP TIMER0 statements, use the CONFIG statement first.

Example

'-----------------------------------------------------------------------------

------------

: timer0.bas

'name

'copyright

: (c) 1995-2005, MCS Electronics

'purpose

: shows how to use TIMER0 related statements

'micro

: 90S2313

page -388-


© MCS Electronics, 1995-2007

'suited for demo

: yes

'commercial addon needed

: no

'-----------------------------------------------------------------------------

------------

$regfile = "2313def.dat"

' specify the used

micro

' used crystal

$crystal = 8000000

frequency

' use baud rate

$baud = 19200

$hwstack = 32

' default use 32

for the hardware stack

' default use 10

$swstack = 10

for the SW stack

' default use 40

$framesize = 40

for the frame space

'First you must configure the timer to operate as a counter or as a timer 'Lets configure it as a COUNTER now

'You must also specify if it will count on a rising or falling edge

Config Timer0 = Counter , Edge = Rising 'Config Timer0 = Counter , Edge = falling

'unremark the line aboven to use timer0 to count on falling edge

'To get/set the value from the timer access the timer/counter register 'lets reset it to 0

Tcnt0 = 0

Do

Print Tcnt0

Loop Until Tcnt0 >= 10

'when 10 pulses are count the loop is exited 'or use the special variable TIMER0

Timer0 = 0

'Now configire it as a TIMER

'The TIMER can have the systemclock as an input or the systemclock divided 'by 8,64,256 or 1024

'The prescale parameter excepts 1,8,64,256 or 1024

Config Timer0 = Timer , Prescale = 1

'The TIMER is started now automaticly

'You can STOP the timer with the following statement :

Stop Timer0

'Now the timer is stopped

'To START it again in the last configured mode, use :

Start Timer0

'Again you can access the value with the tcnt0 register

Print Tcnt0 'or

Print Timer0

'when the timer overflows, a flag named TOV0 in register TIFR is set 'You can use this to execute an ISR

'To reset the flag manual in non ISR mode you must write a 1 to the bit position

'in TIFR:

Set Tifr.1

page -389-