Заказал я тут несколько LCD с разными драйверами. Хочу подключить к контроллеру.
Начну с LCD TIC5234:
Драйвер ML1001.
5 цифр + спец символы.
LCD TIC5234 и PIC
Сообщений 1 страница 4 из 4
Поделиться12008-02-23 19:21:38
Поделиться22008-02-23 19:33:33
MPLAB IDE версия 7.52
mcc18 версия 3.15
Кто плохо читает по английски могу только посочувствовать.
Писать комментарии на русском не имеет смысла, так как при переносе исходника на другой компьютер, или при просмотре его в редакторах без поддержки русского языка(что встречается довольно часто), читать кракозябры все же хуже чем английский, согласитесь.
/*Pin for - Load data from the shift register to data register;*/ #define D_LOAD_L DDRBbits.RB7=0; LATBbits.LATB7=0; #define D_LOAD_H DDRBbits.RB7=0; LATBbits.LATB7=1; /*Display data input pin;*/ #define D_IN_L DDRBbits.RB5=0; LATBbits.LATB5=0; #define D_IN_H DDRBbits.RB5=0; LATBbits.LATB5=1; /*Pin for the clock of the display data;*/ #define D_CLK_L DDRBbits.RB6=0; LATBbits.LATB6=0; #define D_CLK_H DDRBbits.RB6=0; LATBbits.LATB6=1; /*Bit fields for LCD5234 according to digits in LCD5231*/ volatile union{ struct{ unsigned :1; unsigned S_45:1; unsigned S_41:1; unsigned S_46:1; unsigned S_39:1; unsigned S_40:1; unsigned S_42:1; unsigned S_44:1; }; volatile unsigned char digit_5; } digit_5_5234bits; ////////////////////// volatile union{ struct{ unsigned :1; unsigned S_36:1; unsigned S_33:1; unsigned S_38:1; unsigned S_30:1; unsigned S_32:1; unsigned S_34:1; unsigned S_35:1; }; volatile unsigned char digit_4; } digit_4_5234bits; ////////////////////// volatile union{ struct{ unsigned :1; unsigned S_28:1; unsigned S_24:1; unsigned S_29:1; unsigned S_22:1; unsigned S_23:1; unsigned S_25:1; unsigned S_27:1; }; volatile unsigned char digit_3; } digit_3_5234bits; ////////////////////// volatile union{ struct{ unsigned :1; unsigned S_19:1; unsigned S_16:1; unsigned S_20:1; unsigned S_14:1; unsigned S_15:1; unsigned S_17:1; unsigned S_18:1; }; volatile unsigned char digit_2; } digit_2_5234bits; ////////////////////// volatile union { struct{ unsigned :1; unsigned S_8:1; unsigned S_5:1; unsigned S_13:1; unsigned S_3:1; unsigned S_4:1; unsigned S_6:1; unsigned S_7:1; }; unsigned char digit_1; }digit_1_5234bits; /*Bit field for dots LCD5234*/ volatile union{ struct { unsigned :3; unsigned S_47_5:1; unsigned S_48_4:1; unsigned S_49_3:1; unsigned S_1_2:1; unsigned S_2_1:1; }; volatile unsigned char dots_5234; } dots_5234bits ; /*Bit fields for special symbols LCD5234*/ volatile union{ struct{ unsigned :4; unsigned S_11_3:1; unsigned S_10_2:1; unsigned S_12_1:1; unsigned S_9_envelop:1; }; volatile unsigned char battery_5234; } battery_5234bits; ////////////////////// volatile union{ struct{ unsigned :3; unsigned S_43_oC:1; unsigned S_37_kgs_cm2:1; unsigned S_31_MPa:1; unsigned S_26_kPa:1; unsigned S_21_RH:1; }; volatile unsigned char symbols_5234; } symbols_5234bits; /*Union for transposition bits according to specification ML1001(S49_S2)*/ union segments{ struct{ unsigned Sg_7:1; unsigned Sg_6:1; unsigned Sg_5:1; unsigned Sg_4:1; unsigned Sg_3:1; unsigned Sg_2:1; unsigned Sg_1:1; unsigned Sg_0:1; }; volatile unsigned char seg_bits; }; volatile union segments LCD_5234[6]; /*Transposition bits according to specification ML1001(S49_S2)*/ void LCD_conversion(void){ ////////////////////////////////// LCD_5234[0].Sg_0 = dots_5234bits.S_2_1; LCD_5234[0].Sg_1 = digit_1_5234bits.S_3; LCD_5234[0].Sg_2 = digit_1_5234bits.S_4; LCD_5234[0].Sg_3 = digit_1_5234bits.S_5; LCD_5234[0].Sg_4 = digit_1_5234bits.S_6; LCD_5234[0].Sg_5 = digit_1_5234bits.S_7; LCD_5234[0].Sg_6 = digit_1_5234bits.S_8; LCD_5234[0].Sg_7 = battery_5234bits.S_9_envelop; ////////////////////////////////// LCD_5234[1].Sg_0 = battery_5234bits.S_10_2; LCD_5234[1].Sg_1 = battery_5234bits.S_11_3; LCD_5234[1].Sg_2 = battery_5234bits.S_12_1; LCD_5234[1].Sg_3 = digit_1_5234bits.S_13; LCD_5234[1].Sg_4 = digit_2_5234bits.S_14; LCD_5234[1].Sg_5 = digit_2_5234bits.S_15; LCD_5234[1].Sg_6 = digit_2_5234bits.S_16; LCD_5234[1].Sg_7 = digit_2_5234bits.S_17; /////////////////////////////////// LCD_5234[2].Sg_0 = digit_2_5234bits.S_18; LCD_5234[2].Sg_1 = digit_2_5234bits.S_19; LCD_5234[2].Sg_2 = digit_2_5234bits.S_20; LCD_5234[2].Sg_3 = symbols_5234bits.S_21_RH; LCD_5234[2].Sg_4 = digit_3_5234bits.S_22; LCD_5234[2].Sg_5 = digit_3_5234bits.S_23; LCD_5234[2].Sg_6 = digit_3_5234bits.S_24; LCD_5234[2].Sg_7 = digit_3_5234bits.S_25; /////////////////////////////////// LCD_5234[3].Sg_0 = symbols_5234bits.S_26_kPa; LCD_5234[3].Sg_1 = digit_3_5234bits.S_27; LCD_5234[3].Sg_2 = digit_3_5234bits.S_28; LCD_5234[3].Sg_3 = digit_3_5234bits.S_29; LCD_5234[3].Sg_4 = digit_4_5234bits.S_30; LCD_5234[3].Sg_5 = symbols_5234bits.S_31_MPa; LCD_5234[3].Sg_6 = digit_4_5234bits.S_32; LCD_5234[3].Sg_7 = digit_4_5234bits.S_33; /////////////////////////////////// LCD_5234[4].Sg_0 = digit_4_5234bits.S_34; LCD_5234[4].Sg_1 = digit_4_5234bits.S_35; LCD_5234[4].Sg_2 = digit_4_5234bits.S_36; LCD_5234[4].Sg_3 = symbols_5234bits.S_37_kgs_cm2; LCD_5234[4].Sg_4 = digit_4_5234bits.S_38; LCD_5234[4].Sg_5 = digit_5_5234bits.S_39; LCD_5234[4].Sg_6 = digit_5_5234bits.S_40; LCD_5234[4].Sg_7 = digit_5_5234bits.S_41; /////////////////////////////////// LCD_5234[5].Sg_0 = digit_5_5234bits.S_42; LCD_5234[5].Sg_1 = symbols_5234bits.S_43_oC; LCD_5234[5].Sg_2 = digit_5_5234bits.S_44; LCD_5234[5].Sg_3 = digit_5_5234bits.S_45; LCD_5234[5].Sg_4 = digit_5_5234bits.S_46; LCD_5234[5].Sg_5 = dots_5234bits.S_47_5; LCD_5234[5].Sg_6 = dots_5234bits.S_48_4; LCD_5234[5].Sg_7 = dots_5234bits.S_49_3; //////////////////////////////////// } /*DELAY depend from frequency of your resonator*/ void LCD_ML1001_Sst(unsigned char digit_1, unsigned char digit_2, unsigned char digit_3, unsigned char digit_4, unsigned char digit_5, unsigned char dots, unsigned char ssimv, unsigned char battery){ char i,temp, n; digit_1_5234bits.digit_1 = digit_1; digit_2_5234bits.digit_2 = digit_2; digit_3_5234bits.digit_3 = digit_3; digit_4_5234bits.digit_4 = digit_4; digit_5_5234bits.digit_5 = digit_5; dots_5234bits.dots_5234 = dots; symbols_5234bits.symbols_5234 = ssimv; battery_5234bits.battery_5234 = battery; LCD_conversion(); D_CLK_L D_LOAD_L for(n = 5; n >= 0; n--){ for(i = 0; i <= 7; i++){ temp = (LCD_5234[n].seg_bits >> i); if(temp & 0x01){ D_IN_H D_CLK_H Nop();//DELAY D_CLK_L D_IN_L }else{ D_IN_L D_CLK_H Nop();//DELAY D_CLK_L } } } if(dots_5234bits.S_1_2){ D_IN_H D_CLK_H Nop();//DELAY D_CLK_L }else{ D_IN_L D_CLK_H Nop();//DELAY D_CLK_L } D_LOAD_H Nop();//DELAY D_LOAD_L } void main(void){ unsigned char Digits_523x[10]={0xfa,0x0a,0xb6,0x9e,0x4e,0xdc,0xfc,0x8a,0xfe,0xde};/*0,1,2,3,4,5,6,7,8,9*/ LCD_ML1001_Sst(Digits_523x[1], Digits_523x[2], Digits_523x[3], Digits_523x[4], Digits_523x[5], 0x00, 0x00, 0x00); }
В железе проверил, все работает, так что.....
Поделиться32008-02-23 19:38:21
Теги code плохо отрабатываются. При предварительном просмотре все было нормально, а сейчас строки в которых более одной табуляции видны вообще без табуляции. Плохо, однако.
Поделиться42008-03-22 20:47:32
Проверка работоспособности тегов code с двойной и более табуляцией в строке.
/*Pin for - Load data from the shift register to data register;*/ #define D_LOAD_L DDRBbits.RB7=0; LATBbits.LATB7=0; #define D_LOAD_H DDRBbits.RB7=0; LATBbits.LATB7=1; /*Display data input pin;*/ #define D_IN_LDDRBbits.RB5=0; LATBbits.LATB5=0; #define D_IN_HDDRBbits.RB5=0; LATBbits.LATB5=1; /*Pin for the clock of the display data;*/ #define D_CLK_LDDRBbits.RB6=0; LATBbits.LATB6=0; #define D_CLK_HDDRBbits.RB6=0; LATBbits.LATB6=1; /*Bit fields for LCD5234 according to digits in LCD5231*/ volatile union{ struct{ unsigned :1; unsigned S_45:1; unsigned S_41:1; unsigned S_46:1; unsigned S_39:1; unsigned S_40:1; unsigned S_42:1; unsigned S_44:1; }; volatile unsigned char digit_5; } digit_5_5234bits; ////////////////////// volatile union{ struct{ unsigned :1; unsigned S_36:1; unsigned S_33:1; unsigned S_38:1; unsigned S_30:1; unsigned S_32:1; unsigned S_34:1; unsigned S_35:1; }; volatile unsigned char digit_4; } digit_4_5234bits; ////////////////////// volatile union{ struct{ unsigned :1; unsigned S_28:1; unsigned S_24:1; unsigned S_29:1; unsigned S_22:1; unsigned S_23:1; unsigned S_25:1; unsigned S_27:1; }; volatile unsigned char digit_3; } digit_3_5234bits; ////////////////////// volatile union{ struct{ unsigned :1; unsigned S_19:1; unsigned S_16:1; unsigned S_20:1; unsigned S_14:1; unsigned S_15:1; unsigned S_17:1; unsigned S_18:1; }; volatile unsigned char digit_2; } digit_2_5234bits; ////////////////////// volatile union { struct{ unsigned :1; unsigned S_8:1; unsigned S_5:1; unsigned S_13:1; unsigned S_3:1; unsigned S_4:1; unsigned S_6:1; unsigned S_7:1; }; unsigned char digit_1; }digit_1_5234bits; /*Bit field for dots LCD5234*/ volatile union{ struct { unsigned :3; unsigned S_47_5:1; unsigned S_48_4:1; unsigned S_49_3:1; unsigned S_1_2:1; unsigned S_2_1:1; }; volatile unsigned char dots_5234; } dots_5234bits ; /*Bit fields for special symbols LCD5234*/ volatile union{ struct{ unsigned :4; unsigned S_11_3:1; unsigned S_10_2:1; unsigned S_12_1:1; unsigned S_9_envelop:1; }; volatile unsigned char battery_5234; } battery_5234bits; ////////////////////// volatile union{ struct{ unsigned :3; unsigned S_43_oC:1; unsigned S_37_kgs_cm2:1; unsigned S_31_MPa:1; unsigned S_26_kPa:1; unsigned S_21_RH:1; }; volatile unsigned char symbols_5234; } symbols_5234bits; /*Union for transposition bits according to specification ML1001(S49_S2)*/ union segments{ struct{ unsigned Sg_0:1; unsigned Sg_1:1; unsigned Sg_2:1; unsigned Sg_3:1; unsigned Sg_4:1; unsigned Sg_5:1; unsigned Sg_6:1; unsigned Sg_7:1; }; volatile unsigned char seg_bits; }; volatile union segments LCD_5234[6]; /*Transposition bits according to specification ML1001(S49_S2)*/ void LCD_conversion(void){ ////////////////////////////////// LCD_5234[0].Sg_7 = dots_5234bits.S_2_1; LCD_5234[0].Sg_6 = digit_1_5234bits.S_3; LCD_5234[0].Sg_5 = digit_1_5234bits.S_4; LCD_5234[0].Sg_4 = digit_1_5234bits.S_5; LCD_5234[0].Sg_3 = digit_1_5234bits.S_6; LCD_5234[0].Sg_2 = digit_1_5234bits.S_7; LCD_5234[0].Sg_1 = digit_1_5234bits.S_8; LCD_5234[0].Sg_0 = battery_5234bits.S_9_envelop; ////////////////////////////////// LCD_5234[1].Sg_7 = battery_5234bits.S_10_2; LCD_5234[1].Sg_6 = battery_5234bits.S_11_3; LCD_5234[1].Sg_5 = battery_5234bits.S_12_1; LCD_5234[1].Sg_4 = digit_1_5234bits.S_13; LCD_5234[1].Sg_3 = digit_2_5234bits.S_14; LCD_5234[1].Sg_2 = digit_2_5234bits.S_15; LCD_5234[1].Sg_1 = digit_2_5234bits.S_16; LCD_5234[1].Sg_0 = digit_2_5234bits.S_17; /////////////////////////////////// LCD_5234[2].Sg_7 = digit_2_5234bits.S_18; LCD_5234[2].Sg_6 = digit_2_5234bits.S_19; LCD_5234[2].Sg_5 = digit_2_5234bits.S_20; LCD_5234[2].Sg_4 = symbols_5234bits.S_21_RH; LCD_5234[2].Sg_3 = digit_3_5234bits.S_22; LCD_5234[2].Sg_2 = digit_3_5234bits.S_23; LCD_5234[2].Sg_1 = digit_3_5234bits.S_24; LCD_5234[2].Sg_0 = digit_3_5234bits.S_25; /////////////////////////////////// LCD_5234[3].Sg_7 = symbols_5234bits.S_26_kPa; LCD_5234[3].Sg_6 = digit_3_5234bits.S_27; LCD_5234[3].Sg_5 = digit_3_5234bits.S_28; LCD_5234[3].Sg_4 = digit_3_5234bits.S_29; LCD_5234[3].Sg_3 = digit_4_5234bits.S_30; LCD_5234[3].Sg_2 = symbols_5234bits.S_31_MPa; LCD_5234[3].Sg_1 = digit_4_5234bits.S_32; LCD_5234[3].Sg_0 = digit_4_5234bits.S_33; /////////////////////////////////// LCD_5234[4].Sg_7 = digit_4_5234bits.S_34; LCD_5234[4].Sg_6 = digit_4_5234bits.S_35; LCD_5234[4].Sg_5 = digit_4_5234bits.S_36; LCD_5234[4].Sg_4 = symbols_5234bits.S_37_kgs_cm2; LCD_5234[4].Sg_3 = digit_4_5234bits.S_38; LCD_5234[4].Sg_2 = digit_5_5234bits.S_39; LCD_5234[4].Sg_1 = digit_5_5234bits.S_40; LCD_5234[4].Sg_0 = digit_5_5234bits.S_41; /////////////////////////////////// LCD_5234[5].Sg_7 = digit_5_5234bits.S_42; LCD_5234[5].Sg_6 = symbols_5234bits.S_43_oC; LCD_5234[5].Sg_5 = digit_5_5234bits.S_44; LCD_5234[5].Sg_4 = digit_5_5234bits.S_45; LCD_5234[5].Sg_3 = digit_5_5234bits.S_46; LCD_5234[5].Sg_2 = dots_5234bits.S_47_5; LCD_5234[5].Sg_1 = dots_5234bits.S_48_4; LCD_5234[5].Sg_0 = dots_5234bits.S_49_3; //////////////////////////////////// } /*DELAY depend from frequency of your resonator*/ void LCD_ML1001_Sst(unsigned char digit_1, unsigned char digit_2, unsigned char digit_3, unsigned char digit_4, unsigned char digit_5, unsigned char dots, unsigned char ssimv, unsigned char battery){ char i,temp, n; digit_1_5234bits.digit_1 = digit_1; digit_2_5234bits.digit_2 = digit_2; digit_3_5234bits.digit_3 = digit_3; digit_4_5234bits.digit_4 = digit_4; digit_5_5234bits.digit_5 = digit_5; dots_5234bits.dots_5234 = dots; symbols_5234bits.symbols_5234 = ssimv; battery_5234bits.battery_5234 = battery; LCD_conversion(); D_CLK_L D_LOAD_L for(n = 5; n >= 0; n--){ for(i = 0; i <= 7; i++){ temp = (LCD_5234[n].seg_bits >> i); if(temp & 0x01){ D_IN_H D_CLK_H Nop();//DELAY D_CLK_L D_IN_L }else{ D_IN_L D_CLK_H Nop();//DELAY D_CLK_L } } } if(dots_5234bits.S_1_2){ D_IN_H D_CLK_H Nop();//DELAY D_CLK_L }else{ D_IN_L D_CLK_H Nop();//DELAY D_CLK_L } D_LOAD_H Nop();//DELAY D_LOAD_L } void main(void){ unsigned char Digits_523x[10]={0xbe,0xa0,0xda,0xf2,0xe4,0x76,0x7e,0xa2,0xfe,0xf6};/*0,1,2,3,4,5,6,7,8,9*/ OSCCONbits.IRCF2 = 1;// OSCCONbits.IRCF1 = 0;// 1MHz ?? OSCCONbits.IRCF0 = 0;// //LCD_5231/S1_S2_S2_S4_S5_S6_S7_NULL; S15, S30 - DOTS; S38 - LEFT ONE; S39 - 'minus'; S40 -'UP MINUS'//LCD_5231// LCD_ML1001_Sst(Digits_523x[1], Digits_523x[2], Digits_523x[3], Digits_523x[4], Digits_523x[5], 0xff, 0xff, 0xff); }
Сообщение создано для админов тех. поддержки, дабы они убедились в неработоспособности(или неправильной работе) тегов code. Хочется верить что данный факт не останется без внимания.
Но просмотрев форум поддержки появилась такая ИМХА: Ничего не будет, работает и ладно, если не устраивает - переезжайте на платный хост, а нам и так неплохо.
Похожие темы
LCD TIC5231 и PIC | Контроллеры и Компьютеры. | 2008-05-03 |