2014 ii c08t-sbc pic para ecg

download 2014 ii c08t-sbc pic para ecg

of 84

  • date post

  • Category


  • view

  • download


Embed Size (px)



Transcript of 2014 ii c08t-sbc pic para ecg

  • 1. Page 1Universidad de HunucoFacultad de Ingeniera de Sistemas e Informtica

2. Page 2AgendaBase del ConocimientoDiagramas de BodeDiseo de Filtros AnalgicosDiseo de un ElectrocardiogramaMicrocontrolador PIC con LabviewMotor de InferenciaTcnicas de Diagnstico de un ECGMedios de ComunicacinPrototipo de un ECG 3. Page 3Acerca del ECG-UDH 4. Page 4Modelando un PICPICProcesadorMemoriaTemporizadorADCUSBGLCDOscilador 5. Page 5Modelando un PICInput Variables Output (User Interface) Variables (Link to other Systems) Embedded Computer Software Hardware Signal Conditioning Data Conversion Output Drive (display, keypad etc.) 6. Page 6Microcontrolador PICComo sabemos los micro controladores de 8 bits de Microchip se dividen en 3 gamas:PIC10 y PIC12: Gama bajaPIC16: Gama mediaPIC18: Gama alta 7. Page 7Estructura Interna de un PIC 8. Page 8Estructura Externa de un PIC 9. Page 9Organizacin de las Memorias de un PICa) Enfoque de Von Neumann b) Enfoque de HarvardDataMemoryProgramMemoryAddressDataCentralProcessingUnit (CPU)Input/OutputCentralProcessingUnit (CPU)DataMemoryInput/OutputProgramMemoryAddressDataAddressDataAddressData 10. Page 10Arquitectura RISC-PICA CISC machine is generallyrecognised by: Many instructions (say over onehundred), some with considerablesophistication; Instruction words are of differentlength; Instructions take differentlengths of time to execute.A RISC machine is generallyrecognised by: Few instructions (say well belowone hundred), Each performs a very simpleaction; All instructions are single word; All, or almost all instructionstake the same length of time toexecute.DigitalProgramI/0MicroprocessorDataMemoryMemoryCoreAnalogI/0& TimersCountersResetPowerClockAddress BusesInternal Data &FurtherPeripheralFurtherPeripheralInterrupt(s)A microcontroller = microprocessor core + memory + peripherals 11. Page 11Diagrama de Bloques del PICThe CPUAddress for Program MemoryData from Program Memory, carrying instruction wordAddress for Data MemoryData bus for Data Memory and peripheralsProgram MemoryData MemoryExtra non- volatile Data MemoryCounter/Timer PeripheralDigital Input/ Output PortsIt is easy to see the Program memory, which uses Flash memory technology. Alongside this comes the Stack, which we meet later. Microchip call the main data memory File Registers. There is another section of data memory which uses EEPROM technology. 12. Page 12Registro de Estado de un PICCondition Code Flags 13. Page 13Memoria de Programa y StackProgram Counter16 Series instructions which invoke the StackUnimplemented memory space, still addressable by the 13-bit 16F84A program address bus.Program Counter points to locations in program memoryThe program must start hereThe Interrupt Service Routine must start here 14. Page 14Mapa de Memoria de Datos y (SFR) Registro de Funciones Especialesmsb is bank select bit(Status register).These are the Special Function Registers, which allow the CPU to interact with the peripheralsGeneral purpose memory 15. Page 15Interface con Perifricos va elRegistro de Funciones EspecialesControl SFR(s)PeripheralData Transfer SFR(s)MicrocontrollerCore"OutsideWorld"Interrupt(s)Microcontroller Interaction with its Peripherals, via Special Function Register (SFR) and Interrupt microcontroller peripherals can be configured in software to operate in a number of different modes,to do this certain control data must be sent to them to set them up in the desired way once in use, there will be data flow between core and peripheral, there may still be need for further control data, these needs are commonly met by means of dedicated, memory - mapped registers, sometimescalled Special Function Registers, this approach gives the microcontroller manufacturer great flexibility to extend a microcontrollerfamily SFRs for new peripherals can easily be located in gaps in the memory map. 16. Page 16Configuraciones Globales del PICThe configuration word determines certain operating features of the microcontroller. It is in program memory, but cannot be accessed in normal operation. It is written to during the programming process. You set its value either by response to a dialogue box in MPLAB, or by use of Assembler Directives, at the head of your programme.The 16F84A Configuration Word 17. Page 17Tipos de Memorias de un PIC 18. Page 18Caractersticas de los OsciladoresOscilador PrimarioOscilador SecundarioOscilador InternoFrecuencias de Oscilacin Altas (XT, HS)Frecuencias de Oscilacin Medias (LP)Frecuencias de Oscilacin Bajas (RC)Con PLLSin PLLCon Pre EscalaSin Pre EscalaCon Pre EscalaSin Pre EscalaMultiplica Frecuencia de OscilacinDivide Frecuencia de OscilacinDivide Frecuencia de Oscilacin 19. Page 19Modos del OsciladorThe 16F84A can be configured to operate in four different oscillator modes, using R-C, crystal or ceramic oscillators. It can also accept an external clock source. The user selects which mode is to be used by setting bits in the Configuration Word.XT CrystalThe standard crystal configuration, intended for crystals or ceramics in the range 1MHz to 4MHz.HS High SpeedA higher drive version of the XT configuration, for higher frequency crystals and ceramic resonators. Intended for frequencies in the region of 4MHz or greater. It leads to the highest current consumption of all the oscillator modes.LP Low PowerIntended for low frequency crystal applications, and gives the lowest power consumption possible. Will however operate at any frequency below around 200kHz.RC - Resistor-CapacitorRequires connection of an external resistor and capacitor. The lowest cost way of getting an oscillator, but should not be used when any timing accuracy is required. 20. Page 20Modos del Osciladorb) Resistor-Capacitorc) Externally Supplied Clocka) Crystal or Ceramic, HS, XT, or LPRA2RA3RA4/T0CKIMCLRVRB0/INTRB1RB2RB3 RB4RB5RB6RB7RA1RA0OSC1/CLKINOSC2/CLKOUTSS VDD Supply voltageOscillator connectionsPort A, Bit 0Port A, Bit 2 Port A, Bit 1Port A, Bit 3*Port A, Bit 4Ground**Port B, Bit 0Port B, Bit 1Port B, Bit 2Port B, Bit 3Port B, Bit 7Port B, Bit 6Port B, Bit 5Port B, Bit 4*also Counter/Timer clock input**also external Interrupt inputReset19 1018The Oscillator Pins 21. Page 21Diagramas de un Oscilador Primario 22. Page 22Acerca del Conversor Analgico a Digital ADC del PIC 23. Page 23Acerca del ADC del PIC 24. Page 24AgendaBase del ConocimientoDiagramas de BodeDiseo de Filtros AnalgicosDiseo de un ElectrocardiogramaMicrocontrolador PIC con LabviewMotor de InferenciaTcnicas de Diagnstico de un ECGMedios de ComunicacinPrototipo de un ECGADC 25. Page 25Acerca del ECG-UDH 26. Page 26Caractersticas ADC del DSPICConversin va aproximacin sucesiva SAR.Velocidad de conversin de hasta 500 ksps.Hasta 16 pines de entrada analgica.Pines de referencia de Voltaje Externo.Modo Automtico de Escaneo de Canal .Fuente seleccionable de activacin de conversin.Buffer de resultado de conversin de 16 wordModos seleccionables de llenado de Buffers.Cuatro opciones de alineamiento de resultado.Modos de operacin durante el estado Sleep e Idle. 27. Page 27Acerca del ADC del PIC 28. Page 28Flujo grama de operacin del ADC 29. Page 29Estructura Mdulo A/D del PIC24FVREF+VREF-A/D converterConversion ControlBus InterfaceDataFormatSample Sequence ControlAN0AN1S/HAN15CH08/16 LevelResultsBufferVR+VR-VR SelectAVDDAVSS 30. Page 30Eje y: Tiempo de Conversin A/D = Tiempo de Adquisicin ms ConversinTiempo deAdquisicinTiempo de ConversinInicio del Tiempo de AdquisicinFin deConversinEntradaAnalgicaTiempo de Conversin A/DClock A/DTAD 31. Page 31Registro de Control ADC 32. Page 32Eje x: Tiempo de MuestreoAD1CON3TCY to 256*TCYRCADFCY = FOSC/2TADAD1CON310AD Clock Postscaler by 1 to 256 33. Page 33Proceso de Operacin del ADC 34. Page 34Configuracin del Clock del ADC 35. Page 35Aspectos de Precisin Digital 36. Page 36Diagrama de Bloques del ADC 10bitsAVDDAVSSVREF+VREF-VR+VR-VR SelectAD1CON2AVSSAVDD1xxVREF-VREF+011VREF-AVDD010AVSSVREF+001AVSSAVDD000VR-VR+VCFG2:VCFG0AD1CON2 Registerbit15CSSL13=0CSSL14=0CSSL15=0BUFMbit0ALTSCSNAVCFG2VCFG1VCFG0bit8SMPI1SMPI 0SMPI3SMPI2BUFSbit7--------------- 37. Page 37Diagrama de Bloques del ADC 10bitsAN0AN1AN15Mux AVR-AN1AD1CHSAD1CHSVINHVINL(0)(1)AD1PCFG Registerbit15CSSL10=0CSSL13=0CSSL14=0CSSL8=0PCFG1bit0PCFG0PCFG2PCFG15PCFG14PCFG13bit8AD1CON2 Registerbit15CSSL13=0CSSL14=0BUFMbit0ALTSCSNAVCFG2VCFG1VCFG0SMPI1SMPI 0SMPI3SMPI2BUFSbit7---------------bit8AD1CHS Registerbit15CH0SA1bit0CH0SA0CH0SA2CH0NAbit7CH0SA3CH0SB1CH0SB0CH0SB2CH0NBCH0SB3------------------AD1CSSL Registerbit15CSSL13=0CSSL14=0CSSL1bit0CSSL0CSSL2CSSL15CSSL14CSSL13 38. Page 38Escaneo de Canales del ADCADCBUF Buffer+-CH 0AN15AN14.AN5AN4AN3AN2AN1AN0+B- B+A- AVREF-AN1AN0AN2AN13AN14INTADCBUF0AD1CSSL Registerbit15CSSL13=0CSSL14=0CSSL1bit0CSSL0CSSL2CSSL15CSSL14CSSL13AN13bit8AD1CON2 Registerbit15CSSL13=0CSSL14=0BUFMbit0ALTSCSNAVCFG2VCFG1VCFG0SMPI1SMPI 0SMPI3SMPI2BUFSbit7--------------- 39. Page 39Diagrama de Bloques del ADC 10 bitsVINHVINLS/HMux AMux BAD1CON1AD1CON1Seal de Conversion completa01bit8AD1CON2 Registerbit15CSSL13=0BUFMbit0ALTSCSNAVCFG2VCFG1VCFG0SMPI1SMPI 0SMPI3SMPI2BUFSbit7--------------- 40. Page 40Diagrama de Bloques del ADC 10 bitsVINHVINLS/ HAD1CON1AD1CON1Conversion complete SignalADC1BUF0 : ADC1BUF15RESULTVR+VR-AD1CON1AD1CON3 (7)0 TAD to 31 TADAD1CON1 Clearing AD1CON1 (0)Active Transition on INT0 pin (1)Timer4 Compare ends (2)Evitar 0 TADA/DconverterVR-VR+ 41. Page 41Diagrama de Bloques del ADC 10 bits0000 00dd dddd dddd ssss sssd dddd dddd dddd dddd dd00 0000 sddd dddd dd00 0000RESULTFORMATAD1CON1AD1CON2 = 0AD1CON2AD1CON2ADC1BUF0: :::::ADC1BUF15AD1CON2 = 1ADC1BUF0 : : ADC1BUF7ADC1BUF8::ADC1BUF1501 42. Page 42Ejercicio N1: Digitalizar la Seal Analgica ECGTareas a realizar:Programar el PIC con MPLAB en C18.Realizar la conversin digital de una seal analgica en Proteus con PIC usando Potencimetro.Resultado esperado:Digitalizacin de una seal analgica y su visualizacin usando