5 years, 1 month ago.

m4 dac

estoy teniendo problemas con los dac integrados del procesador m4. alguien sabe la tasa de escritura maxima del valor analogico? mi codigo trata de un control de galvanometro a alta velocidad en funcion de una lectura de pulsos . es el sigueinte:

  1. include "mbed.h"

AnalogOut Aout (A4); InterruptIn pulso (A0, PullDown); DigitalOut led (D13); DigitalIn dir (A1 ,PullDown); float pos;

void move() {

if (dir ==1) { led =1; pos = pos+0.001; } else { pos = pos-0.001; led =0; } }

int main ()

{

while (1) { Aout.write(pos); pulso.rise(&move); if (pos>0.9) { pos=05; }

} }

thanks a lot

Adrian, which target MCU are you using? and can you format your code as indicated in the Editing Tips.

include the mbed library with this snippet

#include "mbed.h"

// your code here

posted by Paul Staron 24 Mar 2019
Be the first to answer this question.