Skip to content

SIO Command $FD Scan Networks

Oscar Fowler edited this page Jul 25, 2020 · 3 revisions

Scan Networks ($FD)

Description

Causes the ESP to scan for Wi-Fi Networks. There is always a pause, while this command executes.

Note that the ESP will temporarily disconnect from any currently connected network in order to perform the scan, so any open sessions may be lost.

This command returns four bytes, with the first byte being the number of networks detected, and the other three bytes reserved for future use.

Parameters

DCB Value
DDEVIC $70
DUNIT $01
DCOMND $FD
DSTATS 0x40
DBUF Point to a 4 character buffer
DTIMLO $0F
DBYT 4
DAUX1 0
DAUX2 0

Examples

CC65

/**
 * Return number of networks
 */
unsigned char config_do_scan(unsigned char* num_networks)
{
  OS.dcb.ddevic=0x70;
  OS.dcb.dunit=1;
  OS.dcb.dcomnd=0xFD; // do scan
  OS.dcb.dstats=0x40; // Peripheral->Computer
  OS.dcb.dbuf=num_networks;
  OS.dcb.dtimlo=0x0F; // 15 second timeout
  OS.dcb.dbyt=4;      // 4 byte response
  OS.dcb.daux=0;
  siov();

  return OS.dcb.dstats;
}

See Also

  • Scan Result

Put other related command links here.

Clone this wiki locally