• AVR Freaks

Hot!hey im new in using microcontroller can u guys help me convert ccs to c18 compiler? here

Author
aeman
aeman
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2020/05/29 10:57:26
  • Location: 0
  • Status: offline
2020/06/10 13:21:43 (permalink)
3 (1)

hey im new in using microcontroller can u guys help me convert ccs to c18 compiler? here

Here the coding can u help me by pointing out which part that i have to change in order to successfully convert it to c18 compiler?
what is the diff between c18 and ccs?
// Configuration bits
/* _CPUDIV_OSC1_PLL2_1L, // Divide clock by 2
_FOSC_HS_1H, // Select High Speed (HS) oscillator
_WDT_OFF_2H, // Watchdog Timer off
MCLRE_ON_3H // Master Clear on
*/

#define FREQ 12000000
#define baud 9600
#define spbrg_value (((FREQ/64)/baud)-1)
#define rs LATA.F0
#define rw LATA.F1
#define en LATA.F2
#define lcdport LATB

unsigned char rx_data();
void lcd_ini();
void lcdcmd(unsigned char);
void lcddata(unsigned char);
unsigned char data[]="Unique ID No.";
unsigned char card_id[12];
unsigned int i=0,pos;

void main()
{
TRISB=0; // Set Port B as output port
LATB=0;
TRISA=0;
LATA=0;
SPBRG=spbrg_value; // Fill SPBRG register to set the baud rate
RCSTA.SPEN=1; // To activate serial port (Tx and Rx pins)
RCSTA.CREN=1; // To enable continuous reception
PIE1.RCIE=1; // To enable the Reception (Rx) Interrupt
INTCON.GIE=1;
INTCON.PEIE=1;
lcd_ini(); // LCD initialization
while(data[i]!='')
{
lcddata(data[i]); // To send characters one by one from 'data' array
i++;
}
while(1)
{
i=0;
while(i<12);
lcdcmd(0xC0);
i=0;
while(i<12)
{
lcddata(card_id[i]); // Print the 12 byte received data
i++;
}
}
}


void interrupt()
{
card_id[i]=RCREG; // Store the received data byte by byte
i++;
}

void lcd_ini()
{
lcdcmd(0x38); // Configure the LCD in 8-bit mode, 2 line and 5x7 font
lcdcmd(0x0C); // Display On and Cursor Off
lcdcmd(0x01); // Clear display screen
lcdcmd(0x06); // Increment cursor
lcdcmd(0x80); // Set cursor position to 1st line, 1st column
}

void lcdcmd(unsigned char cmdout)
{
lcdport=cmdout; //Send command to lcdport=PORTB
rs=0;
rw=0;
en=1;
Delay_ms(10);
en=0;
}

void lcddata(unsigned char dataout)
{
lcdport=dataout; //Send data to lcdport=PORTB
rs=1;
rw=0;
en=1;
Delay_ms(10);
en=0;
}
#1

0 Replies Related Threads

    Jump to:
    © 2020 APG vNext Commercial Version 4.5