0% found this document useful (0 votes)
69 views7 pages

Programas Del PIC 18F4550

The document contains 4 programs that control LED patterns on an 8 LED circuit. The first program lights up the LEDs from the center out in sequence. The second program increments the LEDs on from 0 to 255. The third program increments then decrements the LEDs to create a back and forth pattern. The fourth program lights up each LED individually in sequence from left to right then right to left.

Uploaded by

Michael Fields
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views7 pages

Programas Del PIC 18F4550

The document contains 4 programs that control LED patterns on an 8 LED circuit. The first program lights up the LEDs from the center out in sequence. The second program increments the LEDs on from 0 to 255. The third program increments then decrements the LEDs to create a back and forth pattern. The fourth program lights up each LED individually in sequence from left to right then right to left.

Uploaded by

Michael Fields
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Practica de 8 leds en carrera (Del centro hacia afuera)

#include <8led's 2.h>


#use delay(clock=48000000)
#build(reset=0x02000,interrupt=0x02008)
#org 0x0000,0x1fff{}
#Byte puerto_a=0xf80
#Byte puerto_b=0xf81
void main (void)
{
Set_tris_a(0x00);
Set_tris_b(0x00);
do
{
puerto_a=0b000001;
puerto_b=0b000001;
delay_ms(500);
puerto_a=0b000010;
puerto_b=0b000010;
delay_ms(500);
puerto_a=0b000100;
puerto_b=0b000100;
delay_ms(500);
puerto_a=0b001000;
puerto_b=0b001000;
delay_ms(500);
}
while(true);
}

Secuencia de 8 leds
#include <SECUENCIA DE LEDS.h>
#use delay(clock=48000000)
#build(reset=0x02000,interrupt=0x02008)
#org 0x0000,0x1fff{}
#Byte puerto_b=0xf81
void main (void)
{
Set_tris_b(0x00);
do
{
puerto_b=0;
delay_ms(50);
puerto_b=1;
delay_ms(50);
puerto_b=3;
delay_ms(50);
puerto_b=7;
delay_ms(50);
puerto_b=15;
delay_ms(50);
puerto_b=31;
delay_ms(50);
puerto_b=63;
delay_ms(50);
puerto_b=127;
delay_ms(50);
puerto_b=255;
delay_ms(50);

}
while(true);
}

Secuencia de 8 leds ida y vuelta.


#include <SECUENCIA DE LEDS.h>
#use delay(clock=48000000)
#build(reset=0x02000,interrupt=0x02008)
#org 0x0000,0x1fff{}
#Byte puerto_b=0xf81
void main (void)
{
Set_tris_b(0x00);
do
{
puerto_b=0;
delay_ms(50);
puerto_b=1;
delay_ms(50);
puerto_b=3;
delay_ms(50);
puerto_b=7;
delay_ms(50);
puerto_b=15;
delay_ms(50);
puerto_b=31;
delay_ms(50);
puerto_b=63;
delay_ms(50);
puerto_b=127;
delay_ms(50);
puerto_b=255;
delay_ms(50);

puerto_b=0b01111111;
delay_ms(50);
puerto_b=0b00111111;
delay_ms(50);
puerto_b=0b00011111;
delay_ms(50);
puerto_b=0b00001111;
delay_ms(50);
puerto_b=0b00000111;
delay_ms(50);
puerto_b=0b00000011;
delay_ms(50);
puerto_b=0b00000001;
delay_ms(50);
puerto_b=0b00000000;
delay_ms(50);
}
while(true);
}

8 led's de uno en uno ida y vuelta.


#include <8 led's de uno en uno ida y vuelta.h>
#use delay(clock=48000000)
#build(reset=0x02000,interrupt=0x02008)
#org 0x0000,0x1fff{}
#Byte puerto_b=0xf81
void main (void)
{
Set_tris_b(0x00);
do
{
puerto_b=0;
delay_ms(500);
puerto_b=1;
delay_ms(500);
puerto_b=2;
delay_ms(500);
puerto_b=4;
delay_ms(500);
puerto_b=8;
delay_ms(500);
puerto_b=16;
delay_ms(500);
puerto_b=32;
delay_ms(500);
puerto_b=64;
delay_ms(500);
puerto_b=128;
delay_ms(500);

puerto_b=64;
delay_ms(500);
puerto_b=32;
delay_ms(500);
puerto_b=16;
delay_ms(500);
puerto_b=8;
delay_ms(500);
puerto_b=4;
delay_ms(500);
puerto_b=2;
delay_ms(500);
puerto_b=1;
delay_ms(500);
}
while(true);
}

You might also like