Matriz Led 3x6

Hola Amigos de FDE

Tengo este esquema en proteus y su codigo.. tengo un problema con esta matriz
quiero que prenda led por led recorriendo todas las columnas y filas, pero al final de cada fila me prende el ultimo led y de ahi si inicia la fila desde la primera columna.
Muchas Gracias por su ayuda
 

Adjuntos

  • desing matriz.rar
    32.7 KB · Visitas: 19
Última edición:
Lo hice así y se arreglo el problema...
Gracias

Código:
#include <16F84A.h>
#INCLUDE <MATH.H>

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES PUT                      //Power Up Timer
#FUSES NOPROTECT                //Code not protected from reading

#use delay(clock=10000000)


#BYTE PORTA = 0x05
#BYTE PORTB = 0x06
#BYTE PORTA_TRIS = 0x85
#BYTE PORTB_TRIS = 0x86
#DEFINE RDD_DATA  PIN_B7
#DEFINE RDD_CLOCK PIN_B6
#DEFINE EEPROM_SCL PIN_A2
#DEFINE EEPROM_SDA PIN_A3
//
void fConfigurar_puertos(void);
void fRDD_send_data0(void);
void fRDD_send_data1(void);
int8 ds=100;
int8 d=ds/100;
//--------------------------------------------------
//Main----------------------------------------------
//--------------------------------------------------
void main(){
  int8 i,j;


  fConfigurar_puertos();
  output_low(RDD_CLOCK); //RELOJ = Bajo


  while (TRUE){
  PORTB = 0b110;                       //Filas
  
//*********************//Generador Clock Data//
     for (i=0;i<3;i++) { fRDD_send_data0();
        for (j=0;j<4;j++) {
            fRDD_send_data1();
           }
        output_low(RDD_CLOCK); 
//*********************//Generador Clock Data//

        PORTB = (PORTB <<1) +1;        //Filas
     } 

  }//Fin while
}//Fin main

//--------------------------------------------------
//- FUNCIONES-
//--------------------------------------------------
void fConfigurar_puertos(void){
  PORTA_TRIS = 0b00001100; //1=ENTRADA, 0=SALIDA
  PORTB_TRIS = 0b00000000; //1=ENTRADA, 0=SALIDA
  setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
  port_b_pullups(TRUE);

}

void fRDD_send_data0(void){
  output_low(RDD_DATA); 
  delay_ms(d);
  output_high(RDD_CLOCK);
  delay_ms(ds);
  output_high(RDD_DATA);
  output_low(RDD_CLOCK); 
  delay_ms(d);
  output_high(RDD_CLOCK);
  delay_ms(ds);
}

void fRDD_send_data1(void){

  output_low(RDD_CLOCK);
  delay_ms(d);
  output_high(RDD_CLOCK);
  delay_ms(ds);


}
 
Última edición:
Atrás
Arriba