Hi I have the following code
/code
/*
Blank Simple Project.c
http://learn.parallax.com/propeller-c-tutorials
*/
#include "simpletools.h" // Include simple tools
//DataPins "20 21 22 23 24 25 26 27"
#define RS 17 //Register Select
#define EN 18 // Enable (Starts data read/write.)After E allows R/W it must then be turned off.
#define RW 19 //Read/write
#define DATA {27 26 25 24 23 22 21 20}
void inst(void);
void data(void);
void latch(void);
void Initialize(void);
void setout(void);
void setin(void);
void wr8bits(int val);
int main()
{ //main start
initialize(); //initialize LCD display (low(RS), low(RW), high(EN)
inst(); //Send Instruction Function Select routine (low(RS), low(RW))
//DATA Send Data 0X38 (set 8 bit mode) Send This instruction on LCD databus
set_outputs (27, 20, 0x38); //set 8 bit mode, 2-lines Font 5x7
pause(2);
latch();
//DATA Send 0X0f Second Instruction on LCD databus
inst();
set_outputs (27, 20, 0x0F); //Display on, Cursor on, Cursor blink
latch();
inst(); //(low(RS), low(RW))
set_directions (27, 20, 0xFF); //instead of 0b11111111 0xFF can be used (outputs)
set_outputs (27, 20, 0x1); //CLEAR display 0b00000001
latch();
pause(2000);
set_directions (27, 20, 0xFF); //instead of 0b11111111 0xFF can be used (outputs)
data(); //Change the input type to Data.(before it was instruction input)
set_outputs (27, 20, 0x47); //Send G send 47 HEX (G) to pins 20 to 27
latch();
set_outputs (27, 20, 0x52); //Send R
latch();
set_outputs (27, 20, 0x45); //Send E
latch();
set_outputs (27, 20, 0x47); //Send G
latch();
return(0);
inst();
set_outputs (27, 20, 0xC0); //Cusor on line 2
latch();
void inst(void) //Instruction select routine
{
low(RS); //RS low
low(RW); //RW low
}
void data(void) // //Change the input type to Data.(before it was instruction input)
{
high(RS); //RS high
low(RW); //RW low
}
void latch(void) //->EN<- Latch the above instruction once.
{
high(EN); //EN high
pause(2); //wait 30mS
low(EN); //EN low
pause(2); //wait 30 mS
high(EN); //EN high
// p ause(50); //wait 50mS
}
void initialize(void)
{
low(RS);
low(RW);
high(EN);
pause(2); //some LCDs takes time to initialize at startup
}
void setout(void)
{
set_directions (27, 20, 0xFF); //instead of 0b11111111 0xFF can be used (outputs)
}
void setin(void)
{
set_directions (27, 20, 0x0); //instead of 0b00000000 0xFF can be used (inputs)
}
void wr8bits(int val)
{
DIRA |= 0xff << 20;
OUTA = (OUTA & ~(0xff << 20)) | (val << 20);
}
code/
As can be seen (in red), I'm sending one character at a time to the LCD, I've been working on a way to sent a string, instead of one character at a time. Any help?
/code
/*
Blank Simple Project.c
http://learn.parallax.com/propeller-c-tutorials
*/
#include "simpletools.h" // Include simple tools
//DataPins "20 21 22 23 24 25 26 27"
#define RS 17 //Register Select
#define EN 18 // Enable (Starts data read/write.)After E allows R/W it must then be turned off.
#define RW 19 //Read/write
#define DATA {27 26 25 24 23 22 21 20}
void inst(void);
void data(void);
void latch(void);
void Initialize(void);
void setout(void);
void setin(void);
void wr8bits(int val);
int main()
{ //main start
initialize(); //initialize LCD display (low(RS), low(RW), high(EN)
inst(); //Send Instruction Function Select routine (low(RS), low(RW))
//DATA Send Data 0X38 (set 8 bit mode) Send This instruction on LCD databus
set_outputs (27, 20, 0x38); //set 8 bit mode, 2-lines Font 5x7
pause(2);
latch();
//DATA Send 0X0f Second Instruction on LCD databus
inst();
set_outputs (27, 20, 0x0F); //Display on, Cursor on, Cursor blink
latch();
inst(); //(low(RS), low(RW))
set_directions (27, 20, 0xFF); //instead of 0b11111111 0xFF can be used (outputs)
set_outputs (27, 20, 0x1); //CLEAR display 0b00000001
latch();
pause(2000);
set_directions (27, 20, 0xFF); //instead of 0b11111111 0xFF can be used (outputs)
data(); //Change the input type to Data.(before it was instruction input)
set_outputs (27, 20, 0x47); //Send G send 47 HEX (G) to pins 20 to 27
latch();
set_outputs (27, 20, 0x52); //Send R
latch();
set_outputs (27, 20, 0x45); //Send E
latch();
set_outputs (27, 20, 0x47); //Send G
latch();
return(0);
inst();
set_outputs (27, 20, 0xC0); //Cusor on line 2
latch();
void inst(void) //Instruction select routine
{
low(RS); //RS low
low(RW); //RW low
}
void data(void) // //Change the input type to Data.(before it was instruction input)
{
high(RS); //RS high
low(RW); //RW low
}
void latch(void) //->EN<- Latch the above instruction once.
{
high(EN); //EN high
pause(2); //wait 30mS
low(EN); //EN low
pause(2); //wait 30 mS
high(EN); //EN high
// p ause(50); //wait 50mS
}
void initialize(void)
{
low(RS);
low(RW);
high(EN);
pause(2); //some LCDs takes time to initialize at startup
}
void setout(void)
{
set_directions (27, 20, 0xFF); //instead of 0b11111111 0xFF can be used (outputs)
}
void setin(void)
{
set_directions (27, 20, 0x0); //instead of 0b00000000 0xFF can be used (inputs)
}
void wr8bits(int val)
{
DIRA |= 0xff << 20;
OUTA = (OUTA & ~(0xff << 20)) | (val << 20);
}
code/
As can be seen (in red), I'm sending one character at a time to the LCD, I've been working on a way to sent a string, instead of one character at a time. Any help?