Dac

  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Dac as PDF for free.

More details

  • Words: 305
  • Pages: 4
Universidad Politécnica Salesiana Facultad de ingenierías Ingeniería Electrónica Integrantes:

Esteban Arrieta Carlos Malla Alejandro Valencia Santiago Yánez

DAC La siguiente práctica muestra la generación de una senoidal en el osciloscopio, partiendo de una tabla generada en el pic 16f877a. CÓDIGO program Dac const Samples as word[100] = ( 0, 16, 31, 47, 63, 78, 94, 110, 125, 141, 156, 172, 187, 203, 218, 233, 249, 264, 279, 294, 309, 324, 339, 353, 368, 382, 397, 411, 426, 440, 454, 468, 482, 495, 509, 522, 536, 549, 562, 575, 588, 600, 613, 625, 637, 649, 661, 673, 684, 696, 707, 718, 729, 739, 750, 760, 770, 780, 790, 799, 809, 818, 827, 836, 844, 852, 860, 868, 876, 884, 891, 898, 905, 911, 918, 924, 930, 935, 941, 946, 951, 956, 960, 964, 968, 972, 976, 979, 982, 985, 988, 990, 992, 994, 995, 997, 998, 999, 999, 1000) const Delta = 20

' frequency step

dim SineValue as word dim i as byte dim T1 as word sub procedure Interrupt SineValue = samples[i] inc(i) if i >= 100 then i=0 end if ClearBit(T1CON, TMR1ON) TMR1H = Hi(T1) TMR1L = Lo(T1) SetBit(T1CON, TMR1ON) ClearBit(PIR1, TMR1IF) end sub sub procedure ProcessValue(dim Value as word)

PORTD = Lo(Value) PORTB = Hi(Value) end sub sub procedure Init INTCON = $00 TRISB = $00 TRISD = $00 TRISC = %11000000 T1 =0 TMR1H = 0 TMR1L = 0 SineValue = 0 SetBit(PIE1, TMR1IE) T1CON = $29 INTCON = $C0 end sub main: Init _loop: ProcessValue(SineValue) if Button(PORTC, 7, 2, 1) <> 0 then if T1 < (65535-Delta) then T1 = T1 + Delta end if end if if Button(PORTC, 6, 2, 1) <> 0 then if T1 > Delta then T1 = T1 - Delta end if end if goto _loop end.

DIAGRAMA

SEÑALES VISTAS EN EL OSCILOSCOPIO

CIRCUITO IMPLEMENTADO

Related Documents

Dac
May 2020 13
Dac
May 2020 20
Dac
May 2020 9
Dac
May 2020 9
Dac Syllabus.docx
November 2019 15
Adc - Dac
November 2019 24