Problem about using the LCD board, help needed really

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
ke
Posts: 4
Joined: Thu Jan 18, 2007 6:45 pm

Problem about using the LCD board, help needed really

Post by ke »

By reading the teaching material about programming the LCD board, I know RB0~RB3 is the data transmission lines, RB4 is the line which can control to transmit the data or instruction, RB5 should be lifted and droped down to clock out the data to LCD board. If the information I got is all right, the following code should place a "W" on the LCD board, however, it gave me "u" with two dots above(can't type from keypad) and when I changed the first PORTB to 0x13 and second PORTB to 0x14, it gave me proportional symbol, if I changed those to 0x17 and 0x18, it gave me pi, it seems I can only get the symbol from most right-hand -side column, whose four higher bits is 1111 and their lower 4 bits is controlled by first PORTB which is supposed to select the 4 higher bits of symbol. Can you give me any suggestions or attching some code example to control the LCD board displaying things please? Thank you very much. By the way I just wonder If I can plug the LCD board to other ports of PIC rather than PORTB.

.........
TRISB = 0x00;

PORTB = 0x15; //Higher four bit of W

.........
PORTB = 0x17; //Lower four bit of W
.........

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Post by Benj »

Hello Ke

The problem you are having is probably due to the fact that you are writing to the entire port when you put your data on. What you should do is:

Code: Select all

char temp;
temp = PORTB & 0xf0; //Mask out lower 4 bits
PORTB = temp | 0x15;  //Write 'W' data onto lower 4 bits
........ ........
temp = PORTB & 0xf0; //Mask out lower 4 bits
PORTB = temp | 0x17;  //Write 'W' data onto lower 4 bits
The best thing I can advise to learn the LCD functions is to download the demo copy of flowcode.

Within Flowcode do the following to create C code for the LCD
  • Add an LCD component.
    Use a component macro to start the component.
    Use a component macro to print out an ascii 'W'
    compile the flowchart to C code.
    View the C code.
Yes the LCD can be connected to any port as long as there is enough free I/O pins to allow the data to be transfered correctly.

Post Reply