Thanks, indeed the 2 DACs are OK now with a timed write.
The little DAC test is running now, but strangly I have to shift the Y-points 1 position to the left to get the correct result compared to w2aew's logo.
Code: Select all
# -*- coding: utf-8 -*-
"""
Created on Sun May 4 08:05:40 2014
@author: Brutor
test DAC micropython
XY generation of the TEK logo on a 2445 oscillo
Inspired by w2aew's video : http://www.youtube.com/watch?v=344oEu9vo7w
"""
from pyb import DAC
from pyb import LED
#import math
dac_x = DAC(1)
dac_y = DAC(2)
# Turn on the blue LED
led = LED(4)
led.on()
# TEK Logo from w2aew - y_points shifted 1 position to the left
x_points = (10, 90, 90, 110, 130, 140, 140, 90, 90, 97, 113, 120, 90, 90, 100,
150, 150, 170, 170, 195, 220, 190, 220, 195, 170, 170, 100, 85,
77, 70, 72, 80, 90, 60, 60, 40, 40, 10)
y_points = (100, 80, 82, 74, 60, 40, 40, 50, 60, 60, 50, 50, 40, 30, 30,
100, 100, 55, 80, 80, 45, 10, 10, 35, 10, 10, 13, 23, 40, 60, 72,
80, 80, 10, 10, 80, 80, 100)
# place the points in a bytearray
buf_x = bytearray(len(x_points))
buf_y = bytearray(len(x_points))
for j in range(len(x_points)) :
buf_x[j] = x_points[j]
buf_y[j] = y_points[j]
# Write the TEK logo on the dac outputs
# DAC outputs are RC filtered with 10k - 10nF
dac_x.write_timed(buf_x, 2000, mode=DAC.CIRCULAR)
dac_y.write_timed(buf_y, 2000, mode=DAC.CIRCULAR)
Not bad, there is clearly some noise on the DAC outputs ...
I'll continue to try to get the logo turning around.