| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

Wiring_Osc

Page history last edited by Bjoern Hartmann 11 years, 8 months ago

WIRING_OSC is a port of Arduino_Osc to the Wiring hardware.

 

Download: wiring_osc_0004.pde - requires Wiring 0018 or higher (Wiring 0018 fixes a race condition in the Serial receive buffer code that could lead to "stuck" bytes).

 

You can test WIRING_OSC using a Pd patch on pd_OSCserial.

 

Notes (from file):

/**************************************************************
 * WIRING_OSC 0004
 *
 * Firmware to send OSC messages from a Wiring board to a PC
 * and to receive OSC messages sent from the PC.
 *
 * Right now, only messages with a single integer argument
 * are supported in either direction.
 *
 * Uses the following serial OSC format:
 * 0xBE MSG_LENGTH OSC_MESSAGE CHECKSUM
 * ---- ---------- ---/.../--  --------
 * 1b   1byte      4*n bytes   1byte
 *
 * PROTOCOL DETAILS
 * Digital pins 0..39, analog inputs 0..7 are supported.
 * PWM output on PWM pins 0..5 is supported as well.
 * Below, the notation [0..39] means: any number from 0 to 39.
 * The notation [0|1] means: either 0 or 1.
 * Pin numbers are always part of the OSC address. 
 * The single integer argument for each OSC message
 * represents either HIGH/LOW, or an 8bit analog value.
 *
 * PC->WIRING MESSAGE FORMAT
 * /pinmode/[0..39]  [0|1] - set a pin to input or output mode
 *
 * /report/adc [0|1]    - turn all analog pin reporting on/off (Default: off)
 * /report/adc/[0..7] [0|1]  - set analog pin reporting for one pin on/off
 * /report/in [0|1]     - turn digital pin reporting on/off (default: on)
 *
 * /out/[0..39] [0|1]         - set a digital pin to [low|high]
 * /pwm/[0..5] [0..1023]     - set duty on a pwm-enabled pin 
 * 
 * ARDUINO->PC PROTOCOL 
 * /in/[0..39] [0|1]    - a digital input pin changed to [high|low]
 * /adc/[0..7] [0..255] - analog input value changed to [0..255]
 * NOTE: input pins use pull-up resistors and are HIGH by default.
 * Therefore, 0 means HIGH, 1 means LOW (pulled to ground). 
 *
 * EXAMPLES: PC->ARDUINO 
 * /pinmode/5 0         - set pin 5 to INPUT
 * /pinmode/9 1         - set pin 9 to OUTPUT
 * /out/9 0             - set pin 9 to LOW
 * /out/12 1            - set pin 12 to HIGH
 * /pwm/4 512          - set PWM duty on PWM pin 4 to 512 (50%)
 * /report/in 1         - turn digital input pin reporting on
 * /report/adc/4 0      - turn reporting of analog input 4 off
 *
 * EXAMPLES: WIRING->PC
 * /in/4 1              - digital input pin 4 pulled to ground
 * /adc/2 512           - analog input pin2 read 512 (=2.5V)
 * 
 * DEFAULT STARTUP CONFIGURATION
 *   - Pins 0-39 are all set to input, digital reporting enabled
 *     (change variable reportDigital to False to disable by default)
 *   - Analog reporting is disabled 
 *     (change variable reportAnalog to 0xFF to enable by default)
 *
 * NOTES:
 *   - Pins 32,33 cannot be used (needed for Rx/Tx)
 *   - Resolution on analog in and out is 10 bit.
 *   - So far, not much error checking for bounds done
 *   - In testing with pd and [serialIO], message bytes tend to get "stuck"
 *     in a buffer either on PC or on Wiring board side when sending to hardware,
 *     with the effect that an OSC message doesn't get processed on the board
 *     until the *next* message arrives, or until a few 0x00 characters are sent.
 *     This does not appear to happen wir Arduino_Osc.
 *   - On the tested board, pin Analog In 0 corresponds to analogRead(7) and 
 *     pins 1..7 correspond to analogRead(0)..analogRead(6).
 *
 * MIT License:
 * Copyright (c) 2008 Bjoern Hartmann, Stanford HCI Group
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * bjoern@cs.stanford.edu 11/23/2008
 **************************************************************/

 

 

 

Developer Notes:

* Working bootloader  pulles  off a Wiring board using AVR Studio: stk500boot-from-board.hex

* Fuses of board with working bootloader board at 0xFF, 0xCC, 0x2F. Lock bits are 0xEF.

 

 

Comments (0)

You don't have permission to comment on this page.