MCP4922 Assembly Code?
sbergren
Posts: 12
in Propeller 1
I've gotten the MCP4922 spin code on the OBEX and it works well, but slowly. I need something faster for audio, so I tried writing it in assembly. But, it isn't working. It should be very simple, so if someone can take a look and see what I'm doing wrong, I would be most appreciative! Thanks!
Comments
As we say in Hollywood, "For your consideration..." I don't have a chip to test, but I can write simple code. I like to develop PASM objects in a single file like this. When everything is working I pare out the test stuff, and remove the prefix ("mcp4922_" in this case) from method calls.
Hopefully, this will help you sort out the device.
Instead of masking the value with $FFF, this version uses the max operator to limit the value to 12 bits.
BTW, the reason for setting bit31 of decval is to allow %0000 for the configuration bits, and 0 for the dac value -- the background triggers on a non-zero value.