TECLADO DISPLAY

Dependencies:   mbed

Committer:
micro_IPN_JLL
Date:
Wed Oct 30 21:13:30 2019 +0000
Revision:
1:af2f0021bf9b
Parent:
0:583269628e14
TECLADO DISPLAY

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Antulius 0:583269628e14 1 #include "stm32f103c8t6.h"
Antulius 0:583269628e14 2 #include "mbed.h"
micro_IPN_JLL 1:af2f0021bf9b 3
micro_IPN_JLL 1:af2f0021bf9b 4 BusOut display(PB_4,PB_3,PA_15,PA_12,PA_11,PA_10,PA_9,PA_8);
micro_IPN_JLL 1:af2f0021bf9b 5 BusOut multiplexaje(PA_3,PA_2,PA_1,PA_0);
micro_IPN_JLL 1:af2f0021bf9b 6 BusIn entrada(PB_0,PB_1,PB_10,PB_11);
micro_IPN_JLL 1:af2f0021bf9b 7 BusOut salida(PB_6,PB_7,PB_8,PB_9);
micro_IPN_JLL 1:af2f0021bf9b 8
Antulius 0:583269628e14 9
micro_IPN_JLL 1:af2f0021bf9b 10 uint8_t Numero[4][4]=
micro_IPN_JLL 1:af2f0021bf9b 11 {
micro_IPN_JLL 1:af2f0021bf9b 12 {0x42,0xB6,0xBC,0xFA},
micro_IPN_JLL 1:af2f0021bf9b 13 {0xD8,0xEC,0xEE,0xCE},
micro_IPN_JLL 1:af2f0021bf9b 14 {0x38,0xFE,0xFC,0x86},
micro_IPN_JLL 1:af2f0021bf9b 15 {0x80,0x7E,0xFA,0x9E}
micro_IPN_JLL 1:af2f0021bf9b 16 };
micro_IPN_JLL 1:af2f0021bf9b 17
micro_IPN_JLL 1:af2f0021bf9b 18 uint8_t catodo[]=
micro_IPN_JLL 1:af2f0021bf9b 19 {
micro_IPN_JLL 1:af2f0021bf9b 20 //0b0001,0b0010,0b0100,0b1000
micro_IPN_JLL 1:af2f0021bf9b 21 0x01,0x02,0x04,0x08
micro_IPN_JLL 1:af2f0021bf9b 22 };
micro_IPN_JLL 1:af2f0021bf9b 23
micro_IPN_JLL 1:af2f0021bf9b 24 uint8_t fila[]=
micro_IPN_JLL 1:af2f0021bf9b 25 {
micro_IPN_JLL 1:af2f0021bf9b 26 0x01,0x02,0x04,0x08
micro_IPN_JLL 1:af2f0021bf9b 27 };
Antulius 0:583269628e14 28
micro_IPN_JLL 1:af2f0021bf9b 29 uint8_t columna[]=
micro_IPN_JLL 1:af2f0021bf9b 30 {
micro_IPN_JLL 1:af2f0021bf9b 31 //0b0001,0b0010,0b0100,0b1000
micro_IPN_JLL 1:af2f0021bf9b 32 0x01,0x02,0x04,0x08
micro_IPN_JLL 1:af2f0021bf9b 33 };
micro_IPN_JLL 1:af2f0021bf9b 34
micro_IPN_JLL 1:af2f0021bf9b 35 void Encender(int C,int F);
micro_IPN_JLL 1:af2f0021bf9b 36
micro_IPN_JLL 1:af2f0021bf9b 37 int main()
micro_IPN_JLL 1:af2f0021bf9b 38 {
micro_IPN_JLL 1:af2f0021bf9b 39
micro_IPN_JLL 1:af2f0021bf9b 40 while(1)
micro_IPN_JLL 1:af2f0021bf9b 41 {
micro_IPN_JLL 1:af2f0021bf9b 42 for(int i=0; i<4; i++)
micro_IPN_JLL 1:af2f0021bf9b 43 {
micro_IPN_JLL 1:af2f0021bf9b 44 salida=columna[i];
micro_IPN_JLL 1:af2f0021bf9b 45
micro_IPN_JLL 1:af2f0021bf9b 46 if(entrada!=0)
micro_IPN_JLL 1:af2f0021bf9b 47 {
micro_IPN_JLL 1:af2f0021bf9b 48 if(entrada==fila[0])
micro_IPN_JLL 1:af2f0021bf9b 49 {
micro_IPN_JLL 1:af2f0021bf9b 50 Encender(i,0);
micro_IPN_JLL 1:af2f0021bf9b 51 }else if(entrada==fila[1])
micro_IPN_JLL 1:af2f0021bf9b 52 {
micro_IPN_JLL 1:af2f0021bf9b 53 Encender(i,1);
micro_IPN_JLL 1:af2f0021bf9b 54 }else if(entrada==fila[2])
micro_IPN_JLL 1:af2f0021bf9b 55 {
micro_IPN_JLL 1:af2f0021bf9b 56 Encender(i,2);
micro_IPN_JLL 1:af2f0021bf9b 57 }else if(entrada==fila[3])
micro_IPN_JLL 1:af2f0021bf9b 58 {
micro_IPN_JLL 1:af2f0021bf9b 59 Encender(i,3);
micro_IPN_JLL 1:af2f0021bf9b 60 }
micro_IPN_JLL 1:af2f0021bf9b 61 }
micro_IPN_JLL 1:af2f0021bf9b 62 }
Antulius 0:583269628e14 63 }
Antulius 0:583269628e14 64 }
Antulius 0:583269628e14 65
Antulius 0:583269628e14 66
micro_IPN_JLL 1:af2f0021bf9b 67 void Encender(int C,int F)
micro_IPN_JLL 1:af2f0021bf9b 68 {
micro_IPN_JLL 1:af2f0021bf9b 69 multiplexaje=catodo[0];
micro_IPN_JLL 1:af2f0021bf9b 70
micro_IPN_JLL 1:af2f0021bf9b 71 display=Numero[F][C];
micro_IPN_JLL 1:af2f0021bf9b 72 wait_ms(200);
micro_IPN_JLL 1:af2f0021bf9b 73
micro_IPN_JLL 1:af2f0021bf9b 74 multiplexaje=0x00;
micro_IPN_JLL 1:af2f0021bf9b 75 display=0x00;
micro_IPN_JLL 1:af2f0021bf9b 76 }