beautypg.com

Pololu USB AVR User Manual

Page 45

background image

For example, if you wanted to connect your Pololu USB AVR Programmer to an AVR running the Arduino
bootloader, you could configure pin A to be DTR and then connect pin A to the AVR’s reset line. When the Arduino
software sets DTR to 1, the programmer will drive the line A low, which puts the AVR in reset mode.

You can read input lines and/or set output lines by either using a terminal program that supports control signals (such
as

Br@y Terminal

[http://sites.google.com/site/terminalbpp/]

) or by writing a computer program. The Microsoft .NET

framework is free to use and it contains a SerialPort class that makes it easy to read and write bytes from a serial port
as well as set and read the control signals. Here is some example C# .NET code that uses a serial port in this way:

// Choose the port name and the baud rate.

System.IO.Ports.SerialPort port = new System.IO.Ports.SerialPort("COM4", 115200);

// Connect to the port.

port.Open();

// Assuming that line A is identified with RTS, and your firmware version is 1.04

// or greater, this drives line A low (0 V).

port.RtsEnable = true;

// Assuming that line B is identified with DSR, and your firmware version is 1.03

// or greater, this takes an inverted digital reading of line B.

if (port.DsrHolding)

{

MessageBox.Show("Line B is low.");

}

else

{

MessageBox.Show("Line B is high.");

}

// Disconnect from the port so that other programs can use it.

port.Close();

When the SLO-scope feature is enabled, it assumes control of pins A and B and uses them as analog
inputs (or digital outputs controlled by the SLO-scope application). Pins A and B temporarily lose their
serial handshaking line associations while the SLO-scope is active, but these associations are restored
once the SLO-scope is disabled. You can disable the SLO-scope via the SLO-scope application or by
unplugging the programmer and plugging it back in.

Pololu USB AVR Programmer User's Guide

© 2001–2014 Pololu Corporation

6. Communicating via the USB-to-TTL-Serial Adapter

Page 45 of 54