recursos naturales
Universidad Tecnológica de Panamá
Facultad de Ingeniería Eléctr
-
Laboratorio de Técnicas de Control Digital II:
PuertosAnalógicos
Parte I:
Procedimiento:
1. Copie lassiguientes líneas y escriba su comentario.
Uchar ADVAL; /* configuración Del ATD */
ATDCTL2_ADPU = 1; Normal ATD functionality
ATDCTL2_AFFC = 1; Changes all ATD conversion complete flags toa fast clear sequence. Any access to a result register will cause
the associate CCF flag to clear automatically.
ATDCTL3 = 0x08;
—These bits control the number of conversions per sequence.Table 8-4 shows all combinations. At reset, S4C is set to 1 (sequence length is 4). This is to maintain software continuity to HC12
Family
ATDCTL4 = 0x80;
This bit selects the resolution of A/Dconversion results as either 8 or 10 bits. The A/D converter has an accuracy of 10 bits; however, if low resolution is required, the conversion can be speeded up by selecting 8-bit resolution. 8-bitresolution
ATDCTL5 = 0x25;
This bit selects whether conversion sequences are performed continuously or only once.
0 Single conversion sequence
1 Continuous conversion sequences (scan modoDDRB = 0xf0 ; /*configura PTB4-7 como salidas */
EnableInterrupts;
for(;;) {
_FEED_COP(); /* feeds the dog */
ADVAL = ATDDR0H; Module Base + 0x0010 = ATDDR0H
if (ADVAL >= 0xcc) PORTB = 0x70;else if (ADVAL >= 0x99) PORTB = 0xb0;
else if (ADVAL >= 0x66) PORTB = 0xd0;
else if (ADVAL >= 0x33) PORTB = 0xe0;
else PORTB = 0xf0;
Las instrucciones anteriores indican si el LED está encendidoo apagado.
Se creó un nuevo proyecto incluyendo el programa anterior, teniendo en cuenta de crearlo dentro del archivo main. Luego de ser...
Regístrate para leer el documento completo.