CDC-IO
CDC-IO manipulates the AVR's Special Function Registers (SFR) through a virtual COM port on PC. It enables reading/writing the MCU's parallel port freely. With the operations of Timer/Counter, PWM, A/D Converter, or EEPROM, PC application achieves an advanced control over the device.
The External Interface using Software-USB
Usage
The installation is the same as CDC-232. The baudrate is arbitrary. Send text style commands from terminal software or from your application on PC. If you need faster data transfer, Use "lowcdc.vbs" to switch to the bulk transfer mode.
CDC-IO Instruction Set
Function Command Format Response Who @ @ "cdc-io", CR-LF Get ? address ? data, CR-LF Set = data address = CR-LF AND & Set & data address & CR-LF OR & Set | data address | CR-LF EX-OR & Set ^ data address ^ CR-LF Set Double $ data2 data1 address $ CR-LF ATtiny2313 version has "Set","Get","Xor" only.
address: memory mapped SFR address in hex
data: 8 bit data in hex
delimiter: Tab, Space, CR, LF
predefined addr: (case-insensitive, NOT supported at ATtiny2313)
PINB, DDRB, PORTB
PINC, DDRC, PORTC
PIND, DDRD, PORTD
Example: ('_' means delimiter)
DDRB_?_ Replies DDRB value with CR-LF.
12_34_=_ Write 0x12 to address:0x34, replies CR-LF.
FB_PORTC_&_ Write (PORTC & 0xFB) to PORTC, replies CR-LF.
(ATtiny2313)
36_?_ Replies PINB(0x36) value with CR-LF.
12_37_=_ Write 0x12 to DDRB(0x37), replies CR-LF.
FB_38_^_ Write (PORTB ^ 0xFB) to PORTB(0x38), replies CR-LF.
Previous data and addr can be reused. Just enter command char to repeat.
"Set Double" command is used to write into EEPROM.
Avoid changing the port bits shared with USB signals. Use '&', '|' or '^' to modify the port direction. Use PIN* to toggle bits if the port is assigned to output.
While enabling interrupt, the interrupt vector number is reported when invoked.
Any SFRs are accessible. See AVR datasheet to use Timers, ADC, EEPROM, etc.
Schematics
Use crystal oscillator. Although ceramic resonator works well in most cases, it becomes unstable if the frequency deviation is bigger.
ATtiny45/85 uses internal RC oscillator and PLL. It is calibrated to 16.5MHz by the USB signal when connected.
CDC-IO for ATtiny45-20
CDC-IO for ATtiny461-20
Only the "Set", "Get" and "Xor" commands are implemented in ATtiny2313's limited memory. This version has no interrupt-report mechanism.
CDC-IO for ATtiny2313-20
CDC-IO for ATmega8/48/88-20
Sample Program
These are the experimental circuit and the sample programs for ATmega8/48. These programs are written in C, VB, VC, VC++, and C#. You can use any other languages (or macros) if they support RS-232C communication.
The volume control changes the buzzer tone and the LED's blinking pattern.