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

Re: ADC in Free Running Mode Kategorie: Programmierung C (von Torsten - 26.01.2013 16:39)
Als Antwort auf Re: ADC in Free Running Mode von PepeV - 26.01.2013 8:55
Ich nutze:
C-Control Pro Mega128

>> Hi Torsten,
>
> Glad you want to help me. Let's see if we can figure this out together.
> I have come to some conclusions:
> 1. According to the C-Control-pro manual, an assembler call cannot be interrupted.
> So there is no need anymore to disable the global interrupt flag.

Hello Pepe,

(1)
I do not believe, PeterS switches off the interrupt functions
before every assembler call. Certainly the callback functions
won't be execute anymore. But the interrupt functions are still
active.

> 2. I think saving and restoring SREG is only needed in case of an interrupt routine.
> So we can leave out these instructions.

(2)
I don't know. I never saw a 'cli' without
a saving from 'SREG'.

> 3. The ATmega128 manual, p. 233, last line but three, says: "The first conversion
> must be started by writing a logical one to the ADSC bit in ADCSRA."
> So we need to set ADSC only once, before entering the loop.

(3)
That's right, but only in free-running-mode.

> 4. I increased the addresses of ADMUX, ADCSRA, ADCH, ADCL and SREG with
> 0x20 as should. The new addresses are out of range of the instructions in, out, cbi,
> sbi and cbis. This causes the compile errors I mentioned. These instructions will
> have to be replaced by combinations of others ("typically lds and sts combined with
> sbrs, sbrc, sbr, and cbr").
> I could try to work this out (maybe Sunday) but I would appreciate your solution
> very much.

(4)
I am using the definitions from the 'm128def.inc' file.
This file comes with the AVRStudio. So I can exchange
the assemblercode between the C-Control-IDE and the AVRStudio.
I have never a problem with this. The AVRStudio has
a very nice debugger. I would recommend very much
to try the AVRStudio.

Try ADCapture-0.02 below.

GruÃ? Torsten

>
> Regards,
> Pepe
ADCapture-0.02.zip




    Antwort schreiben


Antworten:

Re: ADC in Free Running Mode (von PepeV - 29.01.2013 22:21)
    Re: ADC in Free Running Mode (von Torsten - 30.01.2013 18:08)
        Re: ADC in Free Running Mode (von PepeV - 31.01.2013 21:16)
            Re: ADC in Free Running Mode (von PepeV - 2.02.2013 13:28)
                Re: ADC in Free Running Mode (von PepeV - 2.02.2013 15:31)
                    Re: ADC in Free Running Mode (von Torsten - 4.02.2013 19:38)
                       Re: ADC in Free Running Mode (von PepeV - 5.02.2013 13:27)
                          Re: ADC in Free Running Mode (von Torsten - 6.02.2013 21:43)
                             Re: ADC in Free Running Mode (von PepeV - 8.02.2013 17:43)
                                Re: ADC in Free Running Mode (von Torsten - 9.02.2013 10:18)
                                   Re: ADC in Free Running Mode (von PepeV - 9.02.2013 14:57)
                                     Re: ADC in Free Running Mode (von PepeV - 11.02.2013 18:29)
                                       Re: ADC in Free Running Mode (von Torsten - 11.02.2013 21:07)
                                         Re: ADC in Free Running Mode (von PepeV - 12.02.2013 19:54)