Está en la página 1de 5

Carrera Electrónica

AVANCE EN FORMA DE CUADRADO, TRIANGULO ESPIRAL

U1 D1 D2
13 33 DIODE DIODE
OSC1 OSC1/CLKIN RB0/INT
14 34
OSC2 OSC2/CLKOUT RB1
35
RB2
2 36
RA0/AN0 RB3/PGM U2
3 37 16 8
RA1/AN1 RB4
4
RA2/AN2/VREF-/CVREF RB5
38 D3 D4
5 39 2 VSS VS OUT1 3 DIODE DIODE
RA3/AN3/VREF+ RB6/PGC IN1
6 40 7 6
RA4/T0CKI/C1OUT RB7/PGD IN2 OUT2
7 1
RA5/AN4/SS/C2OUT EN1
15
RC0/T1OSO/T1CKI
8 16
RE0/AN5/RD RC1/T1OSI/CCP2
9 17 9
RE1/AN6/WR RC2/CCP1 EN2
10 18 10 11
RE2/AN7/CS RC3/SCK/SCL IN3 OUT3
23 15 14
RC4/SDI/SDA IN4 GND GND OUT4
1 24
RESET MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK
26 L293D
RC7/RX/DT
D5 D6
19 DIODE DIODE
RD0/PSP0
20
RD1/PSP1
21
RD2/PSP2
22
RD3/PSP3
27
RD4/PSP4
RD5/PSP5
28 D7 D8
29 DIODE DIODE
RD6/PSP6
30
RD7/PSP7
PIC16F877A

ETAPA DE OSCILADOR ETAPA DE RESET


C1
OSC2 RESET
R2
22pF 10k

X1 VCC
CRYSTAL R1
10k
C2
OSC1
GND
22pF

GND GND VCC

CUADRADO (SIMULACIÓN)

PROGRAMACIÓN

#include <main.h>
#use delay(crystal=4M)
#use fast_io(a)
#use standard_io(b)
#define LED pin_b0
#define LER pin_b1
#define LEA pin_b2
#define LEB pin_b3
void main()
{
set_tris_a(0b11111111);
set_tris_b(0b11110000);
output_b(0b00000000);
output_a(0b00000000);
while(true){{
if(input(pin_b4)==0)
output_low(LED);
if(input(pin_b4)==1)
output_high(LED);
if(input(pin_b4)==0)
output_low(LEA);
if(input(pin_b4)==1)
output_high(LEA);
}
{
if(input(pin_b5)==0)
output_low(LER);
if(input(pin_b5)==1)
output_high(LER);
if(input(pin_b5)==0)
output_low(LEB);
if(input(pin_b5)==1)
output_high(LEB);
}
{
if(input(pin_b6)==1)
{
output_b(0x01);
delay_ms(580);
output_b(0x00);
}
}
{
if(input(pin_b7)==1)
{
output_b(0x04);
delay_ms(580);
output_b(0x00);
}
}
}
}

TRIANGULO
PROGRAMACIÓN

#include <main.h>
#use delay(clock=4M, internal)
int16 i;
int16 j;
int k;

void main()
{
k=0;
i=0;
j=0;
setup_timer_2(T2_div_by_16,255,1);
setup_ccp1(ccp_pwm);
setup_ccp2(ccp_pwm);
setup_adc(adc_clock_internal);
setup_adc_ports(all_analog);
while(TRUE){

i=905;
delay_ms(20);
set_pwm1_duty(i);

j=961;
delay_ms(20);
set_pwm2_duty(j);

if(input(pin_d1)==1)

{ for(k=0;k<4;i++)
{
output_b(0b00000000);
delay_ms(1000);
output_b(0b00000101);
delay_ms(2900);
output_b(0b00000000);
delay_ms(1000);
Output_b(0b00000001);
delay_ms(1215);

output_b(0b00000000);
delay_ms(1000);
output_b(0b00000101);
delay_ms(2900);
output_b(0b00000000);
delay_ms(1000);
Output_b(0b00000001);
delay_ms(1185);

output_b(0b00000000);
delay_ms(1000);
output_b(0b00000101);
delay_ms(2900);
output_b(0b00000000);
delay_ms(1000);
Output_b(0b00000001);
delay_ms(1210);
}
} //TODO: User Code
}
}

ESPIRAL
PROGRAMACIÓN

#include <main.h>

int16 i;
int16 j;
int k;

void main()
{
set_tris_b (0b00000000);
set_tris_c (0b00000000);

k=0;
i=0;
j=0;
setup_timer_2(T2_div_by_16,255,1);
setup_ccp1(ccp_pwm);
setup_ccp2(ccp_pwm);
setup_adc(adc_clock_internal);
setup_adc_ports(all_analog);
while(TRUE){
i=920;
delay_ms(20);
set_pwm1_duty(i);

j=910;
delay_ms(20);
set_pwm2_duty(j);

if(input(pin_d1)==1)

{ //for(k=0;k<4;i++)
{
output_b(0b00000000);
delay_ms(1000);
output_b(0b00000101);
delay_ms(2000);
output_b(0b00000000);
delay_ms(1000);
Output_b(0b00001001);
delay_ms(730);
output_b(0b00000000);
delay_ms(1000);
output_b(0b00000101);
delay_ms(2000);
output_b(0b00000000);
delay_ms(1000);
Output_b(0b00001001);
delay_ms(720);

output_b(0b00000000);
delay_ms(1000);
output_b(0b00000101);
delay_ms(2000);
output_b(0b00000000);
delay_ms(1000);
Output_b(0b00001001);
delay_ms(730);

}
} //TODO: User Code
}
}

También podría gustarte