Shop OBEX P1 Docs P2 Docs Learn Events
Streamer->DAC: what am I doing wrong? [solved] — Parallax Forums

Streamer->DAC: what am I doing wrong? [solved]

pik33pik33 Posts: 2,366
edited 2021-02-21 14:09 in Propeller 2

I am trying to get something i can hear on pins 0-4 using the streamer (in this case this should be a square wave). What am I doing wrong?

CON

base      = 0
_clkfreq  = 200_000000

pub test1()

coginit(0,@a_test, 0)


DAT             org

a_test          drvl    #4<<6 + base                         'Drive 4 pins starting from base LOW
                wrpin   dac75,#4<<6 + base                   'Set DACs @ 2V/75 Ohm

                setxfrq a80000000                            'set streamer freq to 1:1

                '' i want the streamer to output SOMETHING on pin 0..3

p103            mov ii,#10
p101            xcont m_test, #0
                djnz ii,#p101
                mov ii,#10
p102            xcont m_test, affffffff
                djnz ii,#p102
                jmp #p103


dac75           long    %0000_0000_000_1011100000000_01_00000_0                          '75-ohm, 2.0V
m_test          long    %0111_1111_1000_0001_0000_0000_0000_0000 + base<<17 + 65535      'imm->4xDAC
affffffff       long    $FFFFFFFF
a80000000       long    $80000000
ii              res     1

Comments

  • pik33pik33 Posts: 2,366
    edited 2021-02-21 14:20

    Solved. First wrpin, then drvl.

    Edit: Yet another beginner's error. Use #3, not #4, to set 4 pins.

    a_test           wrpin   dac75,#3<<6 + base                   'Set DACs @ 2V/75 Ohm
                     drvl    #3<<6 + base                         'Drive 4 pins starting from base LOW
    
  • evanhevanh Posts: 15,915

    Right, some modes need DIR low during init or they just don't start up sensibly. So the full sequence is FLTL then WRPIN/WXPIN then DIRH. Others aren't so fussy.

Sign In or Register to comment.