# Regarding 5400W Coding

**URL:** https://forums.digi.com/t/regarding-5400w-coding/9140
**Category:** Rabbit
**Created:** [December 12, 2008, 7:29am UTC](https://forums.digi.com/t/regarding-5400w-coding/9140 "2008-12-12T07:29:20Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![vtherock](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vtherock](https://forums.digi.com/u/vtherock)
#### Post date: [December 12, 2008, 7:29am UTC](https://forums.digi.com/t/regarding-5400w-coding/9140/1 "2008-12-12T07:29:20Z")

</div>

Hello guys, I having a problem regarding the coding for 5400W. With the sample given BROWSELED.C I am able to compile and control the 2 LEDs using web browser.However, my project is to use the S2 and S3 to control the light and to display in the web browser. But seem that if I change the coding of BROWSELED.C it onli keep on causing a loop at costate function.  
So hope someone could give me so advise or suggestion thx…

---

<div class="post-metadata">

### Author: ![dhanraj\_kmr1](https://avatars.discourse-cdn.com/v4/letter/d/fbc32d/32.png) [@dhanraj\_kmr1](https://forums.digi.com/u/dhanraj_kmr1)
#### Post date: [December 20, 2008, 11:02am UTC](https://forums.digi.com/t/regarding-5400w-coding/9140/2 "2008-12-20T11:02:34Z")

</div>

Hi friend,  
I have a RCM5400W wifi module which i bought recently. Just i need to toggle my onboard LEDs using browseled.c program. For that do i need Wifi receiver on my PC to which i want to communicate with? then is there any name fixed name or no for it? pls reply.

If i do this succesfully then there is a mile to go on this. I will be posting on my next visit.

---

<div class="post-metadata">

### Author: ![komoeyay](https://avatars.discourse-cdn.com/v4/letter/k/ecb155/32.png) [@komoeyay](https://forums.digi.com/u/komoeyay)
#### Post date: [March 20, 2009, 2:07am UTC](https://forums.digi.com/t/regarding-5400w-coding/9140/3 "2009-03-20T02:07:21Z")

</div>

I would like to know that, I’ve “RCM5600W” module. I want to set IP address in one LAN, that network has a WAP key. The problem is that, I don’t know how to set IP for that network. Without WAP key is ok (Static, DHCP). FTP also ok. Only thing is how to resolve WAP key.

---

<div class="post-metadata">

### Author: ![vtherock](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vtherock](https://forums.digi.com/u/vtherock)
#### Post date: [December 22, 2008, 9:59am UTC](https://forums.digi.com/t/regarding-5400w-coding/9140/4 "2008-12-22T09:59:29Z")

</div>

Hi dhanraj\_kmr,

U need a wifi pc or a laptop to recieve the connection for 5400w. By default the name is already given which is rabbittest. U can press ctrl+H to see the guide for Tconfig. It will help u when u go along.

---

<div class="post-metadata">

### Author: ![dhanraj\_kmr1](https://avatars.discourse-cdn.com/v4/letter/d/fbc32d/32.png) [@dhanraj\_kmr1](https://forums.digi.com/u/dhanraj_kmr1)
#### Post date: [December 26, 2008, 6:40am UTC](https://forums.digi.com/t/regarding-5400w-coding/9140/5 "2008-12-26T06:40:52Z")

</div>

Hi friend,  
Really thanks for your reply. I dont have much knowledge abt wifi. but I had to realised that. so i bought a wireless-G USB 2.0 Adapter from NETGEAR 2.4Ghz, 802.11g(WG111).  
So i ran the software which came along with it. Then i found a window NETGEAR WG111V3 smartwizard. then i added SSID as ‘rabbitwifi’, and network type as computer to computer(AdHoc) then thats it. Then i had to run a sample pro Wifiscan.c. As a result i was geeting like this

## "Starting scan… WiFi Scan Results: 1 entries Channel Signal MAC Access Point SSID

```
  6 32 02:e0:60:52:28:84 [rabbitwifi]                              

```

Scan done, exiting… ".  
Here i have some doubts 1st on my USB MAC address is :001E2AAf609C  
But here on my result its printing something else. And whats that term singal 32?😕  
When i run the same pro next time i was getting like this

## "Starting scan… WiFi Scan Results: 3 entries Channel Signal MAC Access Point SSID

```
  6 38 02:e0:6d:71:2c:e1 [rabbitwifi]                              
  6 14 00:1b:11:a2:2d:06 [Indus1]                                  
  6 14 00:13:46:70:4d:46 [Indus2]                                  

```

Scan done, exiting… "

what are those Indus1 and Indus2. Now see my signal is 38???

And even my USB and rabbit wifi getting some heat morethan what i expected while its communicating eachother. I’ve connected my rabbit USB program cable and USB adapter’s cable on my PC’s near by slot. Can i do like this? or should i connect my USB adapter on another system? even i haven’t changed my PC’s IP add. here’s the code which i am using…

#define TCPCONFIG 5  
#define \_PRIMARY\_STATIC\_IP “10.10.6.100”  
#define \_PRIMARY\_NETMASK “255.255.255.0”  
#define MY\_GATEWAY “10.10.6.1”  
#define MY\_NAMESERVER “10.10.6.1”  
#define IFC\_WIFI\_SSID “rabbitTest”  
#define IFC\_WIFI\_ROAM\_ENABLE 1  
#define IFC\_WIFI\_ROAM\_BEACON\_MISS 20  
#define IFC\_WIFI\_CHANNEL 1  
#define IFC\_WIFI\_MODE IFPARAM\_WIFI\_ADHOC  
#define IFC\_WIFI\_REGION IFPARAM\_WIFI\_REGION\_AMERICAS  
#define IFC\_WIFI\_ENCRYPTION IFPARAM\_WIFI\_ENCR\_NONE

#define DISABLE\_TCP  
#define DISABLE\_DNS

#use “dcrtcp.lib”

#memmap xmem

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
print\_macaddress

```
Routine to print out mac_addr types.

```

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/  
void print\_macaddress(far unsigned char \*addr)  
{  
printf(“%02x:%02x:%02x:%02x:%02x:%02x”, addr[0], addr[1], addr[2],  
addr[3], addr[4], addr[5]);  
}

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
rxsignal\_cmp

```
qsort comparison, based on rx signal strength.

```

Inputs:  
a, b – far pointers to \_wifi\_wln\_scan\_bss, a struct populated by  
the WIFI SCAN, including rx\_signal (relative receive signal  
strength).

```
Return value: &gt; 0 if a &gt; b
				  &lt; 0 if a &lt; b
				  0 if a == b

```

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/  
int rxsignal\_cmp(far \_wifi\_wln\_scan\_bss \*a, far \_wifi\_wln\_scan\_bss \*b) {  
return b-\>rx\_signal - a-\>rx\_signal;  
}

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
scan\_callback

Prints out the sorted results of a BSS scan.  
Called when WIFI SCAN is complete.

The argument is a pointer to the wifi\_scan\_data structure generated by  
the scan.

We use \_f\_qsort to sort the data since the data is `far.’ \_f\_qsort  
requires a comparison function, and we use the rxsignal\_cmp() function  
above.

Inputs:  
data – far pointer to wifi\_scan\_data structure, which contains a  
count of the number of responses, and an array of  
\_wifi\_wln\_scan\_bss structures, with the first `count’  
containing valid data for the responses.

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*_/  
char scandone;  
root void scan\_callback(far wifi\_scan\_data_ data)  
{  
uint8 i, j;  
far \_wifi\_wln\_scan\_bss \*bss;  
char ssid\_str[33];

```
bss = data-&gt;bss;
// Sort results by signal strength. Need to use _f_qsort, since bss is
// far data.
_f_qsort(bss, data-&gt;count, sizeof(bss[0]), rxsignal_cmp);
// Print out results

```

printf("WiFi Scan Results: %d entries  
", data-\>count);  
printf("Channel Signal MAC Access Point SSID  
“);  
printf(”-------------------------------------------------------  
“);  
for (i = 0; i \< data-\>count; i++) {  
printf(” %2d %2d “,  
bss[i].channel, bss[i].rx\_signal);  
print\_macaddress(bss[i].bss\_addr);  
wifi\_ssid\_to\_str (ssid\_str, bss[i].ssid, bss[i].ssid\_len);  
printf(” [%s]  
", ssid\_str);  
}  
scandone = 1;  
}

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
main

```
Scan for BSS's. Must call tcp_tick(NULL) to drive scanning process.

```

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/  
void main(void)  
{  
int val0, val1, i, level;  
unsigned long int end;

```
sock_init();

```

scandone = 0;

```
// Enable Roaming
ifconfig (IF_WIFI0, IFS_WIFI_ROAM_ENABLE, 1, IFS_END);

// Set roam event to loss of 20 beacons
ifconfig (IF_WIFI0, IFS_WIFI_ROAM_BEACON_MISS, 20, IFS_END);

```

// Bring the interface down before starting a scan  
ifdown(IF\_WIFI0);  
while (ifpending(IF\_WIFI0) != IF\_DOWN)  
tcp\_tick(NULL);

// Set the callback before requesting scan  
printf("Starting scan…  
“);  
ifconfig(IF\_WIFI0, IFS\_WIFI\_SCAN, scan\_callback, IFS\_END);  
while ( ! scandone) {  
tcp\_tick(NULL);  
}  
printf(”

Scan done, exiting…");  
exit(0);  
}

Am i doing correctly?  
pls correct me if i am wrong…

---

<div class="post-metadata">

### Author: ![vtherock](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vtherock](https://forums.digi.com/u/vtherock)
#### Post date: [December 26, 2008, 7:11am UTC](https://forums.digi.com/t/regarding-5400w-coding/9140/6 "2008-12-26T07:11:55Z")

</div>

Hi fren,

Sorry to tell u that I not a pro for this kit yet. But regarding Wifiscan.c. I did try this sample in school before. If I not wrong it is scanning the surrounding for the available wifi Mac Access point. But for the digit change from 32 to 38 I do not know wat does it stands. Maybe need to look up old book -.-. For the heat problem, I also do encounter it after I compiled my code to run wifi. It will heat up after so time. Dun worri will not have any problem. I on it more than 9hrs or so. hmm… if ur coding is gotten from the sample.c think it will be much a problem…

---

<div class="post-metadata">

### Author: ![dhanraj\_kmr1](https://avatars.discourse-cdn.com/v4/letter/d/fbc32d/32.png) [@dhanraj\_kmr1](https://forums.digi.com/u/dhanraj_kmr1)
#### Post date: [December 26, 2008, 10:25am UTC](https://forums.digi.com/t/regarding-5400w-coding/9140/7 "2008-12-26T10:25:44Z")

</div>

Anyway frnd thans for the reply. I didnt learn much networking concepts in college days. Thats the problem. K leave that code its exactly a sample code only;). but we should use the IP confic for both trsnsmitting as well as receiving on ethernet communication right ? But in wifi where we do this at wifi pc side. and in system tray it says “wireless connection is not connected”. is it affecting my infrastructure mode?

Now i stepped up the BROWSELED.c pro. While i compilin he i am getting  
1 error and 4 warrnings. they are

line 142 : ERROR WIFI\_MAC\_MGMT.LIB : ) is missing/expected.  
line 142 : WARNING WIFI\_MAC\_MGMT.LIB : Conversion to incompatible pointer type  
line 142 : WARNING WIFI\_MAC\_MGMT.LIB : Conversion to incompatible pointer type  
line 142 : WARNING WIFI\_MAC\_MGMT.LIB : Conversion to incompatible pointer type  
line 154 : WARNING WIFI\_MAC\_MGMT.LIB : Conversion to incompatible pointer type  
if i clik on them they just go to WIFI\_MAC\_MGMT.LIB. but there is nothing.  
whats goin on? can you fix it even if u r not a pro…
