Vai al contenuto

Uscite analogiche su modulo espansione I/O analogico

Home Forum Controllori SlimLine e Netsyst (LogicLab) Uscite analogiche su modulo espansione I/O analogico

Stai visualizzando 10 post - dal 1 a 10 (di 10 totali)
  • Autore
    Post
  • #35872
    Anonimo
    Inattivo

    Salve a tutti, vorrei sapere come configurare il range di uscita sulle analogiche sul modulo espansione I/O analogico PCB126C170.

    #39171
    Sergio Bertana
    Amministratore del forum

    Il circuito di uscita del modulo di espansione I/O analogico è basato sul convertitore AD5412 della Analog Devices (Vedi datasheet). Come vedi viene utilizzato un convertitore D/A a 12 bits in questo topic trovi altre informazioni. Per utilizzarlo fare riferimento al  blocco funzione SysSetAnOut, il range di uscita è impostabile con il parametro Mode. Quindi a differenza della sezione A/D non occorre eseguire nessun settaggio hardware (Ponticelli) per passare da un range di funzionamento ad un altro.

    Sono previsti 4 modi di funzionamento in tensione.

    DA_VOLT_0_10, Range di uscita da 0 a +10 Volts (Risoluzione 2.44 mV/Bit)
    DA_VOLT_0_5, Range di uscita da 0 a +5 Volts (Risoluzione 1.22 mV/Bit)
    DA_VOLT_M10_10, Range di uscita da -10 a +10 Volts (Risoluzione 4.88 mV/Bit)
    DA_VOLT_M5_5, Range di uscita da -5 a +5 Volts (Risoluzione 2.44 mV/Bit)

    Sono previsti 2 modi di funzionamento in corrente.

    DA_CURR_0_20, Range di uscita da 0 a 20 mA (Risoluzione 4.88 uA/Bit)
    DA_CURR_4_20, Range di uscita da 4 a 20 mA (Risoluzione 3.90 uA/Bit)

    Scelto Mode il modulo eroga il valore in uscita impostato nel parametro Value del FB SysSetAnOut la scelta del range corretto in base alla propria necessità và fatta unicamente per sfruttare al meglio i 12 bits di risoluzione.

    #39172
    Sergio Bertana
    Amministratore del forum

    Aggiungo una precisazione molto importante, essendo l’impostazione del range di funzionamento eseguita da programma non è possibile alla accensione del sistema (Prima che il programma vada in esecuzione) determinare il valore erogato in uscita dal modulo.

    Quindi se l’uscita del modulo è utilizzata per il comando di attuatori (Azionamento motori, servovalvole idrauliche ecc.) occorre garantire l’abilitazione al funzionamento dell’attuatore tramite una uscita logica aggiuntiva. Solo per le uscite logiche è garantita la certezza dello stato (Sempre disattivo) alla accensione del sistema.

    #39173
    Anonimo
    Inattivo

    Ok grazie. In effetti avevo usato il mode AD_VOLT_0_10_COMMON, che si usa per la lettura degli ingressi analogici.

    #39174
    Sergio Bertana
    Amministratore del forum

    Il FB SysSetAnOut come tutti i FB ha una uscita di Fault controllando l’attivazione dela uscita con la funzione SysGetLastError è possibile acquisire l’eventuale errore di esecuzione tra cui l’errore di valore di Mode errato (Vedi estratto manuale).

    #65928
    George
    Partecipante

    I have connected two PCB126C150 on a MPS054A110 CPU (fw:SFW198E000) and i made a program to update the eight analog output channels.

    If i run this program from Task background, execution is as expected.

    if i run from Task slow, the update is done only on the first module (as i can see at Done output of SysSetAnOut FB). The same even if i play with longer loop time of slow Task.

    I may send the program i prepared.

    #65970
    Sergio Bertana
    Amministratore del forum

    It’s a strange behaviour, even if we suggest to use the SysSetAnOut FB  in the background task, it can be used also in the slow task.

    To avoid loss of time in the peripheral bus access, FB sets the analog value to the output module only when the value changes. But the Done output it’s set at every FB execution.

    You can send your program to our support eMail and we will check it.

    #65977
    Sergio Bertana
    Amministratore del forum

    I received your program and verifying it i’m discovered the problem. In a program executed on Slow task at first loop you allocate some memory with SysMAlloc.

        IF (SysFirstLoop) THEN
            pByte:= SysMAlloc(4000);
        END_IF;

    You must consider that the maximum allowable malloc memory in your system is 4096 bytes, after allocation only 96 bytes remains free. The SysSetAnOut FB uses 12 bytes of malloc memory, considering that malloc alignes memory at addresses divisible for 4 some bytes are lost at every calling. So what’s happens in your program?

    At first loop, tasks are executed in the order Boot, Back, Slow, Fast, so if you execute 8 SysSetAnOut instances in task Slow after the SysMAlloc the available memory is not enough for all the instances, the last one cannot be executed and the SysLog command returns an error like this:

    [29/06/2022 08:30:37.023] [E] SFW198[ 6300] PLCMAlloc size:12

    In the other hand if you execute the 8 SysSetAnOut instances in task Back the SysMAlloc will be executed after, the available memory is not enough for it and the SysLog command returns an error like this:

    29/06/2022 08:35:37.040] [E] SFW198[ 6300] PLCMAlloc size:4000

    Considerations:

    • When there’s something wrong execute SysLog command, it could give you informations about the error.
    • Instead of use the SysMAlloc to allocate a buffer, you can simply declare an array VArray : ARRAY[0..3999] OF BYTE;
    #66072
    George
    Partecipante

    Hello, if you had read the comments inside “MyProgram” in project i had sent, you could see that i had located the problem in malloc buffer size and the memory allocation mechanism of the linker. The information for malloc memory of SysSetAnOut FB  is very useful.

    Another problem that i found is that the measured output values are abnormal. The analog outputs drive the reference inputs of motor inverters. If for example set channel 1 to 1V and all the other channels to 0V, the measured values to channels other than channel 1 are like -3.5V or 2.5V etc.

    I checked that between analog inputs of inverters and the earth strip the impedance is about 100KOhm. The inverters specs for reference input give Ri about 40KOhm. If i disconnect the analog outputs from inverters reference inputs the measured values are as expected.

    The solution that implemented and solves my problem is to connect opamp buffers between analog outputs of the module and the inverters inputs. If you could suggest a more simple solution, it would be nice.

    #66117
    Sergio Bertana
    Amministratore del forum

    The main problems with the inverters are about the electromagnetic interference (EMI).

    If the inverter has not any line input filter and motor filter, the motor cables are not shielded or crossed and their path is near to the reference signal cable this can cause a problem in the analog output modules channels.

    The fact that the problem disappears when you insert between the analog output module signal and inverter input support the previous scenario.

    My suggestion is try to use shielded cables to connect the analog output to the inverter input and insert a 1uF polyester capacitor directly on the analog output module directly between the AOxxV and AGnd terminals.

Stai visualizzando 10 post - dal 1 a 10 (di 10 totali)
  • Devi essere connesso per rispondere a questo topic.