Net_Ethernet_Intern_Init - "Incompatible types" ?

Please check the frequently asked questions before posting to the forum.
Post Reply
Author
Message
avs
Posts: 9
Joined: 25 Apr 2013 08:31

Net_Ethernet_Intern_Init - "Incompatible types" ?

#1 Post by avs » 25 Apr 2013 09:45

Compiler halts at "myMacAddr" (in code: Net_Ethernet_Intern_Init(myMacAddr, myIpAddr, Net_Ethernet_Intern_FULLDUPLEX);)
and reports error message:" Incompatible types("complex type" to "simple type") "
----------------------------------------------------------------
- Network Ethernet LIB Version: 1.0.5.0 Last Updated: 2013-01-09
- Lv18Fj with pic 18f87j60
- mP Pro ver 6.0.0
----------------------------------------------------------------

Sample of my code...

const Net_Ethernet_HALFDUPLEX = 0;
const Net_Ethernet_FULLDUPLEX = 1;

myMacAddr : array[6] of byte; // my MAC address
myIpAddr : array[4] of byte; // my IP address


...
// set mac address
myMacAddr[0] := 0x00;
myMacAddr[1] := 0x14;
myMacAddr[2] := 0xA5;
myMacAddr[3] := 0x76;
myMacAddr[4] := 0x19;
myMacAddr[5] := 0x3F;

// set IP address
myIpAddr[0] := 192;
myIpAddr[1] := 168;
myIpAddr[2] := 1;
myIpAddr[3] := 7;

Net_Ethernet_Intern_Init(myMacAddr, myIpAddr, Net_Ethernet_Intern_FULLDUPLEX);



Thanks.

Regards
Andre

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Net_Ethernet_Intern_Init - "Incompatible types" ?

#2 Post by filip » 26 Apr 2013 09:11

Hi,

Did you try the original example located here :
..\mikroPascal PRO for PIC\Packages\Network_Ethernet_PIC\examples\HTTP_Demo_Internal\
I have recompiled it without any problems in the 6.00 version.

Regards,
Filip.

avs
Posts: 9
Joined: 25 Apr 2013 08:31

Re: Net_Ethernet_Intern_Init - "Incompatible types" ?

#3 Post by avs » 27 Apr 2013 23:57

Hi Filip

Yes, the example compile as advertise (and thanks for checking on your side) but I noticed you have to construct a pointer with the @ operator
e.g. >> Net_Ethernet_Intern_Init(@myMacAddr, @myIpAddr, Net_Ethernet_Intern_FULLDUPLEX);
( which is btw not the same as the help example)

Actually I want to assemble a very simple routine to broadcast a few bytes with UDP but run
into the next problem with the same library and instruction:

Net_Ethernet_Intern_sendUDP(@IpAddr, 10001, 10002, @TXData, 1);

with the compiler reporting: "Unresolved extern 'Net_Ethernet_Intern_UserTCP' __Lib_NetEthInternal.c"


So I divert back to the "standard" ethernet pascal library and managed to get my code running.

Here's a very simple piece of code that broadcast "0.123" every second if there more people
(like me) who struggle to get started...


program UDP_broadcast;
const Net_Ethernet_HALFDUPLEX = 0;
Net_Ethernet_FULLDUPLEX = 1;

var str5 : array[5] of char; // TX Data
IpAddr : array[4] of byte; // remote IP address
myMacAddr : array[6] of byte; // my MAC address
myIpAddr : array[4] of char; // my IP address
gwIpAddr : array[4] of byte; // gateway (router) IP address
ipMask : array[4] of byte; // network mask (for example : 255.255.255.0)
dnsIpAddr : array[4] of byte; // DNS server IP address

begin
{ CONFIGURATION }
ECON2.5:=1; // =ETHEN - turn ethernet module on
PORTA := %00000000;
TRISA := %11111100; // RA0..ethernet LEDA (out)
// RA1..ethernet LEDB (out)
// RA2:RA5.. (IN)

!!! setup MAC-,IP-, GATEWAY-, DNS-adresses and SUBNET MASK as in examples !!!!!

Ethernet_Init(myMacAddr, myIpAddr, Net_Ethernet_FULLDUPLEX);
Ethernet_confNetwork(ipMask, gwIpAddr, dnsIpAddr) ;

// set REMOTE IP address
IpAddr[0] := 192;
IpAddr[1] := 168;
IpAddr[2] := 1;
IpAddr[3] := 10;
delay_ms(500);
{ P R O G R A M L O O P }
while true do
begin
str5:='0.123';
Ethernet_sendUDP(IpAddr, 10001, 10002,@str5, 5); // Broadcast txt characters. '0.123'
delay_ms(1000);
end;
end.



Best Regards
Andre

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Net_Ethernet_Intern_Init - "Incompatible types" ?

#4 Post by filip » 29 Apr 2013 09:12

Hi,

I'm glad that you have been able to sort out this issue.

Regards,
Filip.

Post Reply

Return to “mikroPascal FAQ”