Zur Übersicht - INFO - Neueste 50 Beiträge - Neuer Beitrag - Suchen - Zum C-Control-I-Forum - Zum C-Control-II-Forum

Re: ADC zu RS232 Kategorie: IDE (von Tobias - 18.07.2016 0:00)
Als Antwort auf ADC zu RS232 von Bram - 17.07.2016 23:16

> What is Wrong ?
>
> Thanks Bram.
>
>
>    SPI_Disable();
>
>     Serial_Init(PORT,SR_8BIT|SR_1STOP|SR_NO_PAR,SR_BD19200);
>
> //    Read ADC and transfer the data to the Serial Port
>
>     while (1)
>     {
>        ADC_SetInt(40,1);
>        ADC_StartInt();
>        Serial_WriteText(0,"ADC1:rn");
>        Serial_Write(0,ADC_ReadInt());
>        Serial_Write(0,(13));
>        AbsDelay(1000);
>     }
>
> }

Dear Bram,

I didn't checked it on my MEGA, but the first failure which I see is that
you must write the 40 as a HEX-value: 0x40! Only "40" is a decimal-value.

ADC_SetInt(0x40,1);

And additional: I never tested the ADC in Interrupt-mode, but I think you must
also activate the ADC-IRQ (INT_ADC) and use it before you can read the value. Please check this link:
Interrupt in the manual

Best regards,
Tobias


    Antwort schreiben


Antworten: