.


:




:

































 

 

 

 





 

, , .

, /.

20.17 .

 

20.17

SA1 SA2, RA2 RA3 .

VD1 VD2, RB15 RB13 .

 

LR20_1

 

#include <P33FJ32MC204.h>

 

#define FOSC 7370000

#define FCY (FOSC / 2) //

//

 

_FOSCSEL(FNOSC_FRC) //

//

 

void main()

{

TRISBbits.TRISB15 = 0; // VD1 (RB15)

 

while (1)

{

__delay32(FCY); //

LATBbits.LATB15 = 1;

 

__delay32(FCY);

LATBbits.LATB15 = 0;

}

}

 

LR20_2

#include <P33FJ32MC204.h>

_FOSCSEL(FNOSC_FRC) //

//

 

// T1

void Init_Timer1()

{

T1CON = 0; //

IFS0bits.T1IF = 0; //

IEC0bits.T1IE = 1; //

TMR1 = 0x0000; //

PR1 = 0x0E65; //

 

 

T1CONbits.TON = 1; //

//

}

int _ms = 0;

 

void __attribute__((interrupt, no_auto_psv)) _T1Interrupt()

// T1

{

_ms++;

 

IFS0bits.T1IF = 0; //

TMR1 = 0; //

}

void main()

{

Init_Timer1();

TRISBbits.TRISB15 = 0; // VD1 (RB15)

 

while (1)

{

if (_ms < 1000)

{

LATBbits.LATB15 = 0;

}

else if (_ms < 2000)

{

LATBbits.LATB15 = 1; }

else

{

_ms = 0;

}

}

}

 

LR20_3

 

#include <p33fj32mc204.h>

 

#define FOSC 7370000

#define FCY (FOSC/2)

 

_FOSC(OSCIOFNC_ON & POSCMD_NONE)

// RA2

//

 

_FOSCSEL(FNOSC_FRC) //

//

//

 

void __delay32(unsigned long cycles);

int main()

{

 

TRISBbits.TRISB15 = 0; // VD1 TRISBbits.TRISB13 = 0; // VD2

 

TRISAbits.TRISA2 = 1; // SA1

TRISAbits.TRISA3 = 1; // SA2

 

while (1)

{

if (PORTAbits.RA2 == 1 && PORTAbits.RA3 == 1)

// SA1 SA2

{

__delay32(FCY);

LATBbits.LATB15 = 1;

LATBbits.LATB13 = 0;

__delay32(FCY);

LATBbits.LATB15 = 0;

LATBbits.LATB13 = 1;

}

else

{

LATBbits.LATB15 = 0;

LATBbits.LATB13 = 0;

}

}

}

 

 

 

1 : 2-45 01 03 , 2‑45 01 02 , . 5 . . 4: ; . 5: . / . . . . : , 2009. . 4 63 .; . 5 85 .

2 Data sheet. dsPIC33FJ32MC202/204. Microchip. 2012. 290 c.

3 MPLAB IDE Users Guide. Microchip. 2009. 155 c.

 

. 3

12 3

13 Sim8085 Microprocessor Simulator 11

14 ... 20

15 25

16 .. 32

17 MPLAB IDE 40

18 dsPIC33F . 47

19 - dsPIC33F 65

20 dsPIC33F. 83

.. 102

 


 


 

 





:


: 2016-03-27; !; : 490 |


:

:

: , .
==> ...

1360 - | 1310 -


© 2015-2024 lektsii.org - -

: 0.01 .