Acutally this process didn't go well. I ran into a problem with reading data from MMA7260Q. Data was occasionally read and there was nothing showing up in Processig. Here are some reasons probably resulting in this failure:

  1. I used another power adapter for MMA7260Q which needed 3.3V. Therefore there were two different voltages running and the only connection between these two circuits was MMA7260Q's signal wire. I should unit the voltage into 3.3V and try again though.
  2. I had failed to try someone else's MMA7260Q and pic with the same code which runs very well on their circuit. Maybe moving the whole circuit onto another breadboard will help.

If everything goes smooth, there should be a diagram like this (bottom images) in Processing. But mine is all in black or flat line.

[Processing code]

code by Tom Igone.

[pic code]

DEFINE OSC 20 'ADC DEFINITIONS
DEFINE ADC_BITS 10 ' Set number of bits in result
DEFINE ADC_CLOCK 3 ' Set clock source (3=rc)
DEFINE ADC_SAMPLEUS 15 ' Set sampling time in uS

tx var portc.6
rx var portc.7
n9600 con 16468

adcVar VAR word[3] ' Create variable to store results
channel var byte
byteVar var byte[3]
inByte var byte

' set Sleep pin high:
HIGH PORTD.0

' Set PORTA to all input
TRISA = %11111111

' Set up ADCON1:
' AN3 = VREF+, all other analog pins are set to analog.
' See PIC 18F452 datasheet for details:
ADCON1 = %10000010

main:
' wait for a byte:
serin2 rx, n9600, [inByte]
' read all channels of the accelerometer:
for channel = 0 to 2
ADCIN channel, adcVar[channel]
' convert to a byte:
byteVar[channel] = adcVar[channel] /4
pause 20
next

' send results out the serial port:
serout2 tx, n9600, [DEC byteVar[0],44,DEC byteVar[1],44,DEC byteVar[2],13]
GoTo main