AliAnkara
Joined: 03 Apr 2006 Posts: 14 Location: TURKEY
|
Posted: Fri Jul 13, 2007 5:55 pm Post subject: RTL8019AS (ne2000.lbx) Problem |
|
|
Hi all
My Problem;
Error:221 Line: 216 Backward jump out of range [NE2000_POLL1 [65]]
-------------------------------------------------------------------------------------
My Code:
$regfile = "M128def.dat"
$crystal = 16000000
$hwstack = 64
$swstack = 64
$framesize = 64
'-CONFIG------------------------------------------------------------------------
Config Lcdpin = Pin , Db7 = Porte.0 , Db6 = Porte.1 , Db5 = Porte.5 , Db4 = Porte.4 , E = Porte.3 , Rs = Porte.2
Config Lcd = 16 * 2
Config Int3 = Rising
'-PIN CONFIG--------------------------------------------------------------------
Ne2000_reset_pin Alias Pind.7
Ne2000_iow_pin Alias Pind.5
Ne2000_ior_pin Alias Pind.6
Ne2000_a0_pin Alias Pinc.0
Ne2000_a1_pin Alias Pinc.1
Ne2000_a2_pin Alias Pinc.2
Ne2000_a3_pin Alias Pinc.3
Ne2000_a4_pin Alias Pinc.4
Ne2000_reset Alias Portd.7
Ne2000_iow Alias Portd.5
Ne2000_ior Alias Portd.6
Ne2000_a0 Alias Portc.0
Ne2000_a1 Alias Portc.1
Ne2000_a2 Alias Portc.2
Ne2000_a3 Alias Portc.3
Ne2000_a4 Alias Portc.4
Ne2000_d0_pin Alias Pina.0
Ne2000_d1_pin Alias Pina.1
Ne2000_d2_pin Alias Pina.2
Ne2000_d3_pin Alias Pina.3
Ne2000_d4_pin Alias Pina.4
Ne2000_d5_pin Alias Pina.5
Ne2000_d6_pin Alias Pina.6
Ne2000_d7_pin Alias Pina.7
Ne2000_d0 Alias Porta.0
Ne2000_d1 Alias Porta.1
Ne2000_d2 Alias Porta.2
Ne2000_d3 Alias Porta.3
Ne2000_d4 Alias Porta.4
Ne2000_d5 Alias Porta.5
Ne2000_d6 Alias Porta.6
Ne2000_d7 Alias Porta.7
'CONST--------------------------------------------------------------------------
'-Variables---------------------------------------------------------------------
'Dimention some variables for the libary.
Dim Host_mac(6) As Byte
Dim Host_ip(4) As Byte
Dim Host_port As Word
Dim My_mac(6) As Byte
Dim My_port As Word
Dim My_ip(4) As Byte
Dim Udp_data(128) As Byte At &H119 ' At &H79
'overlay the string s over the array Udp_data() just to make things easy later.
Dim S As String * 128 At &H119 Overlay 'At &H79 Overlay
'helper varible
Dim X As Byte
Dim Xx As Integer
'-------------------------------------------------------------------------------
'MainStart
'-------------------------------------------------------------------------------
Cls
Cursor Off
Xx = 0
S = "Hello World"
$lib "ne2000.lbx"
$external Ne2000_init , Ne2000_poll , Ne2000_udp_tx
Gosub Init
Enable Interrupts
Enable Int3
On Int3 Rtl8019as_interrupt
'-------------------------------------------------------------------------------
'Main
'-------------------------------------------------------------------------------
Main:
'Cls
'Wait 1
'Lcd "Do Loop"
'Wait 1
Gosub Ne2000_poll
Goto Main
Init:
Waitms 10
'Host_ip(1) = 192 ' 192.168.1.4:1234
'Host_ip(2) = 168
'Host_ip(3) = 1
'Host_ip(4) = 6
'Host_port = 1234
My_ip(1) = 192 ' 192.168.1.102:1234
My_ip(2) = 168
My_ip(3) = 1
My_ip(4) = 102
'My_port = 1234
Gosub Ne2000_init
Return
Rtl8019as_interrupt:
Disable Int3
Gosub Ne2000_udp_rx
' Xx = Xx + 1
' Gosub Ne2000_udp_tx
'Gosub Ne2000_udp_rx
' Locate 1 , 1
' Lcd Xx
' Locate 2 , 1
' Lcd S
Enable Int3
Return
Ne2000_udp_rx:
' the array Host_mac() contains the PC's mac address this is needed if we
' want to send some data back.
'Print "Host ethernet address:";
'For X = 1 To 6
'Print Host_mac(x);
'Print " ";
'Next X
Cls
Locate 1 , 1
Lcd "Host_mac"
Locate 2 , 1
Lcd Host_mac(1) ; "." ; Host_mac(2) ; "." ; Host_mac(3) ; "." ; Host_mac(4) ; "." ; Host_mac(5) ; "." ; Host_mac(6)
Wait 1
'Print
' the array Host_ip() contains the PC's IP address also needed if we
' want to send some data back.
'Print "Host IP address:";
'For X = 1 To 4
'Print Host_ip(x);
'Print " ";
'Next X
Cls
Locate 1 , 1
Lcd "Host_ip"
Locate 2 , 1
Lcd Host_ip(1) ; "." ; Host_ip(2) ; "." ; Host_ip(3) ; "." ; Host_ip(4)
Wait 1
'Print
' the word Host_port is the IP port of the PC. Needed as well if we
' want to send some data back.
'Print "Host Port:";
'Print Host_port
' the array My_ip() contains the AVR's IP address also needed if we
' want to send some data back.
'Print "AVR's IP address:";
'For X = 1 To 4
'Print My_ip(x);
'Print " ";
'Next X
Cls
Locate 1 , 1
Lcd "My_ip"
Locate 2 , 1
Lcd My_ip(1) ; "." ; My_ip(2) ; "." ; My_ip(3) ; "." ; My_ip(4)
Wait 1
'Print
' the word My_port is the IP port of our AVR. Needed as well if we
' want to send some data back.
'Print "AVR Port:";
'Print My_port
' you can check My_port to see if it agrees with a predefined port if you like
If My_port = 1234 Then
' so to get here the PC had to have the right IP address of our AVR and
' the right Port address too.
' the udp data is placed in the array Udp_data()
' we have overlayed the string s over the Udp_data() so that s will also contain
' the udp data but in a string format.
'Print S
Cls
Locate 1 , 1
Lcd "Port:1234"
Wait 1
End If
' now lets send something back to the PC.
' fill the string s with some text.
Cls
Locate 2 , 1
Lcd "Port:" ; Host_port
Wait 1
' and make the Network card send it.
S = "Test"
Gosub Ne2000_udp_tx
' the subroutine Ne2000_udp_rx must be ended with a return.
Return |
|