#define Lo (param) ((char *) & param) [0]
#define Hi (param) ((char *) & param) [1]
#define Higher (param) ((char *) & param) [2]
#define Highest (param) ((char *) & param) [3]
/ * #define _LCD_FIRST_ROW 0x80 // Move cursor to the 1st row
#define _LCD_SECOND_ROW 0xC0 // Move cursor to the 2nd row
#define _LCD_THIRD_ROW 0x94 // Move cursor to the 3rd row
#define _LCD_FOURTH_ROW 0
4 // Move cursor to the 4th row
#define _LCD_CLEAR 0x01 // Clear display
#define _LCD_RETURN_HOME 0x02 // Return cursor to home position, returns to shifted display to
// its original position. Display data RAM is unaffected.
#define _LCD_CURSOR_OFF 0x0C // Turn off cursor
#define _LCD_UNDERLINE_ON 0x0E // Underline cursor on
#define _LCD_BLINK_CURSOR_ON 0x0F // Blink cursor on
#define _LCD_MOVE_CURSOR_LEFT 0x10 // Move cursor left without changing display data RAM
#define _LCD_MOVE_CURSOR_RIGHT 0x14 // Move cursor right without changing display data RAM
#define _LCD_TURN_ON 0x0C // Turn Lcd display on
#define _LCD_TURN_OFF 0x08 // Turn Lcd display off
#define _LCD_SHIFT_LEFT 0x18 // Shift display left without changing display data RAM
#define _LCD_SHIFT_RIGHT 0x1E // Shift display right without changing display data RAM
// LCD Defines
#define LCD_ADDR 0x4E * /
#define F_CLOCK 3200000 //3.2MHz Clock
#define F_START 87.00 // Start Frequencie
#define F_STOP 109.00 // Stop Frequencie
#define F_STEPSIZE 0.05 // Step Size
#define INPUT_DIVIDE 8 // RF Input Divide
#define CLOCK_DIVIDE 512 // Reference Divide
#define REF (F_CLOCK / CLOCK_DIVIDE) // REF clock 6250kHz
#define TSA5511_WRITE_ADDRESS 0xC0 // I2C Write Addres
#define TSA5511_READ_ADDRESS 0xC1 // I2C Write Addres
#define MONO 0
#define STEREO 1
// voltage divider at A5 - select proper values so that voltage never exceeds 5v on A5!
// With R1 = 1k2 and R2 = 4k7, max input voltage = 25v
#define R1 (12) // from GND to A5, express in 100R (12 = 1200 Ohm)
#define R2 (47) // from + power supply to A5, express in 100R (47 = 4700 Ohm)
// calibration variables for forward power:
// PowCal = (VoltFWD² / Power) / 1000 (where Power = Power over 50 Ohm in Watt)
// Carry out calibration with sufficient power!
#define PowCalHF (100) // HF band
#define PowCal6m (21) // 6m band
#define PowCal4m (30) // 4m band
#define PowCal2m (117) // 2m band
#define PowCal70 (57) // 70cm band
#define PowCal23 (3165) // 23cm band
#define PowCal13 (64800) // 13cm band
float VoltFWD = 0.0;
float VoltFWDmax = 0.0;
float VoltPEP = 0.0;
float VoltREF = 0.0;
unsigned int Diode = 130; // diode forward voltage, expressed in mV
unsigned int PowCal = 103; // calibration factor for power: PowCal = (VoltFWD² / Power) * 1000
unsigned long PWR = 0; // power (expressed in 100 mW)
unsigned int PowDis = 0; // power for display
float SWR = 0.0; // SWR
float Vratio = 0.0; // Voltage ratio VoltREF / VoltFWD
int SWRDis = 0; // power calculation for showing in display
int VoltFWDmini = 0;
double PWRmax = 0.0;
char msg [22], str [30];
unsigned char myFlags = 0, menuCounter = 0, previous_menuCounter = 0, i = 0;
double freq = 0.0, previous_frequency = 0.0;
unsigned int power = 1, previous_power = 0, set_power = 0, runCounter = 0, pwmDuty = 0;
double voltage = 0.0, current = 0.0;
unsigned long temperature = 0, prevTemperature = 0;
unsigned int audio_left = 0, previous_audio_left = 0, audio_right = 0, previous_audio_right = 0;
const char character [] = {6,9,9,6,0,0,0,0};
// LCD module connections
sbit LCD_RS at LATD0_bit;
sbit LCD_EN at LATD1_bit;
sbit LCD_D4 at LATD4_bit;
sbit LCD_D5 at LATD5_bit;
sbit LCD_D6 at LATD6_bit;
sbit LCD_D7 at LATD7_bit;
sbit LCD_RS_Direction at TRISD0_bit;
sbit LCD_EN_Direction at TRISD1_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
sbit Set_Button at RB4_bit;
sbit Up_Button at RB6_bit;
sbit Down_Button at RB5_bit;
sbit Antenna at RB7_bit;
sbit BCK_LIGHT at LATC0_bit;
sbit MonoStereo at LATC7_bit;
sbit temperatureOutput at LATC6_bit;
sbit configuredFlag at myFlags.B0;
sbit callOnceFlag at myFlags.B1;
#define Set_Button_Pressed (RB4_bit == 0)
#define Up_Button_Pressed (RB6_bit == 0)
#define Down_Button_Pressed (RB5_bit == 0)
#define Antenna_Is_Disconnected (RB7_bit == 1)
#define Antenna_Is_Connected (RB7_bit == 0)
#define ON 1
#define OFF 0
#define HIGH 35
#define LOW 27
const char msg1 [] = "Set Frequency";
const char msg2 [] = "Set Power";
const char msg3 [] = "Power:";
const char msg4 [] = "Set Audio";
const char msg5 [] = "Mode:";
const char msg6 [] = "Mono";
const char msg7 [] = "Stereo";
const char msg8 [] = "BL";
const char msg9 [] = "Info";
const char msgA [] = "Setup";
const char msgB [] = "Up";
const char msgC [] = "Down";
const char msgD [] = "Next";
const char msgE [] = "Perbaharui";
const char msgF [] = "V:";
const char msgG [] = "C:";
const char msgH [] = "DRV:";
const char msgI [] = "T:";
const char msgJ [] = "MOD:";
const char msgK [] = "Measurements";
const char msgL [] = "Exit";
const char msgM [] = "FWD:";
const char msgN [] = "REF:";
const char msgO [] = "- JAWA BARAT -";
const char msgP [] = "ON AIR";
const char msgQ [] = "-> FM TRANSMITTER <-";
const char msgR [] = "First Time Operation";
const char msgS [] = "Connect Antenna";
const char msgT [] = "Press C for Setup";
const char msgU [] = "Freq:";
const char msgV [] = "************";
const char msgW [] = "SWR ALARM";
const char msgX [] = "L:";
const char msgY [] = "R:";
const char msgZ [] = "";
const char msgAA [] = "MODULATION";
const char msgAB [] = "INDONESIA";
unsigned int adc_rd, diff;
unsigned long int BarSegmentNum;
char adcprint, k;
const char character_bg [] = {31,31,31,31,31,31,31,31};
char * CopyConst2Ram (char * dest, const char * src) {
char * d;
d = dest;
for (; * dest ++ = * src ++
asm clrwdt;
return d;
}
unsigned char SetFreq (double dFrequencie) {
unsigned int iPrescaler;
unsigned char ubCpByte = 0x00;
unsigned char ubPortByte = 0x00;
unsigned char status = 0x00;
......
Todavía no terminas, alguien quiere ayudar