Показать сообщение отдельно
Старый 24.03.2021, 08:29   #9
gendos76
Вступил в клуб
 
Регистрация: 11.01.2015
Сообщений: 76
По умолчанию Re: Брелок Alligator

void LCD_Init(void){
LP3 = 0; LP2 =1; LP1 = 1; LP0 = 0;
SE2 = 1; SE3 = 1; SE4 = 1; SE5 = 1; SE6 = 1; SE7 = 1;SE8 = 1;SE9 = 1;SE11 = 1;
SE15 = 1; SE16 = 1; SE17 = 1; SE18 = 1; SE19 = 1; SE20 = 1; SE21 = 1;SE22 = 1;SE23 = 0;
SE24 = 0;SE25 = 0;SE26 = 0;SE27 = 0;
LMUX0 = 1; LMUX1 =1;CS1 = 1; CS0 = 0; SLPEN = 0;
LCDIE=0;LCDIF=0;
VLCDEN = 0;LCDEN = 1; WFT = 0; BIASMD = 0;WA=1;LCDA=1;
}
//Настройка LCD
//Четырёхкратное мультиплексирование, 1/3 Bias



void clear_lcd(void)
{
LCDDATA0=0;
LCDDATA1=0;
LCDDATA2=0;
LCDDATA3=0;
LCDDATA4=0;
LCDDATA5=0;
LCDDATA6=0;
LCDDATA7=0;
LCDDATA8=0;
LCDDATA9=0;
LCDDATA10=0;
LCDDATA11=0;
}


void lcd_char(unsigned char byte, unsigned char digit)
{
//Вывод символа на дисплей

switch(digit)
{
case 1:ClearBit(LCDDATA0,4); ClearBit(LCDDATA3,3); ClearBit(LCDDATA3,4); ClearBit(LCDDATA6,3);
ClearBit(LCDDATA6,4); ClearBit(LCDDATA9,3); ClearBit(LCDDATA9,4); break;

case 2:ClearBit(LCDDATA0,6); ClearBit(LCDDATA3,5); ClearBit(LCDDATA3,6); ClearBit(LCDDATA6,5);
ClearBit(LCDDATA6,6); ClearBit(LCDDATA9,5); ClearBit(LCDDATA9,6); break;

case 3:ClearBit(LCDDATA1,0); ClearBit(LCDDATA3,7); ClearBit(LCDDATA4,0); ClearBit(LCDDATA6,7);
ClearBit(LCDDATA7,0); ClearBit(LCDDATA9,7); ClearBit(LCDDATA10,0); break;

case 4:ClearBit(LCDDATA1,3); ClearBit(LCDDATA4,1); ClearBit(LCDDATA4,3); ClearBit(LCDDATA7,1);
ClearBit(LCDDATA7,3); ClearBit(LCDDATA10,1); ClearBit(LCDDATA10,3); break;

default: break;
}


if(BitIsSet(byte, 7))
{
switch(digit)
{
case 1: SetBit(LCDDATA9,3); break;
case 2: SetBit(LCDDATA9,5); break;
case 3: SetBit(LCDDATA9,7); break;
case 4: SetBit(LCDDATA10,1); break;
default: break;
}
}

if(BitIsSet(byte, 6))
{
switch(digit)
{
case 1: SetBit(LCDDATA6,3); break;
case 2: SetBit(LCDDATA6,5); break;
case 3: SetBit(LCDDATA6,7); break;
case 4: SetBit(LCDDATA7,1); break;
default: break;
}
}

if(BitIsSet(byte, 5))
{
switch(digit)
{
case 1: SetBit(LCDDATA3,3); break;
case 2: SetBit(LCDDATA3,5); break;
case 3: SetBit(LCDDATA3,7); break;
case 4: SetBit(LCDDATA4,1); break;
default: break;
}
}

if(BitIsSet(byte, 4))
{
switch(digit)
{
case 1: SetBit(LCDDATA0,4); break;
case 2: SetBit(LCDDATA0,6); break;
case 3: SetBit(LCDDATA1,0); break;
case 4: SetBit(LCDDATA1,3); break;
default: break;
}
}

if(BitIsSet(byte, 3))
{
switch(digit)
{
case 1: SetBit(LCDDATA9,4); break;
case 2: SetBit(LCDDATA9,6); break;
case 3: SetBit(LCDDATA10,0); break;
case 4: SetBit(LCDDATA10,3); break;
default: break;
}
}

if(BitIsSet(byte, 2))
{
switch(digit)
{
case 1: SetBit(LCDDATA6,4); break;
case 2: SetBit(LCDDATA6,6); break;
case 3: SetBit(LCDDATA7,0); break;
case 4: SetBit(LCDDATA7,3); break;
default: break;
}
}


if(BitIsSet(byte, 1))
{
switch(digit)
{
case 1: SetBit(LCDDATA3,4); break;
case 2: SetBit(LCDDATA3,6); break;
case 3: SetBit(LCDDATA4,0); break;
case 4: SetBit(LCDDATA4,3); break;
default: break;
}
}
}


void lcd_Scan(){
lcd_char(0xDA,1); //S
lcd_char(0x70,2); //C
lcd_char(0xEE,3); //A
lcd_char(0x62,4); //n
}
//================================================== ============================================



//================================================== =====================================
//Карта сегментов дисплея
//================================================== =====================================
#define LCD_EYES SEG2COM0
#define LCD_MOLOTOK SEG5COM0
#define LCD_MOLOTOK2 SEG3COM0
#define LCD_KEY_LOCK SEG17COM0
#define LCD_VALET SEG18COM0
#define LCD_SAVE SEG19COM0
#define LCD_MELODY SEG20COM0
#define LCD_ANTENNA SEG20COM3
#define LCD_ANT_TX SEG21COM3
#define LCD_ANT_RX SEG22COM3
#define LCD_ZAMOK SEG17COM2
#define LCD_ZAMOK_LOCK SEG17COM3
#define LCD_BATTERY0 SEG15COM1
#define LCD_BATTERY1 SEG15COM3
#define LCD_BATTERY2 SEG15COM0
#define LCD_BATTERY3 SEG15COM2
#define LCD_BELL SEG2COM3 //колокольчик
#define LCD_KAPOT SEG2COM1
#define LCD_GUN SEG17COM1
#define LCD_KEY SEG18COM1 //Ключ
#define LCD_VIBRO SEG21COM1 //Вибро
#define LCD_DOOR SEG19COM2 //Дверь
#define LCD_VIHLOP1 SEG21COM2 //Выхлоп1
#define LCD_BAG SEG20COM2 //Багажник
#define LCD_SIRENA SEG16COM1 //Сирена
#define LCD_IMMO SEG18COM2 //Значок IMMO
#define LCD_SPUTNIK SEG16COM2 //Спутник GSM
#define LCD_ARM SEG18COM3
#define LCD_DIS SEG19COM3
#define LCD_MOL_RAM SEG22COM1
#define LCD_PIN_CODE SEG20COM1
#define LCD_AUTO_ARM SEG17COM0
#define LCD_TOCHKI SEG7COM0

Последний раз редактировалось gendos76; 24.03.2021 в 08:32.
gendos76 вне форума   Ответить с цитированием