Page 1 of 1

CHO RDAL

Posted: Sun Jun 02, 2013 9:54 pm
by Digital Larry
The Spin ASM Manual says that two bits are used to select from SIN0, COS0, SIN1, COS1, RMP0, RMP1. That's six choices with two bits. Anyone see something wrong with that? What's the real answer?

Posted: Mon Jun 03, 2013 9:51 am
by frank
Looks like we missed a typo for all this time. Will investigate more but looks like it should be:

1100 001X 0YZ0 0000 0000 0000 0001 0100

XYZ
000 sin0
001 sin1
010 rmp0
011 rmp1
100 cos0
101 cos1
110 not used
111 not used

Posted: Mon Sep 09, 2013 9:32 pm
by Digital Larry
Hi Frank,

The answer was to be found in the assembler error message when trying to use 4 or 5:

Code: Select all

<0000>[ Pass 2] [ 1021] Line: 8 "CHO RDAL,4 " - ERROR:Integer Value out of Range - CHO RDAL[LFO] should be 'SIN0 (0)','SIN1 (1)','COS0 (8)','COS1 (9)','RMP0 (2) ' or 'RMP1 (3)'
<0001>[ Pass 2] [ 1021] Line: 16 "CHO RDAL,5 " - ERROR:Integer Value out of Range - CHO RDAL[LFO] should be 'SIN0 (0)','SIN1 (1)','COS0 (8)','COS1 (9)','RMP0 (2) ' or 'RMP1 (3)'

Posted: Mon Sep 09, 2013 9:55 pm
by frank
We probably made the field bigger for future expansion, so it seems to be 4 bits wide since it supports 8 and 9 for selection.

Posted: Thu May 28, 2015 12:14 pm
by Sweetalk
I'm using the cho rdal to read the value of the LFOs. I need to use sin0, cos0, sin1, cos1 for several stages of the code for synchronize effects.

Started with some simple tests reading the LFOs values and sending to the DAC's. The sin0 and sin1 are perfect, but when I try to see the cos0 or cos1 in the oscilloscope I only get a distorted sine wave instead of a cosine and thats messing up with all the sync in my code.

Simple code for testing, sin0, cos0 to out L, sin1 and cos1 to out R, POT0 and POT1 levels for the sine and cosine and pot2 rate:

Code: Select all

equ	SENO0	reg0
equ	COSE0	reg1
equ	SENO1	reg2
equ	COSE1	reg3

equ	Mix0	reg4
equ	Mix1	reg5

skp	run,	START
wlds	sin0,	11,	32676
wlds	sin1,	11,	32676

START:
rdax	pot2,	1
sof	0.5,	0.185                               ; Scalling speed
wrax	SIN0_RATE,	1
sof	0,		0.02                         ; SIN1 slightly faster than SIN0
wrax	SIN1_RATE,	0


cho	rdal,	sin0                                  ; Read sin0
mulx	pot0                                          ; POT0 sin0 level
wrax	SENO0,	0

cho	rdal,	cos0                                  ; Read cos0
mulx	pot1                                           ; POT1 cos0 level
wrax	COSE0,	0

cho	rdal, 	sin1
mulx pot0
wrax	SENO1,	0

cho	rdal,	cos1
mulx pot1
wrax	COSE1,	0

rdax SENO1,       1                              ; Read sin1
rdax COSE1,       1                              ; Sum cos1
wrax dacr,           0                              ; output to dacr

rdax	SENO0,	1                                ; Read sin0
rdax	COSE0,	1                                ; sum cos0
wrax	DACL,	0                                ; output to dacl
What's wrong with the cos?

Posted: Thu May 28, 2015 2:36 pm
by Digital Larry
Don't know for sure, but I suspect that possibly the mnemonic for cos0 and cos1 is not interpreted properly. What happens if you use the explicit value as in my previous message?

That doesn't make a lot of sense though. You're sure that the POT was turned down to only let the COS through? Because If you just add sin and cos, at points you're going to go over 1.0 peak which would clip, and since you have no phase reference, it looks like a clipped sin wave?

Posted: Fri May 29, 2015 8:09 am
by Sweetalk
Solved (I think), the sin and cos looks good in the scope (don't know really what happened) but seems to have the same phase, like if the sin and cos where the same.