How to start a dial-up network connection using command line

RAS & DUN

There are several ways to start a dialup connection from the command line in Windows:

All Windows versions:

Create a shortcut of the Dial-Up connection on your desktop, say, C:\WINDOWS\Desktop\MyISP.lnk
Use the following command to start it:
START C:\WINDOWS\Desktop\MyISP.lnk

The effect is exactly the same as doubleclicking the shortcut.
Check the START command’s syntax when using long file names in NT.

Windows 9x:

The following commands can be used to start and open a connection:

START RUNDLL32 RNAUI.DLL,RnaDial exact name of dialer entry
TRACERT -h 1 -w 1
(Credits for these commands: Michael J. Gregg and Tom Lavedas)
The RUNDLL command starts DUN, the TRACERT command will actually start the dialing process, if and only if automatic dialing is enabled.

Windows NT:

Windows NT has some additional, dedicated commands for Dial-Up networking (credits: Simon Sheppard):

RASDIAL

Usage:

RASDIAL.EXE entryname [ username [ password | * ]] [ /DOMAIN:domain ] [ /PHONE:phonenumber ] [ /CALLBACK:callbacknumber ] [ /PHONEBOOK:phonebookfile ] [ /PREFIXSUFFIX ]
RASDIAL.EXE [ entryname ] /DISCONNECT
RASDIAL.EXE
RASPHONE

Usage:

RASPHONE.EXE [ -v ] [ -f file ] [[ -e | -c | -d | -h | -r ] entry ]
RASPHONE.EXE [ -v ] [ -f file ] -a [ entry ]
RASPHONE.EXE [ -v ] [ -f file ] -lx link
RASPHONE.EXE -s
-a Popup new entry dialogs
-e Popup edit entry dialogs
-c Popup clone entry dialogs
-v Prevent entry rename with a or e
-d Popup dial entry dialogs
-h Quietly hang up the entry
-r Quietly delete the entry
-s Popup status dialogs
-lx Execute command ‘x‘ on dial-up shortcut file
x Any of the commands a, e, v, c, d, h, or r
entry The entry name to which the operation applies
file The full path to the phonebook file
link The full path to the dial-up shortcut file

‘entry‘ alone selects the entry in the phonebook dialog

How to change setting of Bluetooth module?

How to change setting of Bluetooth module?

1. To get the info of bluetoth:
“AT+VERSION”
2. Change PIN code
“AT+PIN1234”
*pincode is 1234
3. Change Name of BT:
“AT+NAMEAPPLE”
*Name as APPLE
4. Change Baudrate:
“AT+BAUD1”
*as Baudrate 1200bps

Bluetooth baudrate class:

1——-1200
2——-2400
3——4800
4——9600
5——19200
6——-38400
7——57600
8—–115200
9——230400
A—–460800
B—–921600
C—–1382400

GCC itoa()

How do I use itoa() with GCC?

Arrgghh C/C++! It would appear that itoa() isn’t ANSI C standard and doesn’t work with GCC on Linux (at least the version I’m using). Things like this are frustrating especially if you want your code to work on different platforms (Windows/Linux/Solaris/whatever).

Many people say that you should just use sprintf to write to a character string but that doesn’t allow for one of the features of itoa(); the ability to write in a base other than 10. This page contains a series of evolving versions of an itoa implementation. The oldest are near the top and the latest at the bottom. Please make sure that you use the latest version.

Credits

Before we go any further, I would like to say thanks to the people that contributed to the solutions below. This function has been put together by contributions from Stuart Lowe (that’s me), Robert Jan Schaper, Ray-Yuan Sheu, Rodrigo de Salvo Braz, Wes Garland, John Maloney, Brian Hunt, Fernando Corradi and Lukás Chmela.

Development

Below is an early version described by Robert Jan Schaper on Google groups:

char* version 0.1

	

char* itoa(int val, int base){

	static char buf[32] = {0};

	int i = 30;

	for(; val && i ; --i, val /= base)

		buf[i] = "0123456789abcdef"[val % base];

	return &buf[i+1];

}
	

This doesn’t quite look like the implementation I am used to which is more likeitoa(int value, char* buffer, int radix). In the end I have made my own version which uses a std::string instead of a character string.

std::string version 0.1

	

void my_itoa(int value, std::string& buf, int base){

	int i = 30;

	buf = "";

	for(; value && i ; --i, value /= base) buf = "0123456789abcdef"[value % base] + buf;

}
	

Update: (2005/02/11)
Ray-Yuan Sheu sent me an email with an improved version which does a bit more error checking for things like a base that is out of range and for negative integers.

Update: (2005/04/08)
Rodrigo de Salvo Braz spotted a bug that meant nothing was returned when the input was zero. It now returns “0”. This bug has also been spotted by Luc Gallant.

std::string version 0.2

	

/**

 * C++ version std::string style "itoa":

 */

std::string itoa(int value, unsigned int base) {

	const char digitMap[] = "0123456789abcdef";

	std::string buf;

	// Guard:

	if (base == 0 || base > 16) {

		// Error: may add more trace/log output here

		return buf;

	}

	// Take care of negative int:

	std::string sign;

	int _value = value;

	// Check for case when input is zero:

	if (_value == 0) return "0";

	if (value < 0) {

		_value = -value;

		sign = "-";

	}

	// Translating number to string with base:

	for (int i = 30; _value && i ; --i) {

		buf = digitMap[ _value % base ] + buf;

		_value /= base;

	}

	return sign.append(buf);

}
	

Update: (2005/05/07)
Wes Garland says that lltostr exists under Solaris and several other unices. It should return a char * of a long long in multiple number bases. There is alsoulltostr for unsigned values.

Update: (2005/05/30)
John Maloney has pointed out various problems with the previous implementation. One of the major issues was the amount of heap allocation going on. He suggested that a lot of this be removed to speed up the algorithm. Below are two versions based on his excellent suggestions. The char* version is at least 10 times faster than the code above. The new std::string version is 3 times faster than before. Although the char* version is faster, you should check that you have allocated enough space to hold the output.

std::string version 0.3

	

/**

 * C++ version std::string style "itoa":

 */

std::string itoa(int value, int base) {

	enum { kMaxDigits = 35 };

	std::string buf;

	buf.reserve( kMaxDigits ); // Pre-allocate enough space.

	// check that the base if valid

	if (base < 2 || base > 16) return buf;

	int quotient = value;

	// Translating number to string with base:

	do {

		buf += "0123456789abcdef"[ std::abs( quotient % base ) ];

		quotient /= base;

	} while ( quotient );

	// Append the negative sign for base 10

	if ( value < 0 && base == 10) buf += '-';

	std::reverse( buf.begin(), buf.end() );

	return buf;

}
	

char* version 0.2

	

/**

 * C++ version char* style "itoa":

 */

char* itoa( int value, char* result, int base ) {

	// check that the base if valid

	if (base < 2 || base > 16) { *result = 0; return result; }

	char* out = result;

	int quotient = value;

	do {

		*out = "0123456789abcdef"[ std::abs( quotient % base ) ];

		++out;

		quotient /= base;

	} while ( quotient );

	// Only apply negative sign for base 10

	if ( value < 0 && base == 10) *out++ = '-';

	std::reverse( result, out );

	*out = 0;

	return result;

}
	

Update: (2006/10/15)
Luiz Gon?lves tells me that although not an ANSI standard, itoa comes in many packages and it is written in many textbooks. He suggests a version written in pure ANSI C based on a version from Kernighan & Ritchie’s Ansi C. A base error is reported by the return of an empty string but the function does no checks of sizes and no allocations. This version is provided below along with a slightly modified version (architecture specific tweaks), the std::string version and the C++char* itoa() version.

	

/**

 * Ansi C "itoa" based on Kernighan & Ritchie's "Ansi C":

 */

void strreverse(char* begin, char* end) {

	char aux;

	while(end>begin)

		aux=*end, *end--=*begin, *begin++=aux;

}

void itoa(int value, char* str, int base) {

	static char num[] = "0123456789abcdefghijklmnopqrstuvwxyz";

	char* wstr=str;

	int sign;

	// Validate base

	if (base<2 || base>35){ *wstr='\0'; return; }

	// Take care of sign

	if ((sign=value) < 0) value = -value;

	// Conversion. Number is reversed.

	do *wstr++ = num[value%base]; while(value/=base);

	if(sign<0) *wstr++='-';

	*wstr='\0';

	// Reverse string

	strreverse(str,wstr-1);

}
	
	

/**

 * Ansi C "itoa" based on Kernighan & Ritchie's "Ansi C"

 * with slight modification to optimize for specific architecture:

 */

void strreverse(char* begin, char* end) {

	char aux;

	while(end>begin)

		aux=*end, *end--=*begin, *begin++=aux;

}

void itoa(int value, char* str, int base) {

	static char num[] = "0123456789abcdefghijklmnopqrstuvwxyz";

	char* wstr=str;

	int sign;

	div_t res;

	// Validate base

	if (base<2 || base>35){ *wstr='\0'; return; }

	// Take care of sign

	if ((sign=value) < 0) value = -value;

	// Conversion. Number is reversed.

	do {

		res = div(value,base);

		*wstr++ = num[res.rem];

	}while(value=res.quot);

	if(sign<0) *wstr++='-';

	*wstr='\0';

	// Reverse string

	strreverse(str,wstr-1);

}
	

Update: (2009/07/08)
Over the past year I’ve had a few suggestions for improvements to both the std::string and char* versions of the code. I’ve finally had time to test them.

In the std::string version, Brian Hunt suggested to move the reserve after the base check to save memory allocations. This does speed things up a little.

std::string version 0.4

	
	/**
	 * C++ version 0.4 std::string style "itoa":
	 */
	std::string itoa(int value, int base) {

		std::string buf;

		// check that the base if valid
		if (base < 2 || base > 16) return buf;

		enum { kMaxDigits = 35 };
		buf.reserve( kMaxDigits ); // Pre-allocate enough space.

		int quotient = value;

		// Translating number to string with base:
		do {
			buf += "0123456789abcdef"[ std::abs( quotient % base ) ];
			quotient /= base;
		} while ( quotient );

		// Append the negative sign
		if ( value < 0) buf += '-';

		std::reverse( buf.begin(), buf.end() );
		return buf;
	}
	

There have also been several suggestions for improvements to the char* version of the code. Fernando Corradi suggested moving the abs() so that it is used only once and not using the modulus operator (%) but rather calculating it by hand saving a division. This does speed things up a little:

char* version 0.3

	
	/**
	 * C++ version 0.3 char* style "itoa":
	 */
	char* itoa( int value, char* result, int base ) {
		// check that the base if valid
		if (base < 2 || base > 16) { *result = 0; return result; }

		char* out = result;
		int quotient = abs(value);

		do {
			const int tmp = quotient / base;
			*out = "0123456789abcdef"[ quotient - (tmp*base) ];
			++out;
			quotient = tmp;
		} while ( quotient );

		// Apply negative sign
		if ( value < 0) *out++ = '-';

		std::reverse( result, out );
		*out = 0;
		return result;
	}
	

However, Lukás Chmela has re-written the code so that it doesn’t have a “most negative number” bug:

char* version 0.4

	
	/**
	 * C++ version 0.4 char* style "itoa":
	 * Written by Lukás Chmela
	 * Released under GPLv3.
	 */
	char* itoa(int value, char* result, int base) {
		// check that the base if valid
		if (base < 2 || base > 36) { *result = '\0'; return result; }

		char* ptr = result, *ptr1 = result, tmp_char;
		int tmp_value;

		do {
			tmp_value = value;
			value /= base;
			*ptr++ = "zyxwvutsrqponmlkjihgfedcba9876543210123456789abcdefghijklmnopqrstuvwxyz" [35 + (tmp_value - value * base)];
		} while ( value );

		// Apply negative sign
		if (tmp_value < 0) *ptr++ = '-';
		*ptr-- = '\0';
		while(ptr1 < ptr) {
			tmp_char = *ptr;
			*ptr--= *ptr1;
			*ptr1++ = tmp_char;
		}
		return result;
	}
	

Latest Versions

Below are the latest versions of the itoa function using either char* orstd::string as you prefer. I haven’t included the Kernighan & Ritchie based versions in this section because I’m not sure what the copyright status is for those. However, the functions below have been developed by the people mentioned on this page and are available for use.

std::string version 0.4

	
	/**
	 * C++ version 0.4 std::string style "itoa":
	 * Contributions from Stuart Lowe, Ray-Yuan Sheu,
	 * Rodrigo de Salvo Braz, Luc Gallant, John Maloney
	 * and Brian Hunt
	 */
	std::string itoa(int value, int base) {

		std::string buf;

		// check that the base if valid
		if (base < 2 || base > 16) return buf;

		enum { kMaxDigits = 35 };
		buf.reserve( kMaxDigits ); // Pre-allocate enough space.

		int quotient = value;

		// Translating number to string with base:
		do {
			buf += "0123456789abcdef"[ std::abs( quotient % base ) ];
			quotient /= base;
		} while ( quotient );

		// Append the negative sign
		if ( value < 0) buf += '-';

		std::reverse( buf.begin(), buf.end() );
		return buf;
	}
	

char* version 0.4

	
	/**
	 * C++ version 0.4 char* style "itoa":
	 * Written by Lukás Chmela
	 * Released under GPLv3.
	 */
	char* itoa(int value, char* result, int base) {
		// check that the base if valid
		if (base < 2 || base > 36) { *result = '\0'; return result; }

		char* ptr = result, *ptr1 = result, tmp_char;
		int tmp_value;

		do {
			tmp_value = value;
			value /= base;
			*ptr++ = "zyxwvutsrqponmlkjihgfedcba9876543210123456789abcdefghijklmnopqrstuvwxyz" [35 + (tmp_value - value * base)];
		} while ( value );

		// Apply negative sign
		if (tmp_value < 0) *ptr++ = '-';
		*ptr-- = '\0';
		while(ptr1 < ptr) {
			tmp_char = *ptr;
			*ptr--= *ptr1;
			*ptr1++ = tmp_char;
		}
		return result;
	}
	

Performance Comparsion

I’ve done some testing of the versions of itoa by finding the average time required to perform conversions, of the integers in the range -32768 to 32767, in every base from base 2 to base 20 (the code only works up to base 16 so the extra bases are just there as tests). The summary is presented in the following table:

function relative time
char* style “itoa” (v 0.2)
char* itoa(int value, char* result, int base)
1.0
(XP, Cygwin, g++)
char* style “itoa” (v 0.3)
char* itoa(int value, char* result, int base)
0.93
char* style “itoa” (v 0.4)
char* itoa(int value, char* result, int base)
0.72
Ansi C “itoa” based on Kernighan & Ritchie’s “Ansi C” with modification to optimize for specific architecture
void itoa(int value, char* str, int base)
0.92
std::string style “itoa” (v 0.3)
std::string itoa(int value, int base)
41.5
std::string style “itoa” (v 0.4)
std::string itoa(int value, int base)
40.8

Programmable Waveform Generator

Consider also the new AD9838 11mW, 2.3-5.5V Complete DDS and the AD98378.5mW, 2.3-5.5V Programmable Waveform Generator.

The AD9833 is a low power, programmable waveform generator capable of producing sine, triangular, and square wave outputs. Waveform generation is required in various types of sensing, actuation, and time domain reflectometry (TDR) applications. The output frequency and phase are software programmable, allowing easy tuning. No external components are needed. The frequency registers are 28 bits; with a 25 MHz clock rate, resolution of 0.1 Hz can be achieved. Similarly, with a 1 MHz clock rate, the AD9833 can be tuned to 0.004 Hz resolution.

The AD9833 is written to via a 3-wire serial interface. This serial interface operates at clock rates up to 40 MHz and is compatible with DSP and microcontroller standards. The device operates with a power supply from 2.3 V to 5.5 V.

The AD9833 has a power-down function (SLEEP). This allows sections of the device that are not being used to be powered down, thus minimizing the current consumption of the part, e.g., the DAC can be powered down when a clock output is being generated.

The AD9833 is available in a 10-lead MSOP package.

Applications

  • Frequency Stimulus/Waveform Generation
  • Liquid and Gas Flow Measurement
  • Sensory Applications–Proximity, Motion, and Defect Detection
  • Line Loss/Attenuation
  • Test and Medical Equipment
  • Sweep/Clock Generators
  • Time domain reflectometry (TDR) applications

 

refer http://www.microsyl.com/index.php/2010/03/24/function-generator/

with atmega16: http://www.codeforge.com/article/41234

Accident Prevention and Security System for Automobiles

In this fast moving world, new technologies have been evolved for every second for our human life style improvement. There have enormous advancement in automobile technologies already and still to come. Because of these technologies, now we are enjoying the necessary comfort and safety.

 

But there are lots of accidents happening now-a-days. It is because of increased vehicle density, violation of rules and carelessness. India ranks fifth in the road accidents over the world.
We have the objective to minimize the road accidents due to above mentioned facts in real time using embedded systems platform in low cost. In our project, we proposed few concepts to minimize the accidents due to violating rules and carelessness.
Our project comprises of five sub-concepts namely,
·         ALCOHOL DETECTOR – if the driver is sensed to be alcohol consumed then the vehicle will not starts.
·         MOBILE SNIFFING SYSTEM – during travelling, if he uses mobile phones then he/she is allowed to use not more than 15 seconds. Then a voice message about stop using mobiles will be given. If still he/she continues, the vehicle will get slow and stops.
·         EMERGENCY SYSTEM – accidents occurs if any, then the accident is recognized using vibrating sensor and using GSM module the area where the accident took place is sent to emergency centers like 108, etc…
·         SECURITY SYSTEM – if the vehicle is found to theft, then the user can identify the location where the vehicle now and stop the fuel flow as well as to activate the center lock of vehicle using GSM module.
By using these concepts, we hope that the road accidents due to violating rules and careless-ness will be minimized and this will be one of the project required for present days and with the significance of low cost.
INTRODUCTION

The population of our country has been increasing rapidly which indirectly increases the vehicle density and leads to many road accidents. The aim of the project in to minimize the road accidents which causes the loss of invaluable human life and other valuable goods. Beside, the provision for the safety of the vehicle is also provided to avoid the theft action. In this fast moving world, new technologies have been evolved for every second for our human life style improvement. There have enormous advancement in automobile technologies already and still to come. Because of these technologies, now we are enjoying the necessary comfort-ness and safety. But there is lot of accidents happening now-a-days. It is because of increased vehicle density, violating rules and carelessness. The embedded technology is used to prevent accidents due to drunk driving, using mobile phones while driving etc,.. If accidents occurs in remote areas, the feature of auto-providing the accident area to the emergency centers for help and support is also provided. On the other hand, the security for the vehicle is also enhanced. This is made possible because the theft vehicle area can be known to the user and the vehicle fuel can be cut off and center lock is enabled. By using these concepts, we hope that the road accidents due to violating rules and careless-ness will be minimized and this will be one of the project required for now-a-days and with the significance of low cost.
1. ALCOHOL DETECTION SYSTEMS IN AUTOMOBILES
At present drunken drivers have increased enormously and so is the deaths due to drunken drivers. The main reason for driving drunk is that the police are not able to check each and every car and even if they catch any one the police can be easily bribed. So there is a need for an effective system to check drunken drivers.
The sensor circuit is used to detect whether alcohol was consumed by the driver recently. Drunken drivers have been let unchecked in the society. Though there are laws to punish drunken drivers they cannot be fully utilized as police cannot stand on every road corner to check each and every car driver whether he has drink or not. This leads to severe accidents as such that happened in Delhi in which a car ran over four road dwellers killing them on the spot. So there is a necessity to develop a efficient alcohol detection system.

 

1.1 WORKING PRINCIPLE OF ALCOHOL DETECTION SYSTEM.
In our alcohol detection system the ignition circuit is controlled by interfacing a set of sensors, logic circuit and a micro processor. We know that the ignition key of a vehicle has to be turned in two steps, one for switching on the electrical circuit and second step for cranking the engine. As per our design exhaled air reaches the sensor unit where its checked for MQ303A and alcohol. The alcohol and MQ303A sensor unit gives output as per the condition of the air through the logic circuit which is sent to the micro processor. Depending upon the output the microprocessor controls the ignition process.

 

1.2 MQ303A Alcohol Sensor

Characteristics
* High sensitivity
* Fast response and resume
* Long life and low cost
* Mini Size
 
Application
*MQ303A is semiconductor sensor is for Alcohol detection,
*It has good sensitivity and fast response to alcohol, suitable for portable alcohol detector.

 

 

Sensitivity of MQ303A, it reflects relations between resistance and gas
concentration, resistance of the sensor reduce when gas concentration increases working after electrified; or you could give 2.2±0.2V high voltage for 5-10secs before test, which make sensor easily stable.
Circuit:

CD4053 CMOS Analog MUX

cd4053-1

The basis for the switch is the CD4053 analog multiplexer IC. This is a CMOS logic chip that contains three SPDT CMOS analog switches and the attending control logic to make them work. People who have tried these before have often complained that they pop or distort, and have then moved on and forgotten them.

There are some tricks to using this chip. First – the analog inputs and outputs need to be held somewhere near the middle of their power supply. The 4053 does have a “Vee” supply pin that lets it control signals near 0V, but that is often a fair amount of trouble to use. the simplest thing to do is to AC couple the in/out pins and bias them to the middle of the 4053’s power supply. In a +9V system, this only needs a two resistor divider and a cap, then a resistor and capacitor per in/out pin.

Yes, this is a pain, eats up board space, and is complicated. It works, though. When biased this way, the CD4053 has little or no distortion and no perceptible switching pops – exactly what we want.

The three SPDT switches are independent. As noted in the illustration, when “A” (pin 11) is low, “X” (pin 14) is connected to “X0” (pin 12). When “A” is high, “X” is connected to “X1” (pin 13).  “B” and “C” do the same switching control for “Y” and “Z”. “Low” means below 1/3 of the Vdd voltage, or 3V in a 9V battery system. “High” is over 6V. Like all CMOS, it’s important to NEVER leave an input pin unterminated, so all control pins that are not being used must be tied to ground or some definite logic level.

When a switch is connected, it looks like a moderately nonlinear resistor between pins. The resistance varies with the signal voltage from pin to pin, which really means that for low distortion, you have to keep the current through the switch low. The switch looks like a 120 to 500 ohm resistor. So if it’s switching things that are themselves 10’s of K ohms or higher, the distortion will be low.

 

refer to link