<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%> Untitled Document

 

 

 

Description

Sound / Max

Serial / Pic Programming

Design & Construction

The Musical Curtain

Images

Things To Remember

 
 

 

Serial / Pic Programming

Four flex sensors that are connected to microchip’s A0, A1, A2, and A3 ports send data to Serial Max Object in Max/Msp through serial connection to activate the sounds.

Code in text form

  • '****************************************************************

    '* Name : simpleADC.BAS *

    '* Author : T. Holoubek *

    '* Notice : Copyright (c) 2004 [select VIEW...EDITOR OPTIONS] *

    '* : All Rights Reserved *

    '* Date : 1/3/2004 *

    '* Version : 1.0 *

    '* Notes : *

    '* : *

    '****************************************************************

    DEFINE OSC 4

    start:

    INCLUDE "modedefs.bas"

    ' Define ADCIN parameters

    ' Set number of bits in result

    DEFINE ADC_BITS 10

    ' Set clock source (3=rc)

    DEFINE ADC_CLOCK 3

    ' Set sampling time in microseconds

    DEFINE ADC_SAMPLEUS 10

    ' Set PORTA to all input

    TRISA = %11111111

    ' Set up ADCON1 analog and right justify the result

    adcon1 = %10000010

    'define adc vars
    adcVar0 VAR WORD ' Create variable to store result
    adcVar1 VAR WORD ' Create variable to store result
    adcVar2 VAR WORD ' Create variable to store result
    adcVar3 VAR WORD ' Create variable to store result
    pause 500

    main:
    ' Read channel 1
    ADCIN 0, adcVar0
    ADCIN 1, adcVar1
    ADCIN 2, adcVar2
    ADCIN 3, adcVar3
    'print the variable - notice the variable name is preceded by DEC
    'serout2 portc.6, 16468, [DEC adcVar0, 13, 10]

  • 'for max
    serout2 portc.6, 16468, [adcVar0, adcVar1, adcVar2, adcVar4]

    GoTo main