#define _PORT_RADIOPOW LATEbits.LATE1
//#ifdef __SDCC
#define _LCD_BACKLIGHT LATC
-#define _LCD_BACKLIGHT_BIT b2
+#define _LCD_BACKLIGHT_BIT b1
#define _LCD_BACKLIGHT_TRIS TRISC
//#else
//#define _LCD_BACKLIGHT _PORTC_RC2_MASK
__bitops_t d;
#if 0
d.byte = _LCD_BACKLIGHT_TRIS;
- d._LCD_BACKLIGHT_BIT = 0;
+ d._LCD_BACKLIGHT_BIT = 0;
_LCD_BACKLIGHT_TRIS = d.byte;
b.byte = _LCD_BACKLIGHT;
PSTRCONbits.STRA = 0;
T2CONbits.TMR2ON = 0;
TMR2 = 0x00;
- CCP1CON = 0x00;
- CCPR1L = 0;
+ CCP2CON = 0x00;
+ CCPR2L = 0;
+ CCPR2H = 0;
} else {
unsigned char h,l;
// lv = level;
// lv <<= 2;
// level = (level * 25) / 10;
// level = 255;
- h = level >> 1; // PWM Level
- if(level == 255) h = 255;
+ h = level >> 1;
+ if(h == CCPR1L) return;
// l = 2 << 4; //(lv & 0x0300) >> 4;
- PSTRCONbits.STRA = 1;
- CCPR1L = h;
- CCPR1H = h;
+ d.byte = _LCD_BACKLIGHT_TRIS;
+ d._LCD_BACKLIGHT_BIT = 1;
+ _LCD_BACKLIGHT_TRIS = d.byte;
+ //PSTRCON = 0;
+ CCPR2L = h;
+ CCPR2H = h;
b.b2 = 1;
b.b3 = 1;
- CCP1CON = b.byte | 0;
- PR2 = 0x65;
+ CCP2CON = b.byte;
+ PR2 = 50;
PIR1bits.TMR2IF = 0;
- T2CON = 0b01111001; // Pre-scaler=1/16,Post-scaler = 1/16
- // -> Freq = 1.22KHz * 4 = 4.84KHz.
+ T2CON = 0b01111000; // Pre-scaler=1/1,Post-scaler = 1/16
+ // -> Freq = 2.44KHz * 16 = 39.4KHz.
TMR2 = 0x00;
T2CONbits.TMR2ON = 1;
do {