Сб май 13, 2017 19:12:02
Ну можно входную частоту подключить к INT0 или INT1, т.е. внешнее прерывание. Внешнее прерывание настроить на срабатывание и на фронт и на спад. В обработчике прерывания выдать импульс.bc2 писал(а):Как реализовать умножение?
Чт май 18, 2017 13:11:15
Вс май 21, 2017 08:48:59
Пт июн 16, 2017 12:41:07
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: 62,500 kHz
// Mode: Fast PWM top=0xFF
// OC2 output: Non-Inverted PWM
// Timer Period: 4,096 ms
// Output Pulse(s):
// OC2 Period: 4,096 ms Width: 4,096 ms
ASSR=0<<AS2;
TCCR2=(1<<PWM2) | (1<<COM21) | (0<<COM20) | (1<<CTC2) | (1<<CS22) | (0<<CS21) | (0<<CS20);
TCNT2=0x00;
OCR2=0xFF;
#define OnPWM() TCCR2 |=((1<<CS22) | (0<<CS21) | (0<<CS20))
#define OffPWM() TCCR2 &=~((1<<CS22) | (1<<CS21) | (1<<CS20))
Пт июн 16, 2017 13:09:15
Пт июн 16, 2017 13:24:38
Пт июн 16, 2017 14:23:38
#define OnPWM() TCCR2=(1<<PWM2) | (1<<COM21) | (0<<COM20) | (1<<CTC2) | (1<<CS22) | (0<<CS21) | (0<<CS20);
#define OffPWM() do {\
PORTD &=~(1<<PORTD7);\
TCCR2=0x00;\
}while(0)
Пт июн 16, 2017 14:27:00
Пт июн 16, 2017 15:21:49
ARV писал(а):а в том, что не выключали "особую функцию порта"
ARV писал(а):Вы же только ОСТАНАВЛИВАЛИ таймер, но не выключали режим.
Пт июн 16, 2017 15:39:32
Вс июл 02, 2017 08:03:58
void write(char data, char adress)
{
unsigned char i;
//опускаем CS
_soft_latch=0;
#asm("nop") //latch
//задвигаем адрес
for(i=0;i<8;i++)
{
if(adress & 0x80)
{
_soft_data = 1;
}
else
{
_soft_data = 0;
}
#asm("nop") //shift
_soft_shift=1;
#asm("nop")
_soft_shift=0;
adress <<= 1;
}
//задвигаем данные
for(i=0;i<8;i++)
{
if(data & 0x80)
{
_soft_data = 1;
}
else
{
_soft_data = 0;
}
#asm("nop") //shift
_soft_shift=1;
#asm("nop")
_soft_shift=0;
data <<= 1;
}
_soft_latch=1;
}
write(char data, char adress)
write(char data, char adress)
write(char data, char adress)
write(char data, char adress)
write(char data, char adress)
write(char data, char adress)
write(char data, char adress)
Вс июл 02, 2017 08:43:50
Вс июл 02, 2017 08:50:55
No-Op Register
The no-op register is used when cascading MAX7219s
or MAX7221s. Connect all devices’ LOAD/CS inputs
together and connect DOUT to DIN on adjacent
devices. DOUT is a CMOS logic-level output that easily
drives DIN of successively cascaded parts. (Refer to
the Serial Addressing Modes section for detailed infor-
mation on serial input/output timing.) For example, if
four MAX7219s are cascaded, then to write to the
fourth chip, sent the desired 16-bit word, followed by
three no-op codes (hex XX0X, see Table 2). When
LOAD/CS goes high, data is latched in all devices. The
first three chips receive no-op commands, and the
fourth receives the intended data.
Вт июл 04, 2017 09:56:05
void max7219SendDataBuf(uint8_t *buf)
{
uint8_t i, j;
for (i = 0; i < 8; i++) {
PORT(MAX7219_LOAD) &= ~MAX7219_LOAD_LINE;
for (j = 0; j < MATRIX_CNT; j++) {
max7219SendByte(MAX7219_DIGIT_0 + i);
max7219SendByte(buf[8 * j + i]);
}
PORT(MAX7219_LOAD) |= MAX7219_LOAD_LINE;
}
return;
}
Ср июл 05, 2017 10:40:38
Чт июл 27, 2017 04:45:48
const unsigned char StrLoad[] = "Load";
void FlashToLCDtSimpl(const unsigned char *xaddres){
for(;*xaddres!=0;++xaddres){
LcdWriteData (*xaddres);
}
}
flash const unsigned char или const unsigned char flash или unsigned char const *
Чт июл 27, 2017 07:29:00
В приведённом коде не вижу вообще ничего, на что мог бы компилятор ругаться именно так. Откуда вообще этот flash? Чего-то не хватает.Alex_Golubev писал(а):flash unsigned char [17]
Чт июл 27, 2017 09:00:25
const unsigned char StrLoad[] = "Load";
flash unsigned char StrLoad[] = "Load";
void FlashToLCDtSimpl(flash unsigned char *xaddres){
for(;*xaddres!=0;++xaddres){
LcdWriteData (*xaddres);
}
}
Чт июл 27, 2017 10:03:03
Вс июл 30, 2017 12:52:19