Чт мар 15, 2018 07:06:22
Чт мар 15, 2018 08:24:32
implicit signed to unsigned conversion
lcd_putch(r[0] + 48);
--warn=-3
Чт мар 15, 2018 08:30:24
Чт мар 15, 2018 09:27:08
Чт мар 15, 2018 09:31:36
lcd_putch(r[0] + 48);
--warn=-3
lcd_putch(r[0] + 48U);
I don't know if this qualifies as a "good" answer, but it's the only one I've got:
XC8 generates that message in a number of situations where it arguably should not. We don't yet know precisely why it does (and thus we don't know how we can change the compiler to stop it), which is why it was designated a level "-3" warning, when the compiler's default warning level is "0". But MPLAB X recently changed to explicitly set the compiler's warning level to "-3" so you get the warning now.
You can eliminate many often-bothersome warning messages by changing your MPLAB X project settings to specify a warning level of "-2" (which is the level I have historically recommended as being most helpful while still least distracting). Selecting this level means you will miss out on some useful warnings, but you will also avoid a lot of noise. It's up to you if this tradeoff is acceptable.
Чт мар 15, 2018 10:18:07
По умолчанию число 48 - signed
Ваш код
- Код:
lcd_putch(r[0] + 48U);
r[0] += 48;
lcd_putch(r[0]);
Что соответствует выбору - "забить"
--warn=-3
Чт мар 15, 2018 11:02:42
По умолчанию число 48 - signed
const uint8_t divider = 48;
Чт мар 15, 2018 12:08:14
char c;
....
c += '0';
....
Чт мар 15, 2018 12:26:38
lcd_putch(r[0]+'0');
Ср апр 11, 2018 12:36:45
void init_Timer0()
{
T5CON.T08BIT = 0; // 16 бит
TMR0L = 0x47;
TMR0H = 0x71;
T0CON.PSA = 0;
T0CON.T0CS = 0;
T0CON.T0SE = 0;
T0CON.T0PS0 = 0; //*****************
T0CON.T0PS1 = 1; // прескаллер 1:128 *
T0CON.T0PS2 = 1; //*****************
T0CON.TMR0ON = 1; // старт таймера
}
void interrupt() {
//USB Interrupt
USB_Interrupt_Proc();
if (INTCON.TMR0IF&&INTCON.TMR0IF)
{
PORTD.f5 = ~(PORTD.f5); // моргаю светодиодом
INTCON.TMR0IF = 0;
TMR0L = 0x47;
TMR0H = 0x71;
}
}
Ср апр 11, 2018 12:47:29
#define LED_1_Toggle() do { LATBbits.LATB4 = ~LATBbits.LATB4; } while(0)
Ср апр 11, 2018 13:07:48
Ср апр 11, 2018 13:18:25
T5CON.T08BIT = 0; // 16 бит
TMR0L = 0x47;
TMR0H = 0x71;
Ср апр 11, 2018 15:47:23
Пн май 14, 2018 09:13:22
Ср май 23, 2018 10:54:36
Чт авг 30, 2018 10:00:44
#define SetBit(adr, bit) asm("BSF adr, bit")
Вт дек 04, 2018 09:27:11
HC164(int x) //record the byte to 74HC164
{ unsigned char b;
char j;
for(j=7;j>-1;j--)
{b=x; //записываем входное число от 0 до 255 в 8-битную переменную без знаков.
b»j; //сдвигаем на j, чтоб записываемый бит оказался младшим (начинаем запись с самого старшего)
PORTCbits.RC0=b; //serial data пишем бит
PORTBbits.RB3=1; //clock дрыгаем clock
PORTBbits.RB3=0;}} //clock
Вт дек 04, 2018 18:28:37
for(j=7;j>-1;j--)
PORTCbits.RC0=b; //serial data пишем бит
PORTCbits.RC0 = b & 0x01u; //serial data пишем бит
unsigned char mask = 0x80;
for (j=0 ; j < 8; j++) {
PORTCbits.RC0 = (x & mask) ? 1 : 0 ;
mask >> 1;
}
Ср дек 05, 2018 08:38:47
? 1 : 0