Shop OBEX P1 Docs P2 Docs Learn Events
Mcp3204 adc — Parallax Forums

Mcp3204 adc

Greg LaPollaGreg LaPolla Posts: 323
edited 2010-09-09 00:04 in Propeller 1
I am trying to convert the mcp3208 object from obex to work on the mcp3204. I don't have a real good understanding of assembly, and I think I am making more difficult because of it.

I have made some changes, but the problem seems to lie in this bit of code:

cloop                   shr     t2,#1           wc      'if channel disabled, skip
        if_nc           jmp     #skip

                        test    t2,#4           wc      'channel enabled, get single/diff mode
                        muxnc   command,#$04
                        mov     stream,command

                        or      outa,smask              'CS high
                        or      dira,dmask              'make DIN/DOUT output
                        mov     bits,#20                'ready 18 bits (cs+1+diff+ch+1+0+data[noparse][[/noparse]12])





the

test t2,#4 wc
muxnc command,#$04

seems to be the culprit.

In the mcp3208 they are

test t2,#$80 wc
muxnc command,#$08

I looked at the mcp3202 driver and they are
test t2,#2 wc
muxnc command,#%0100


I am not sure how to proceed. I have already read potatoheads beginning assembly and the assembly book from deSIlva and I still can't figure it out.

Thanks in advance


Greg

Comments

  • tae2010tae2010 Posts: 38
    edited 2010-06-20 02:14
    Check out my thread, http://forums.parallax.com/showthread.php?p=904652. I setup a 3202 with a piece of code I found on OBEX also. Hope it helps, its much simpler to follow than the assembly code version.
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-06-20 10:04
    Hi Greg,

    you can give the ADC Input Driver object from the obex a quick try if it works for you

    I haven't tested this object myself but the author describes that

    "Known supported ADCs are:
    MCP3208, MCP3204, MCP3202, MCP3201, MCP3008, MCP3004, MCP3002, and MCP3001"

    So I assume the author has tested the devices mentioned above as working

    best regards

    Stefan

    Post Edited (StefanL38) : 6/20/2010 10:13:03 AM GMT
  • mynet43mynet43 Posts: 644
    edited 2010-06-20 20:05
    Hi Greg,

    I have an ADC driver in the OBX called MCP3208_fast.

    I believe it should work with the 3204 without changes. It has the same calling sequence as Chip's routine, but it only accesses one port at a time, the one you ask for.

    So if you use it with ports 1,2,3 or 4 it should work fine.

    Let me know if you have any questions.

    Jim
  • JDJD Posts: 570
    edited 2010-09-09 00:04
    Thanks Stefan... this was a nice help to use a MCP3204 for the Joystick. It's for a remote control Stingray Project I'm doing. Im going to use the other two channels to check for voltage on the battery pack.
Sign In or Register to comment.