#include <LPC214x.h>
#include "rtc.h"
#include "stdutils.h"
#include "systemInit.h"
#include "uart.h"
#include "type.h"
#include "stdio.h"
#define led 0x00100000
void out_time1(uint8_t *p);
void out_time(uint8_t *p);
void DELAY_us(unsigned int count);
void DELAY_ms(unsigned int count);
void I2C_START(void);
void I2C_STOP( void );
void I2C_WRITE( char data );
void I2C_INIT(void);
void data1(uint8_t *ptr,uint8_t n);
void i2c_clr();
void i2c_clr1();
unsigned char hex2bcd (unsigned char x);
int from_hex(uint16_t h);
int get_line (char* buff, int len );
char *ptr2,bb;
uint8_t b1;
long p1, p2, p3;
uint8_t *ptr;
uint8_t k;
uint16_t res,b,i;
uint16_t s1, s2, cnt;
char Line[127];
BYTE buf[0x40];
__irq void clk (void);
__irq void uart0_ISR(void);
char q;
long int V;
char ch;
uint8_t tik;
rtc_t rtc;
char buf_clr[127]={0x70,0xC8,0xE0,0x00,0};
char buf_clr1[40]={0x70,0xC8,0xE1,0x0A,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
char buf_txt[40]={0};
char buf_cmd[]={0x70,0xC8,0xE1,0x0A};
uint8_t num[12]={0xD7,0x06,0xE3,0xA7,0x36,0xB5,0xF5,0x07,0xF7,0xB7,0x08};//.
char buf2[]={0x70,0xC8,0xE1,0x0A,
0x01,0x00,
0x02,0x00,
0x04,0x00,
0x08,0x00,
0x10,0x00,
0x20,0x00,
0x40,0x00,
0x80,0x00,
0x00,0x01,
0x00,0x02,
0x00,0x04,
0x00,0x08,
0x00,0x10,
0x00,0x20,
0x00,0x40,
0x00,0x80,
0xFF,0xFF,0,0};
uint16_t buf3[40][2]={
0xD083,48,//0
0x0003,49,//1
0x94A1,50,//2
0x14A3,51,//3
0x4423,52,//4
0x54A2,53,//5
0xD4A2,54,//6
0x1003,55,//7
0xD4A3,56,//8
0x54A3,57,//9
0xD080,145,//Ñ
0xD003,143,//Ï
0xD421,144,//Ð
0xD083,142,//Î
0xD000,131,//Ã
0x5C23,159,//ß
0x2814,149,//Õ
0x1494,135,//Ç
0xC08B,150,//Ö
0xD423,128,//À
0xD4A0,133,//Å
0x2A54,134,//Æ
0xC813,136,//È
0xD4A2,129,//Á
0xC4A2,156,//Ü
0xD4B2,130,//Â ?
0xC414,138,//Ê
0x4423,151,//×,4
0x1240,147,//Ò
0xC2C3,152,//Ø
0xC2CB,153,//Ù
0xE013,140,//M
0x0813,139,//Ë
0xC423,141,//Í
0x0000,' ',//9
0,0};
uint8_t buf5[13][2]=
{
0xD7,48,//0
0x06,49,//1
0xE3,50,//2
0xA7,51,//3
0x36,52,//4
0xB5,53,//5
0xF5,54,//6
0x07,55,//7
0xF7,56,//8
0xB7,57,//9
0xE4,'.',//9
0x00,' ',//9
0,0
};
int main()
{
SystemInit();
RTC_Init();
UARTInit(115200);
I2C_INIT();
rtc.hour = 2; // 10:40:20 am
rtc.min = 2;
rtc.sec = 0;
rtc.date = 21; //1st Jan 2016
rtc.month = 1;
rtc.year = 2021;
rtc.weekDay = 4; // Friday: 5th day of week considering monday as first day.
RTC_SetDateTime(&rtc); // 10:40:20 am, 1st Jan 2016
U0IER=0x41; //interrapt enable 0x01, recive enble
IO0DIR |= (1<<20); //
q=1;
VICVectAddr2 = (unsigned) uart0_ISR;
VICIntEnable =(1 << 6);
VICVectCntl2 = (1 << 5) | 6;
VICVectAddr3 = (unsigned)clk; //Pointer Interrupt Function (ISR)
VICVectCntl3 = (1<<5) | 13; //(bit 5 = 1)->to enable Vectored IRQ slot 1//bit[4:0]) -> this the source int number
VICIntEnable = (1<<13); // Enable RTC interrupt
tik=0;
i2c_clr();i2c_clr1();
while(1)
{
while (tik==0){};
RTC_GetDateTime(&rtc);
sprintf(Line,"%02u ",rtc.hour);
if (q==0)
{sprintf(Line+2,"%1s",".");}
else
{sprintf(Line+2,"%1s"," ");}
sprintf(Line+3,"%02u",rtc.min);
sprintf(Line+5,"%3s"," ");
sprintf(Line+8,"%02u",rtc.sec);
out_time((uint8_t*)Line);
sprintf(Line,"%02u ",rtc.date);
sprintf(Line+3,"%02u ",rtc.month);
sprintf(Line+6,"%04u",rtc.year);
out_time1((uint8_t*)Line);
IO0PIN ^= (1<<20);
tik=0;
}}
__irq void uart0_ISR(void)
{
unsigned char i;
uint16_t ii;
VICIntEnable = (0<<13); CCR=0;
U0IER =0;
V = U0IIR; // Read current IR value
ch = Getchar();
RTC_GetDateTime(&rtc);
if (ch=='h')
{
ch = Getchar();
i = ch & 0x0F;
i=i<<4;
ch = Getchar();
i= i |( ch & 0x0F);
rtc.hour = from_hex(i);
ch = Getchar();
i = ch & 0x0F;
i=i<<4;
ch = Getchar();
i= i |( ch & 0x0F);
rtc.min = from_hex(i);
rtc.sec=0;
RTC_SetDateTime(&rtc);
}
else if (ch=='d')
{
ch = Getchar();
i = ch & 0x0F;
i=i<<4;
ch = Getchar();
i= i |( ch & 0x0F);
rtc.date = from_hex(i);
ch = Getchar() ;
i = ch & 0x0F;
i=i<<4;
ch = Getchar();
i= i |( ch & 0x0F);
rtc.month = from_hex(i);
ch = Getchar() ;
i = ch & 0x0F;
i=i<<4;
ch = Getchar();
i= i |( ch & 0x0F);
ii=i<<8;
ch = Getchar() ;
i = ch & 0x0F;
i=i<<4;
ch = Getchar();
i= i |( ch & 0x0F);
ii=ii | i;
rtc.year= from_hex(ii);
RTC_SetDateTime(&rtc);
}
VICIntEnable = (1<<13);CCR=1;
U0IER =0x11;
VICVectAddr = 0x0; // End of interrupt execution
}
__irq void clk(void)
{
long int readVal;
tik=1;
q^=1;
readVal = ILR; // Read current IR value
ILR=readVal; // Read current IR value
VICVectAddr = 0x0; // End of interrupt execution
}
int from_hex(uint16_t h)
{
int d = 0;
int power = 1;
while (h)
{
// assert(h % 16 < 10)
d += (h & 15) * power;
h >>= 4;
power *= 10;
}
return d;
}
void i2c_clr()
{
int i;
I2C_START();
for (i=0;i<sizeof(buf_clr);i++)
{I2C_WRITE( buf_clr[i]);}
I2C_STOP();
}
void i2c_clr1()
{
int i;
I2C_START();
for (i=0;i<sizeof(buf_clr1);i++)
{I2C_WRITE( buf_clr1[i]);}
I2C_STOP();
}
void I2C_INIT(void)
{
PINSEL0 = PINSEL0 | 0x00000050;
I2C0CONSET = 0x40;
I2C0SCLL = 0x64;
I2C0SCLH = 0x64;
}
void I2C_START(void)
{
I2C0CONSET = 0x20; /* Set Start bit for Start condition */
while ( (I2C0CONSET & 0x08) == 0 ); /* Wait till SI = 1 */
I2C0CONCLR = 0x28; /* Clear Start bit and SI bit */
}
void I2C_WRITE( char data )
{
I2C0DAT = data; /* Load data to be written into the data register */
I2C0CONSET = 0x40; /* Enable I2C */
while( (I2C0CONSET & 0x08) == 0 ); /* Wait till SI = 1 */
I2C0CONCLR = 0x08; /* Clear SI bit */
}
unsigned char I2C_READ_ACK( void )
{
I2C0CONSET = 0x44; /* Enable I2C with Acknowledge */
while( (I2C0CONSET & 0x08) == 0 ); /* Wait till SI = 1 */
I2C0CONCLR = 0x0C; /* Clear SI and Acknowledge bits */
return I2C0DAT; /* Return received data */
}
unsigned char I2C_READ_NACK( void )
{
I2C0CONSET = 0x40; /* Enable I2C without Acknowledge */
while( (I2C0CONSET & 0x08) == 0 ); /* Wait till SI = 1 */
I2C0CONCLR = 0x08; /* Clear SI bit */
return I2C0DAT; /* Return received data */
}
void I2C_MULTIREAD( char* arr , int bytes ) /* For reading multiple bytes at a time */
{
BYTE i = 0;
while( ( bytes - 1 ) != 0 )
{
I2C0CONSET = 0x40; /* Enable I2C with Acknowledge */
while( (I2C0CONSET & 0x08) == 0 ); /* Wait till SI = 1 */
I2C0CONCLR = 0x0C; /* Clear SI and Acknowledge bits */
*( arr + i ) = I2C0DAT ;
bytes--;
i++;
}
I2C0CONSET = 0x40; /* Enable I2C without Acknowledge */
while( (I2C0CONSET & 0x08) == 0 ); /* Wait till SI = 1 */
I2C0CONCLR = 0x08; /* Clear SI bit */
*( arr + i ) = I2C0DAT ;
}
void I2C_STOP( void )
{
I2C0CONSET = 0x50; /* Set Stop bit for Stop condition */
}
int get_line ( /* 0:End of stream, 1:A line arrived */
char* buff, /* Pointer to the buffer */
int len /* Buffer length */
)
{
int c, i;
i = 0;
for (;;) {
c = Getchar(); /* Get a char from the incoming stream */
if (!c) return 0; /* End of stream? */
if (c == '\r') break; /* End of line? */
if (c == '\b' && i) { /* Back space? */
i--;
}
if (c >= ' ' && i < len - 1) { /* Visible chars */
buff[i++] = c;
}
}
buff[i] = 0; /* Terminate with zero */
return 1;
}
void out_time(uint8_t *p)
{
int ii;
k=0;
ptr=p;
for(ii=0;ii<10;ii++)
{
i=0;
do
{
if (buf5[i][1]==*ptr)
{buf_txt[k++]=(buf5[i][0]);}
i++;
}while (i<sizeof(buf5));
ptr++;
}
buf_cmd[2]=0xE0;
buf_cmd[3]=0x00;
I2C_START();
for (i=0;i<4;i++)
{I2C_WRITE( buf_cmd[i]);}
for (i=0;i<10;i++)
{I2C_WRITE( buf_txt[i]);}
I2C_STOP();
}
void out_time1(uint8_t *p)
{
k=0;
ptr=p;
while(*ptr)
{
i=0;
do
{
if (buf3[i][1]==(*ptr&0xFF))
{buf_txt[k]=(buf3[i][0]&0xFF00)>>8;k++;
buf_txt[k]=(buf3[i][0]&0xFF);k++;}
i++;
}while (i<40);
ptr++;
}
buf_cmd[2]=0xE1;
buf_cmd[3]=0x0A;
I2C_START();
for (i=0;i<4;i++)
{I2C_WRITE( buf_cmd[i]);}
for (i=0;i<30;i++)
{I2C_WRITE( buf_txt[i]);}
I2C_STOP();
}
Вот такой чудо дисплей от весов Mettler Toledo, коих много было завезено в Россию и сейчас они дорабатывают свой ресурс. Собрано опять таки на дармовом эклз на LPC2146. В коде тикают часы, ну и вся кодировка по сегментам.
Еще один дисплей подключен - st7735 128x128 pix. Опять таки к ЭКЛЗ на LPC 2364 с использованием штатного USB и flash 25fl256. На борт девайс может "принять" 32 монохромныx и 127 цветных картинок в формате bmp 24 bit/pix. Выводятся быстро. Качество достойное. Вывод в формате 18 bit.
Добрый день.
Еще один дисплей от Меттлер Толедо нужен в копилку ? Протокол i2c.
Выкладывайте, может кому и пригодится.
#include <LPC214x.h> #include "rtc.h" #include "stdutils.h" #include "systemInit.h" #include "uart.h" #include "type.h" #include "stdio.h" #define led 0x00100000 void out_time1(uint8_t *p); void out_time(uint8_t *p); void DELAY_us(unsigned int count); void DELAY_ms(unsigned int count); void I2C_START(void); void I2C_STOP( void ); void I2C_WRITE( char data ); void I2C_INIT(void); void data1(uint8_t *ptr,uint8_t n); void i2c_clr(); void i2c_clr1(); unsigned char hex2bcd (unsigned char x); int from_hex(uint16_t h); int get_line (char* buff, int len ); char *ptr2,bb; uint8_t b1; long p1, p2, p3; uint8_t *ptr; uint8_t k; uint16_t res,b,i; uint16_t s1, s2, cnt; char Line[127]; BYTE buf[0x40]; __irq void clk (void); __irq void uart0_ISR(void); char q; long int V; char ch; uint8_t tik; rtc_t rtc; char buf_clr[127]={0x70,0xC8,0xE0,0x00,0}; char buf_clr1[40]={0x70,0xC8,0xE1,0x0A,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; char buf_txt[40]={0}; char buf_cmd[]={0x70,0xC8,0xE1,0x0A}; uint8_t num[12]={0xD7,0x06,0xE3,0xA7,0x36,0xB5,0xF5,0x07,0xF7,0xB7,0x08};//. char buf2[]={0x70,0xC8,0xE1,0x0A, 0x01,0x00, 0x02,0x00, 0x04,0x00, 0x08,0x00, 0x10,0x00, 0x20,0x00, 0x40,0x00, 0x80,0x00, 0x00,0x01, 0x00,0x02, 0x00,0x04, 0x00,0x08, 0x00,0x10, 0x00,0x20, 0x00,0x40, 0x00,0x80, 0xFF,0xFF,0,0}; uint16_t buf3[40][2]={ 0xD083,48,//0 0x0003,49,//1 0x94A1,50,//2 0x14A3,51,//3 0x4423,52,//4 0x54A2,53,//5 0xD4A2,54,//6 0x1003,55,//7 0xD4A3,56,//8 0x54A3,57,//9 0xD080,145,//Ñ 0xD003,143,//Ï 0xD421,144,//Ð 0xD083,142,//Î 0xD000,131,//Ã 0x5C23,159,//ß 0x2814,149,//Õ 0x1494,135,//Ç 0xC08B,150,//Ö 0xD423,128,//À 0xD4A0,133,//Å 0x2A54,134,//Æ 0xC813,136,//È 0xD4A2,129,//Á 0xC4A2,156,//Ü 0xD4B2,130,//Â ? 0xC414,138,//Ê 0x4423,151,//×,4 0x1240,147,//Ò 0xC2C3,152,//Ø 0xC2CB,153,//Ù 0xE013,140,//M 0x0813,139,//Ë 0xC423,141,//Í 0x0000,' ',//9 0,0}; uint8_t buf5[13][2]= { 0xD7,48,//0 0x06,49,//1 0xE3,50,//2 0xA7,51,//3 0x36,52,//4 0xB5,53,//5 0xF5,54,//6 0x07,55,//7 0xF7,56,//8 0xB7,57,//9 0xE4,'.',//9 0x00,' ',//9 0,0 }; int main() { SystemInit(); RTC_Init(); UARTInit(115200); I2C_INIT(); rtc.hour = 2; // 10:40:20 am rtc.min = 2; rtc.sec = 0; rtc.date = 21; //1st Jan 2016 rtc.month = 1; rtc.year = 2021; rtc.weekDay = 4; // Friday: 5th day of week considering monday as first day. RTC_SetDateTime(&rtc); // 10:40:20 am, 1st Jan 2016 U0IER=0x41; //interrapt enable 0x01, recive enble IO0DIR |= (1<<20); // q=1; VICVectAddr2 = (unsigned) uart0_ISR; VICIntEnable =(1 << 6); VICVectCntl2 = (1 << 5) | 6; VICVectAddr3 = (unsigned)clk; //Pointer Interrupt Function (ISR) VICVectCntl3 = (1<<5) | 13; //(bit 5 = 1)->to enable Vectored IRQ slot 1//bit[4:0]) -> this the source int number VICIntEnable = (1<<13); // Enable RTC interrupt tik=0; i2c_clr();i2c_clr1(); while(1) { while (tik==0){}; RTC_GetDateTime(&rtc); sprintf(Line,"%02u ",rtc.hour); if (q==0) {sprintf(Line+2,"%1s",".");} else {sprintf(Line+2,"%1s"," ");} sprintf(Line+3,"%02u",rtc.min); sprintf(Line+5,"%3s"," "); sprintf(Line+8,"%02u",rtc.sec); out_time((uint8_t*)Line); sprintf(Line,"%02u ",rtc.date); sprintf(Line+3,"%02u ",rtc.month); sprintf(Line+6,"%04u",rtc.year); out_time1((uint8_t*)Line); IO0PIN ^= (1<<20); tik=0; }} __irq void uart0_ISR(void) { unsigned char i; uint16_t ii; VICIntEnable = (0<<13); CCR=0; U0IER =0; V = U0IIR; // Read current IR value ch = Getchar(); RTC_GetDateTime(&rtc); if (ch=='h') { ch = Getchar(); i = ch & 0x0F; i=i<<4; ch = Getchar(); i= i |( ch & 0x0F); rtc.hour = from_hex(i); ch = Getchar(); i = ch & 0x0F; i=i<<4; ch = Getchar(); i= i |( ch & 0x0F); rtc.min = from_hex(i); rtc.sec=0; RTC_SetDateTime(&rtc); } else if (ch=='d') { ch = Getchar(); i = ch & 0x0F; i=i<<4; ch = Getchar(); i= i |( ch & 0x0F); rtc.date = from_hex(i); ch = Getchar() ; i = ch & 0x0F; i=i<<4; ch = Getchar(); i= i |( ch & 0x0F); rtc.month = from_hex(i); ch = Getchar() ; i = ch & 0x0F; i=i<<4; ch = Getchar(); i= i |( ch & 0x0F); ii=i<<8; ch = Getchar() ; i = ch & 0x0F; i=i<<4; ch = Getchar(); i= i |( ch & 0x0F); ii=ii | i; rtc.year= from_hex(ii); RTC_SetDateTime(&rtc); } VICIntEnable = (1<<13);CCR=1; U0IER =0x11; VICVectAddr = 0x0; // End of interrupt execution } __irq void clk(void) { long int readVal; tik=1; q^=1; readVal = ILR; // Read current IR value ILR=readVal; // Read current IR value VICVectAddr = 0x0; // End of interrupt execution } int from_hex(uint16_t h) { int d = 0; int power = 1; while (h) { // assert(h % 16 < 10) d += (h & 15) * power; h >>= 4; power *= 10; } return d; } void i2c_clr() { int i; I2C_START(); for (i=0;i<sizeof(buf_clr);i++) {I2C_WRITE( buf_clr[i]);} I2C_STOP(); } void i2c_clr1() { int i; I2C_START(); for (i=0;i<sizeof(buf_clr1);i++) {I2C_WRITE( buf_clr1[i]);} I2C_STOP(); } void I2C_INIT(void) { PINSEL0 = PINSEL0 | 0x00000050; I2C0CONSET = 0x40; I2C0SCLL = 0x64; I2C0SCLH = 0x64; } void I2C_START(void) { I2C0CONSET = 0x20; /* Set Start bit for Start condition */ while ( (I2C0CONSET & 0x08) == 0 ); /* Wait till SI = 1 */ I2C0CONCLR = 0x28; /* Clear Start bit and SI bit */ } void I2C_WRITE( char data ) { I2C0DAT = data; /* Load data to be written into the data register */ I2C0CONSET = 0x40; /* Enable I2C */ while( (I2C0CONSET & 0x08) == 0 ); /* Wait till SI = 1 */ I2C0CONCLR = 0x08; /* Clear SI bit */ } unsigned char I2C_READ_ACK( void ) { I2C0CONSET = 0x44; /* Enable I2C with Acknowledge */ while( (I2C0CONSET & 0x08) == 0 ); /* Wait till SI = 1 */ I2C0CONCLR = 0x0C; /* Clear SI and Acknowledge bits */ return I2C0DAT; /* Return received data */ } unsigned char I2C_READ_NACK( void ) { I2C0CONSET = 0x40; /* Enable I2C without Acknowledge */ while( (I2C0CONSET & 0x08) == 0 ); /* Wait till SI = 1 */ I2C0CONCLR = 0x08; /* Clear SI bit */ return I2C0DAT; /* Return received data */ } void I2C_MULTIREAD( char* arr , int bytes ) /* For reading multiple bytes at a time */ { BYTE i = 0; while( ( bytes - 1 ) != 0 ) { I2C0CONSET = 0x40; /* Enable I2C with Acknowledge */ while( (I2C0CONSET & 0x08) == 0 ); /* Wait till SI = 1 */ I2C0CONCLR = 0x0C; /* Clear SI and Acknowledge bits */ *( arr + i ) = I2C0DAT ; bytes--; i++; } I2C0CONSET = 0x40; /* Enable I2C without Acknowledge */ while( (I2C0CONSET & 0x08) == 0 ); /* Wait till SI = 1 */ I2C0CONCLR = 0x08; /* Clear SI bit */ *( arr + i ) = I2C0DAT ; } void I2C_STOP( void ) { I2C0CONSET = 0x50; /* Set Stop bit for Stop condition */ } int get_line ( /* 0:End of stream, 1:A line arrived */ char* buff, /* Pointer to the buffer */ int len /* Buffer length */ ) { int c, i; i = 0; for (;;) { c = Getchar(); /* Get a char from the incoming stream */ if (!c) return 0; /* End of stream? */ if (c == '\r') break; /* End of line? */ if (c == '\b' && i) { /* Back space? */ i--; } if (c >= ' ' && i < len - 1) { /* Visible chars */ buff[i++] = c; } } buff[i] = 0; /* Terminate with zero */ return 1; } void out_time(uint8_t *p) { int ii; k=0; ptr=p; for(ii=0;ii<10;ii++) { i=0; do { if (buf5[i][1]==*ptr) {buf_txt[k++]=(buf5[i][0]);} i++; }while (i<sizeof(buf5)); ptr++; } buf_cmd[2]=0xE0; buf_cmd[3]=0x00; I2C_START(); for (i=0;i<4;i++) {I2C_WRITE( buf_cmd[i]);} for (i=0;i<10;i++) {I2C_WRITE( buf_txt[i]);} I2C_STOP(); } void out_time1(uint8_t *p) { k=0; ptr=p; while(*ptr) { i=0; do { if (buf3[i][1]==(*ptr&0xFF)) {buf_txt[k]=(buf3[i][0]&0xFF00)>>8;k++; buf_txt[k]=(buf3[i][0]&0xFF);k++;} i++; }while (i<40); ptr++; } buf_cmd[2]=0xE1; buf_cmd[3]=0x0A; I2C_START(); for (i=0;i<4;i++) {I2C_WRITE( buf_cmd[i]);} for (i=0;i<30;i++) {I2C_WRITE( buf_txt[i]);} I2C_STOP(); }Вот такой чудо дисплей от весов Mettler Toledo, коих много было завезено в Россию и сейчас они дорабатывают свой ресурс. Собрано опять таки на дармовом эклз на LPC2146. В коде тикают часы, ну и вся кодировка по сегментам.
Привет всем.
Еще один дисплей подключен - st7735 128x128 pix. Опять таки к ЭКЛЗ на LPC 2364 с использованием штатного USB и flash 25fl256. На борт девайс может "принять" 32 монохромныx и 127 цветных картинок в формате bmp 24 bit/pix. Выводятся быстро. Качество достойное. Вывод в формате 18 bit.
https://drive.google.com/file/d/1xltWBxGg31IQG2nIZJmTK1lfSS4G3IWi/view?
https://drive.google.com/file/d/1eCmahdevyRD1QHTt-Mlyl2QSUChBUW9Y/view?usp=sharing
Кому интересно - обращайтесь.
Не написал ли кто нибудь библиотеки для дисплея с двумя КР1820ВГ1 ?
Посмотри мой вариант, в этой теме https://arduino.ru/forum/apparatnye-voprosy/displei-16kh1-ot-kkm-elves-mikro?page=1#comment-462869
Да, Ваши варианты работают=