#include <16F1936.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#fuses noDEBUG // debug - in circuit debugger enabled on RB6 and RB7 - DISABLED
#fuses noLVP // LVP - low voltage enable - DISABLED
#fuses noFCMEN // Fail safe clock monitor - DISABLED
#fuses noIESO // IESO - internal / external switch over DISABLED
#fuses noBROWNOUT // Brown out reset selection bits - 11 BOR DISABLED
#fuses noCPD // CPD - date code protect DISABLED
#fuses PROTECT // CP - code protect DISABLED
#fuses noMCLR // MCLRE - RE3 is MCLR
#fuses noPUT // PWRTE - power up timer enable bit DISABLED
#fuses noWDT // WDTE - watch dog enable bit - not enabled here, in code below
#fuses INTRC_IO // FOSC - oscillator - set to INTRC_IO-- defaults the clock to 4Mhz
#use delay(internal=4000000)
//byte const display3 [9]= {0xff,0x7F,0x3F,0x1F,0X0F,0x07,0x03,0x01,0x00}; //0x7f es la posicion 0 // i=0
// byte const display4 [9]= {0x00,0x01,0x03,0x07,0X0F,0x1F,0x3F,0x7F,0xFF};
//byte const display6 [9]= {0x00,0xff,0x7f,0x3f,0X1f,0xff,0x07,0x03,0x01};
//byte const display5 [9]= {0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFE};
// byte const display4 [8]= {0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE};
#byte portA= 0x0C
#byte portB= 0x0D
#byte portC= 0x0E
#byte portE= 0x10
# use fast_io(a)
# use fast_io(b)
#define der pin_c3
#define izq pin_c2
#define speed delay_ms(1000)
//byte const display []={0b00000000,0b00000001,0b00000011,0b00000111,0b00001111,0b00011111,0b00111111,0b01111111,0b11111111};
// byte const display2[]={0b11111111,0b01111111,0b00111111,0b00011111,0b00001111,0b00000111,0b00000011,0b00000001,0b00000000};
signed int i=0;
int x=0;
//int j=0;
int conta=5;
int pasos=5;
int aleatorio;
int num=0;
int s;
int aux=5;
//const int32 display3 [num]= {0x7F,0x3F,0x1F,0X0F,0x07,0x03,0x01,0x00}; //0x7f es la posicion 0 // i=0
// declaracion variables
//*******************
// -------------------------------------
void main()
{
SET_TRIS_a(0B00000000);
SET_TRIS_b(0B00000000);
SET_TRIS_c(0B10001111);
SET_TRIS_e(0B1);
portA=0x00;
portB=0x00;
int get1;
int get2;
speed;
while(TRUE)
{
num++;
delay_ms(500);
if (num==2)
{
SET_TRIS_a(0b11111000);
get1 =0b00000111;
get2 =0b00000111;
}
//***********************
num=3;
if (num==3)
{
SET_TRIS_a(0b11110000);
get1 =0b00001111;
get2 =0b00001111;
}
//***********************
num=4;
if (num==4)
{
SET_TRIS_a(0b11100000);
get1 =0b00011111;
get2 =0b00011111;
}
//***********************
num=5;
if (num==5)
{
SET_TRIS_a(0b11000000);
get1 =0b00111111;
get2 =0b00111111;
}
//*************************
num=6;
if (num==6)
{ SET_TRIS_a(0b10000000);
get1 =0b01111111;
get2 =0b01111111;
}
//***********************
num=7;
if (num==7)
{
SET_TRIS_a(0b00000000);
get1 =0b11111111;
get2 =0b11111111;
}
for ( s=0; s<=num; s++) //0B11111110
{
PORTa = get1 <<s; //LED move Left Sequence
speed;
}
porta=0x00;
///speed;
for ( s=0; s<=num; s++) //0B11111110
{
PORTa = get2 >>s; //LED move Left Sequence
speed;
}
porta=0x00;
// speed;
}
}