Search found 4 matches

by javiojeda
Fri Feb 12, 2021 12:43 pm
Forum: MicroPython pyboard
Topic: Data type conversion with adc
Replies: 12
Views: 8339

Re: Data type conversion with adc

Thank you for your advices. I found an "off road" solution. # main.py -- put your code here! from pyb import Timer, Pin, ADC, DAC tim = Timer(1, freq=1000) # Définition du timer 1 à la fréquence 1000Hz tick = 0 echeance = 1 def correction(): # ADC conversion # Control equations # DAC conversion def ...
by javiojeda
Fri Feb 05, 2021 7:42 am
Forum: MicroPython pyboard
Topic: Data type conversion with adc
Replies: 12
Views: 8339

Re: Data type conversion with adc

Dear dhylands, Thank your for your comment. I quite not understand the functioning of micropython.schedule and how to implement it. Moreover, what is the difference using a simple while loop with a utime.sleep_ms(1) function. On my oscilloscope with this solution my sample period is really stable ar...
by javiojeda
Thu Feb 04, 2021 7:45 am
Forum: MicroPython pyboard
Topic: Data type conversion with adc
Replies: 12
Views: 8339

Re: Data type conversion with adc

Dear Le fond du garage, Dear dhylands, Thank you for yours advices. I'm not in my lab today, I'll test tomorrow some new codes. @dhylands : Do you think that a pre-allocation of erreur_corrigee could overcome the HARD IRQ limitation ? Something like : ... K_P = 2.0 erreur_corrigee = 0.0 def correcti...
by javiojeda
Wed Feb 03, 2021 2:34 pm
Forum: MicroPython pyboard
Topic: Data type conversion with adc
Replies: 12
Views: 8339

Data type conversion with adc

Hello, I have an issue with my pyboard v1.1. I want to generate a control as follow : every 1ms ( error = adc_input - adc_measure error_corrected = K_P*error write on DAC ) With K_P = 2 Firstable, I used a simple while loop as : from pyb import Timer, Pin, ADC, DAC from utime import sleep_ms tim = T...