Shop OBEX P1 Docs P2 Docs Learn Events
help reading data from MaX110/MAX11 !! — Parallax Forums

help reading data from MaX110/MAX11 !!

emixemix Posts: 4
edited 2006-08-29 20:47 in BASIC Stamp
i am starting working with ADC and Basic Stamp and i hope someone could help me with this.

This is what i have but i dont know exactly if this is ok or not, because i dont receive data from data in,

if you look at the code, i do a shiftout and then a shiftin (which i dont know if its correct) and what i am reatriving is just the same data that was sent by the shiftout

so, i dont know what i am missing, timing.. enable/disable cs.



'
Variables

ADCin VAR Word 'ADC reading

'
Constants

cs CON 2 'enable or disable A to D converter

serDo CON 1 'serial data out

serDin CON 0 'serial data in

serclk CON 3 'serial Clock

'

HIGH cs 'disable

main:

DEBUG CLS

LOW cs 'enable

GOSUB chkADC

GOSUB prnt

GOTO main

chkADC:

SHIFTOUT serdin, serclk, MSBFIRST,[noparse][[/noparse]%1000110010000000\16] 'send the channel data

SHIFTIN serDo, serclk, MSBPOST,[noparse][[/noparse]ADCin\16] 'the reading 'the reading

HIGH CS

RETURN

Prnt:

DEBUG "ADCBits Chanel= "

DEBUG DEC adcin,CR

PAUSE 1000

RETURN

663 x 529 - 75K
Sign In or Register to comment.