martes, 6 de junio de 2017

Switch With dsPIC30F4013


Diagram:
Code (XC16 Compiler):
#include <xc.h>
#include <libpic30.h>
 
// Configuration settings
_FOSC(CSW_FSCM_OFF & FRC_PLL16); // Fosc=16x7.5MHz, i.e. 30 MIPS
_FWDT(WDT_OFF);                  // Watchdog timer off
_FBORPOR(MCLR_DIS);              // Disable reset pin
 
int main(void)
{
    // Make RD0 a digital output and RD1 as input
    _TRISD0 = 0;
    _TRISD1 = 1;
    
    // Blink LED on RD0
    while(1)
    {
        if (_RD1 == 1) {
        _LATD0 = 1;
        __delay32(15000000);

        }
        else {
        _LATD0 = 0;
        __delay32(15000000);
        }
    }
}


_______________________________________________________________________

  Projects With dsPIC30F2010 And dsPIC30F4013

http://guillengap.blogspot.com/2016/07/ebook-projects-with-dspic30f2010-and.html


https://www.amazon.com/dp/B01F4YBCHG

https://www.amazon.com/Guillermo%20Perez/e/B01EZOTUVQ/

guillengap@gmail.com

No hay comentarios:

Publicar un comentario