CLASS DOCUMENTS


REPORTS & ASSIGNMENTS


CLASS CONTENT


USING THIS SITE








registered authors login here

You are: (logout)



For more on PMWiki, see pmwiki.org


Serial Processing Pic

By Chang Soo Lee
This PicBasic Pro code reads a force-sensing resistor using a Voltage Divider circuit connected to an analog pin of a microcontroller.

Back to FSR Report.

'Basic serial communication 
'Send data to Processing
'by Chang Soo Lee
'ITP, NYU

define OSC 4
DEFINE  ADC_BITS        10
DEFINE  ADC_CLOCK       3
DEFINE  ADC_SAMPLEUS    50

SensorValue var word
SensorValueB var Byte

tx var portc.6
rx var portc.7

n9600 con 16468

TRISA = %11111111
ADCON1 = %10000010

Main:
    ADCin 0, SensorValue
    SensorValueB = SensorValue/4
    serout2 tx, n9600, [SensorValueB]
    pause 50
Goto main
  Edit | View | History | Print | Recent Changes | Search Page last modified on January 16, 2006, at 02:50 PM