AGCB
Member
Hi
I've not been on the forum for a while but lurked a little. I temporarily switched to "Propeller as a stepping stone to learning "C".
'I'm working on learning MC C18 and have compiled a few simple programs for blinking LEDs and using the delay tools in the library. Now I'm trying to get a LCD working with the XLCD library. I was able to display on the LCD but only using one line of code per character. EDIT (That was with a different program type) I would like to be able to include strings like I did in assembly with Mike McClaren's 'putstr' MACRO.
This program compiles without error but only shows black boxes on the LCD.
I'm hoping someone can spot an obvious mistake.
Thanks Aaron
I've not been on the forum for a while but lurked a little. I temporarily switched to "Propeller as a stepping stone to learning "C".
'I'm working on learning MC C18 and have compiled a few simple programs for blinking LEDs and using the delay tools in the library. Now I'm trying to get a LCD working with the XLCD library. I was able to display on the LCD but only using one line of code per character. EDIT (That was with a different program type) I would like to be able to include strings like I did in assembly with Mike McClaren's 'putstr' MACRO.
This program compiles without error but only shows black boxes on the LCD.
I'm hoping someone can spot an obvious mistake.
Thanks Aaron
Code:
//
Program INFO and what it does //Display strings on LCD
//#includes
#include <p18F43K20.h>
#include <xlcd.h>
#include <delays.h>
//Processor configuration
#pragma config FOSC=INTIO67,BOREN=OFF,PWRT=ON,WDTEN=OFF,PBADEN=OFF,STVREN=OFF,LVP=OFF
#define LEDPIN PORTAbits.RA1
//Prototype declarations
void DelayFor18TCY (void);
void DelayXPORXLCD (void); //Power on delay to get LCD going
void DelayXLCD (void);
void DelayFor18TCY (void)
{
Delay10TCYx(2); //20 us delay
}
void DelayPORXLCD (void)
{
Delay1KTCYx(15); //15ms delay
}
void DelayXLCD (void)
{
Delay1KTCYx(5); //5ms delay
}
///////////////// MAIN Funtion //////////////////////////////////////////////////
void main (void)
{
OSCCON = 0xD0; /* Set internal oscillator at 4 Mhz */
ADCON0 = 0x00; /* Disable internal ADC */
TRISE=0;
PORTEbits.RE2 = 1; //turn on LCD power via MOSFET
Delay1KTCYx(40); //40 ms delay
OpenXLCD(FOUR_BIT & LINES_5X7);
DelayPORXLCD;
putsXLCD("Hello");
while(1);
}