In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Stolzie wrote: Here are the defines. [code]; **************************** ; *** BLANK EEPROM DEFINES *** ; **************************** MY_ETH_ADDR0 = $0 ; Boards Basic MAC address when EEPROM blank MY_ETH_ADDR1 = $11 ; " MY_ETH_ADDR2 = $BA ; " MY_ETH_ADDR3 = $0 ; " MY_ETH_ADDR4 = $0 ; " MY_ETH_ADDR5 = $1 ; " ; INCLUDE "SX52.inc" ; SX52.inc ;********************************************************************************* ; SX48BD/52BD Mode addresses ; *On SX48BD/52BD, most registers addressed via mode are read and write, with the ; exception of CMP and WKPND which do an exchange with W. ;********************************************************************************* ; Timer (read) addresses TCPL_R = $00 ; Read Timer Capture register low byte TCPH_R = $01 ; Read Timer Capture register high byte TR2CML_R = $02 ; Read Timer R2 low byte TR2CMH_R = $03 ; Read Timer R2 high byte TR1CML_R = $04 ; Read Timer R1 low byte TR1CMH_R = $05 ; Read Timer R1 high byte TCNTB_R = $06 ; Read Timer control register B TCNTA_R = $07 ; Read Timer control register A ; Exchange addresses CMPW = $08 ; Exchange Comparator enable/status register with W WKPND = $09 ; Exchange MIWU/RB Interrupts pending with W ; Port setup (read) addresses WKED_R = $0A ; Read MIWU/RB Interrupt edge setup, 0 = falling, 1 = rising WKEN_R = $0B ; Read MIWU/RB Interrupt edge setup, 0 = enabled, 1 = disabled ST_R = $0C ; Read Port Schmitt Trigger setup, 0 = enabled, 1 = disabled LVL_R = $0D ; Read Port Level setup, 0 = CMOS, 1 = TTL PLP_R = $0E ; Read Port Pull-up setup, 0 = enabled, 1 = disabled DIR_R = $0F ; Read Port Direction ; Timer (write) addresses TR2CML_W = $12 ; Write Timer R2 low byte TR2CMH_W = $13 ; Write Timer R2 high byte TR1CML_W = $14 ; Write Timer R1 low byte TR1CMH_W = $15 ; Write Timer R1 high byte TCNTB_W = $16 ; Write Timer control register B TCNTA_W = $17 ; Write Timer control register A ; Port setup (write) addresses WKED_W = $1A ; Write MIWU/RB Interrupt edge setup, 0 = falling, 1 = rising WKEN_W = $1B ; Write MIWU/RB Interrupt edge setup, 0 = enabled, 1 = disabled ST_W = $1C ; Write Port Schmitt Trigger setup, 0 = enabled, 1 = disabled LVL_W = $1D ; Write Port Level setup, 0 = CMOS, 1 = TTL PLP_W = $1E ; Write Port Pull-up setup, 0 = enabled, 1 = disabled DIR_W = $1F ; Write Port Direction ;********************************************************************************* ; Setup and enable RTCC interrupt, WREG register, RTCC/WDT prescaler ;********************************************************************************* RTCC_ON = %10000000 ; Enables RTCC at address $01 (RTW hi) ; WREG at address $01 (RTW lo) by default RTCC_ID = %01000000 ; Disables RTCC edge interrupt (RTE_IE hi) ; RTCC edge interrupt (RTE_IE lo) enabled by default RTCC_INC_EXT = %00100000 ; Sets RTCC increment on RTCC pin transition (RTS hi) ; RTCC increment on internal instruction (RTS lo) is defalut RTCC_FE = %00010000 ; Sets RTCC to increment on falling edge (RTE_ES hi) ; RTCC to increment on rising edge (RTE_ES lo) is default RTCC_PS_OFF = %00001000 ; Assigns prescaler to Watchdog (PSA hi) PS_000 = %00000000 ; RTCC = 1:2, WDT = 1:1 PS_001 = %00000001 ; RTCC = 1:4, WDT = 1:2 PS_010 = %00000010 ; RTCC = 1:8, WDT = 1:4 PS_011 = %00000011 ; RTCC = 1:16, WDT = 1:8 PS_100 = %00000100 ; RTCC = 1:32, WDT = 1:16 PS_101 = %00000101 ; RTCC = 1:64, WDT = 1:32 PS_110 = %00000110 ; RTCC = 1:128, WDT = 1:64 PS_111 = %00000111 ; RTCC = 1:256, WDT = 1:128 ; ************** ; *** DEVICE *** ; ************** RESET Main ID 'EIO24_1' ; ***************** ; *** VARIABLES *** ; ***************** ; *** Global *** GLOBAL_ORG = $0A flags EQU GLOBAL_ORG+0 ; various flags used by TCP/IP stack flags2 EQU GLOBAL_ORG+1 ; various flags used by TCP/IP stack fsrTemp EQU GLOBAL_ORG+2 ; various flags used by TCP/IP stack ;use to be flags3 now fsrtemp globTemp1 EQU GLOBAL_ORG+3 ; not preserved across any function globTemp2 EQU GLOBAL_ORG+4 ; not preserved across any function globTemp3 EQU GLOBAL_ORG+5 ; preserved across some functions ; *** Bank 0 *** ; (Don't use this bank - Difficulties with addressing Data) ORG $00 ; *** Bank 1 *** ORG $10 NIC_BANK = $ nicIOAddr DS 1 ; points to currently addressed register on NIC nicNextPktPtr DS 1 ; points to next packet in NIC's rx queue nicCurrPktPtr DS 1 ; points to current packet in NIC's rx queue nicRemoteEth0 DS 1 ; ethernet addr used for outgoing packet, overwritten by incoming packet nicRemoteEth1 DS 1 ; " nicRemoteEth2 DS 1 ; " nicRemoteEth3 DS 1 ; " nicRemoteEth4 DS 1 ; " nicRemoteEth5 DS 1 ; " nicCopySrcMSB DS 1 ; used by NICBufferCopy() nicCopySrcLSB DS 1 ; " nicCopyDestMSB DS 1 ; " nicCopyDestLSB DS 1 ; " nicCopyLenMSB DS 1 ; " nicCopyLenLSB DS 1 ; " nicCopyTemp DS 1 ; " ; *** Bank 2 *** ORG $20 MAC_BANK = $ TIMER_BANK = $ ; make sure TIMER_BANK[7] = NIC_BANK[7] baseTimer DS 1 ; lowest/common cog in timer chain arpTimerMSB DS 1 ; ARP-timer count arpTimerLSB DS 1 ; " LEDTimerLSB DS 1 ; LED-timer count MTwoTimerL DS 1 ; MODE2-timer count LSB MTwoTimerH DS 1 ; MODE2-timer count MSB ;macMyEth0 DS 1 ; My ethernet addr used for outgoing packet macMyEth1 DS 1 ; " macMyEth2 DS 1 ; " macMyEth3 DS 1 ; " macMyEth4 DS 1 ; " macMyEth5 DS 1 ; " ; *** Bank 3 *** ORG $30 IP_BANK = $ ; make sure IP_BANK[7] = NIC_BANK[7] remoteIP3 DS 1 ; IP addr used for outgoing packet, overwritten by incoming packet remoteIP2 DS 1 ; " remoteIP1 DS 1 ; " remoteIP0 DS 1 ; " myIP3 DS 1 ; filter value for incoming IP packets, also used in outgoing packet myIP2 DS 1 ; " myIP1 DS 1 ; " myIP0 DS 1 ; " ipCheckSumMSB DS 1 ; IP ipCheckSumLSB DS 1 ; " ipLengthMSB DS 1 ; IP ipLengthLSB DS 1 ; " ipProtocol DS 1 ; IP ipIdentMSB DS 1 ; IP , incremented each outgoing packet ipIdentLSB DS 1 ; " counter1 DS 1 ; general purpose counter variable ; *** Bank 4 *** ORG $40 ARP_BANK = $ ; make sure ARP_BANK[7] = NIC_BANK[7] host1IP3 DS 1 ; remote host1 IP address host1IP2 DS 1 ; " host1IP1 DS 1 ; " host1IP0 DS 1 ; " host1Eth0 DS 1 ; remote host1 Ethernet address host1Eth1 DS 1 ; " host1Eth2 DS 1 ; " host1Eth3 DS 1 ; " host1Eth4 DS 1 ; " host1Eth5 DS 1 ; " stPktTxBufStart DS 1 ; start address of stalled packet in NIC tx buffer ; *** Bank 5 *** ORG $50 DHCP_BANK = $ dhcpServerId3 DS 1 ; DHCP = IP addr of DHCP server dhcpServerId2 DS 1 ; " dhcpServerId1 DS 1 ; " dhcpServerId0 DS 1 ; " dhcpIPLeaseTm3 DS 1 ; IP lease renewal time set by the DHCP server or 1 minute if no renewal time set dhcpIPLeaseTm2 DS 1 ; " dhcpIPLeaseTm1 DS 1 ; " dhcpIPLeaseTm0 DS 1 ; " dhcpBaseTimer1 DS 1 ; DHCP base timer for renewals dhcpBaseTimer0 DS 1 ; " dhcpTimer3 DS 1 ; DHCP timer for renewals dhcpTimer2 DS 1 ; " dhcpTimer1 DS 1 ; " dhcpTimer0 DS 1 ; " dhcpFlags DS 1 ; flags ; dhcpFlags DHCP_CONFIG = 0 ; *** Bank 6 *** ORG $60 UDP_BANK = $ udpRxSrcPortMSB DS 1 udpRxSrcPortLSB DS 1 udpRxDestPortMSB DS 1 ; filter value for incoming UDP packets udpRxDestPortLSB DS 1 ; " udpRxDataLenMSB DS 1 ; length of field of incoming UDP packet udpRxDataLenLSB DS 1 ; " udpTxSrcPortMSB DS 1 udpTxSrcPortLSB DS 1 udpTxDestPortMSB DS 1 udpTxDestPortLSB DS 1 udpTxDataLenMSB DS 1 ; length of field of outgoing UDP packet udpTxDataLenLSB DS 1 ; " UDPAPPSTATE DS 1 ; Flags Register for UDP recieved Command Packet FIFORP DS 1 ; Read Pointer for Output Data FIFO FIFOWP DS 1 ; Write Pointer for Output Data FIFO FIFOSZ DS 1 ; Current Data Size in Output Data FIFO ; UDPAPPSTATE CLOCKME = UDPAPPSTATE.0 WRITEA = UDPAPPSTATE.1 WRITEB = UDPAPPSTATE.2 WRITEC = UDPAPPSTATE.3 WSPEC = UDPAPPSTATE.4 ECHOB = UDPAPPSTATE.5 DiscoverNow = UDPAPPSTATE.6 RequestNow = UDPAPPSTATE.7 ; *** Bank 7 *** ORG $70 EEPROM_BANK = $ EEAddr DS 1 ; Address 0-63 EEDatH DS 1 ; High Byte Data EEDatL DS 1 ; Low Byte Data TARGET_BANK = $ ;Target for Mode 2 Data TargetEth0 DS 1 ; Target MAC Address for Mode 2 Data TargetEth1 DS 1 ; /\ TargetEth2 DS 1 ; /\ TargetEth3 DS 1 ; /\ TargetEth4 DS 1 ; /\ TargetEth5 DS 1 ; /\ TargetIP0 DS 1 ; Target IP Address for Mode 2 Data TargetIP1 DS 1 ; /\ TargetIP2 DS 1 ; /\ TargetIP3 DS 1 ; /\ TargetPort0 DS 1 ; Target Port Number for Mode 2 Data TargetPort1 DS 1 ; /\ ; *** Bank 8 *** ORG $80 MTWO_BANK = $ MTwoMaskA DS 1 ; Mode2 Mask bits for port A MTwoMaskB DS 1 ; Mode2 Mask bits for port B MTwoMaskC DS 1 ; Mode2 Mask bits for port C MTwoScanL DS 1 ; Mode2 Scan Rate LSB MTwoScanH DS 1 ; Mode2 Scan Rate MSB MTwoFilt DS 1 ; Mode2 Filter MTwoOldA DS 1 ; Mode2 Old Value for port A MTwoOldB DS 1 ; Mode2 Old Value for port B MTwoOldC DS 1 ; Mode2 Old Value for port C MTwoFCntA DS 1 ; Mode2 Filter Counter for port A MTwoFCntB DS 1 ; Mode2 Filter Counter for port B MTwoFCntC DS 1 ; Mode2 Filter Counter for port C MTwoReadA DS 1 ; Mode2 Read Filter Value for port A MTwoReadB DS 1 ; Mode2 Read Filter Value for port B MTwoReadC DS 1 ; Mode2 Read Filter Value for port C MTwoFlags DS 1 ; Flags for Mode 2 ; *** MTwoFlags *** TX_PortA = 0 ; Transmit Port A now TX_PortB = 1 ; Transmit Port B now TX_PortC = 2 ; Transmit Port C now ; *** Bank 9 *** ORG $90 SPI_BANK = $ spim_rate_counter DS 1 spim_bit_count DS 1 spim_in_dat DS 1 spim_out_dat DS 1 GPIOA_State DS 1 ARPE_BANK = $ hostsmIP3 DS 1 ; host subnetmask address hostsmIP2 DS 1 ; " hostsmIP1 DS 1 ; " hostsmIP0 DS 1 ; " hostgwIP3 DS 1 ; host gateway IP address hostgwIP2 DS 1 ; " hostgwIP1 DS 1 ; " hostgwIP0 DS 1 ; " ;GPIO_BANK = $ ; *** Bank A *** ORG $A0 FLAG3_BANK =$ flags3 DS 1 ;used for flags ; *** flags3 *** TURN_LED_ON = flags3.0 ; Tell system to turn LED on TURN_LED_OFF = flags3.1 ; Tell system to turn LED off MODE2_SCAN = flags3.2 ; Flag to tell main loop to check mode 2 signals FIFO_EEPROM = flags3.3 ; Indicates there is data in the FIFO for the EEPROM MODE2_ENABLE = flags3.4 ; Tells System that Mode2 is enabled and to scan when timer expires EEBLANK = flags3.5 ; Tells System that EEPROM is Empty FIXTEN = flags3.6 ; Fix the IP at 10.10.10.10 DHCP OFF FIX192 = flags3.7 ; Fix the IP at 192.168.0.X DHCP OFF ; *** Bank B *** ORG $B0 ; *** Bank C *** ORG $C0 ;FIFO BANK 1 OF 4 used for data ring buffer for transmit data from UDP application ; *** Bank D *** ORG $D0 ;FIFO BANK 2 OF 4 used for data ring buffer for transmit data from UDP application ; *** Bank E *** ORG $E0 ;FIFO BANK 3 OF 4 used for data ring buffer for transmit data from UDP application ; *** Bank F *** ORG $F0 ;FIFO BANK 4 OF 4 used for data ring buffer for transmit data from UDP application ; *************** ; *** EQUATES *** ; *************** ; *** Pin Definitions *** RA_DIR = %00000010;%10000000 RA_OUT = %11111111;%00000000 RA_LVL = %11111111;%11111111 RA_PLP = %00000000;%01111111 RB_DIR = %11111111 RB_OUT = %00000000 RB_LVL = %11111111 RB_PLP = %11111111 RC_DIR = %11111111 RC_OUT = %00000000 RC_LVL = %11111111 RC_PLP = %11111111 RD_DIR = %11111111 RD_OUT = %00000000 RD_LVL = %11111111 RD_PLP = %11111111 RE_DIR = %11111111 RE_OUT = %00000000 RE_LVL = %11111111 RE_PLP = %00000000 NIC_DATA_PORT = re ;NIC_CTRL_PORT = ra ;IOWB_PIN = NIC_CTRL_PORT.5 ;IORB_PIN = NIC_CTRL_PORT.6 ;IOCH_PIN = NIC_CTRL_PORT.7 SPI_CLK = ra.0 ;OUTPUT SPI_SDI = ra.1 ;INPUT SPI_SDO = ra.2 ;OUTPUT SPI_CS = ra.3 ;OUTPUT ; *** flags *** RX_IS_ARP = 0 ; incoming packet is an ARP packet RX_IS_ICMP = 1 ; incoming packet is an ICMP packet RX_IS_UDP = 2 ; incoming packet is a UDP packet RX_IS_TCP = 3 ; incoming packet is a TCP packet RX_IS_IP_BCST = 4 ; incoming packet is an IP Broadcast packet GOT_DHCP_OFFER = 5 ; received DHCP IP address offer GOT_IP_ADDR = 6 ; received an IP address assignment (recv'ed DHCP ACK) IP_CHKSUM_LSB = 7 ; next byte to accumulate IP checksum is LSB ; *** flags2 *** ARP_REQ_SENT = 0 ; indicates that an ARP request has been sent ARP_RSP_RCVD = 1 ; indicates that an ARP response has been received ARP_STL_TX = 2 ; indicates that the stalled packet is to be transmitted GOT_RX_FRAME = 3 ; used by NICWaitRxFrame to indicate we got one. GOT_IP_LEASE = 4 ; indicates that an IP lease was granted by a DHCP server RENEW_IP_LEASE = 5 ; indicates an IP lease renewal is in progress FIFO_DATA = 6 ; Indicates there is data in the FIFO to transmit to the host DHCP_ENABLE = 7 ; If this is set then get IP by DHCP else use fixed IP ; available for future use [/code] Cheers Stolzie ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=211276#m212407 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)