ATmega328p bare-metal firmware for precise pulse generation controlled via serial commands.
- Pulse Output: PD3 (D3 in Arduino Nano)
- Status LED: (PB5 (D13 in Arduino Nano, which is the built-in LED)
Compile with
make Flash with (Requires avrdude)
make flash The generator is controlled via serial interface. Commands must be sent at 9600 baud:
stty -F /dev/ttyUSB0 9600There are three
- Single Pulse (0)
- Multi-pulse burst (1)
- Continuous (2)
You can set one of these modes by sending an m command. For instance, to set the generator
to continuous mode run
echo "m2\n" > /dev/ttyUSB0 | Command | Description | Parameter range |
|---|---|---|
t |
Trigger | - |
m |
Change operation mode | 1 (Single pulse), 2 (Multi-pulse burst), 3 (Continuous) |
d<param> |
Pulse width (ms) | 1 - 274873713 |
p<param> |
Total period (ms) | d - 274873713 |
c<param> |
Pulse Count (mode 1) | 1 - 255 |
s |
Stop | - |
This uses Timer1 to count both pulse duration and pulse period. The timer can count up to uint16_t to store the required overflows, the theoretical maximum period is