Customized characters on the LCD

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Customized characters on the LCD

Post by alexander70 »

Hi! I read the article http://www.matrixmultimedia.com/mmforum ... &sk=t&sd=a , but I do not know how to program the other characters in the LCD. For example, I have the codes of needed characters here http://www.atariarchives.org/cgp/Ch02_Sec04.php or here http://www.compel.ru/pdf/WINSTAR/WH1602A-YGB-CP.pdf (page 13) . How are they programmed in LCD 1602 in Flow code? For example, how to program the character with the code: Lower 4 bit: LHLH, Upper 4 bit: HLHL ?
Respectfully, Alexander

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Customized characters on the LCD

Post by alexander70 »

I was not able to program an example from the article http://www.matrixmultimedia.com/mmforum ... &sk=t&sd=a in CHIP 16F887


File name: F: \ Microcintrollers \ FlowCode Examples \ Flowcode 3 Examples from programm \ LCD_Custom_Characters \ bar graph 16F887.c
Generated by: Flowcode v3.5.8.50
Date: Thursday, October 22, 2009 10:25:06
Licence: Demo

*** DEMO VERSION ***


NOT FOR COMMERCIAL USE

http://www.matrixmultimedia.com



Launching the compiler ...

E: \ Program Files \ Matrix Multimedia \ Flowcode V3 \ BoostC \ boostc.pic16.flowcode.exe-v-t PIC16F887 "bar graph 16F887.c"

BoostC Optimizing C Compiler Version 6.70 (for PIC16 architecture)
http://www.sourceboost.com
Copyright (C) 2004-2007 Pavel Baranov
Copyright (C) 2004-2007 David Hobday

Licensed to FlowCode User under Single user Pro License for 1 node (s)
Limitations: PIC12, PIC16 max code size: Unlimited, max RAM banks: Unlimited


bar graph 16F887.c
Starting preprocessor: "E: \ Program Files \ Matrix Multimedia \ Flowcode V3 \ BoostC \ pp.exe" "F: \ Microcintrollers \ FlowCode Examples \ Flowcode 3 Examples from programm \ LCD_Custom_Characters \ bar graph 16F887.c"-i "E: \ Program Files \ Matrix Multimedia \ Flowcode V3 \ BoostC \ include "-d _PIC16F887-la-c2-o" bar graph 16F887.pp "-v-d _BOOSTC-d _PIC16


...............................

F: \ Microcintrollers \ FlowCode Examples \ Flowcode 3 Examples from programm \ LCD_Custom_Characters \ bar graph 16F887.c (366:2): error: unknown identifier 'LCD_RAM_Write'
F: \ Microcintrollers \ FlowCode Examples \ Flowcode 3 Examples from programm \ LCD_Custom_Characters \ bar graph 16F887.c (366:2): error: failed to generate expression
F: \ Microcintrollers \ FlowCode Examples \ Flowcode 3 Examples from programm \ LCD_Custom_Characters \ bar graph 16F887.c (367:2): error: unknown identifier 'LCD_RAM_Write'
F: \ Microcintrollers \ FlowCode Examples \ Flowcode 3 Examples from programm \ LCD_Custom_Characters \ bar graph 16F887.c (367:2): error: failed to generate expression
F: \ Microcintrollers \ FlowCode Examples \ Flowcode 3 Examples from programm \ LCD_Custom_Characters \ bar graph 16F887.c (368:2): error: unknown identifier 'LCD_RAM_Write'
F: \ Microcintrollers \ FlowCode Examples \ Flowcode 3 Examples from programm \ LCD_Custom_Characters \ bar graph 16F887.c (368:2): error: failed to generate expression
F: \ Microcintrollers \ FlowCode Examples \ Flowcode 3 Examples from programm \ LCD_Custom_Characters \ bar graph 16F887.c (369:2): error: unknown identifier 'LCD_RAM_Write'
F: \ Microcintrollers \ FlowCode Examples \ Flowcode 3 Examples from programm \ LCD_Custom_Characters \ bar graph 16F887.c (369:2): error: failed to generate expression
bar graph 16F887.c success

failure

Return code = 1

Flowcode was unable to compile the flowchart's C code due to the following errors:


If your flowchart contains C code, please review this carefully. If your flowchart contains no C-code or you have thoroughly reviewed the code, contact Technical Support.

FINISHED
Attachments
bar graph 16F887.fcf
(6 KiB) Downloaded 482 times
Respectfully, Alexander

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:

Re: Customized characters on the LCD

Post by Benj »

Hello

Did you update the LCD C code as shown in the article? If you didn't do this then this is the reason your program will not compile. If you did do this then please attach your C code to the forum and I will have a look for you.

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Customized characters on the LCD

Post by alexander70 »

I did not change C code:

LCD_RAM_Write(0,0,0,0,0,0,0,0,31);
LCD_RAM_Write(1,0,0,0,0,0,0,31,31);
LCD_RAM_Write(2,0,0,0,0,0,31,31,31);
LCD_RAM_Write(3,0,0,0,0,31,31,31,31);
LCD_RAM_Write(4,0,0,0,31,31,31,31,31);
LCD_RAM_Write(5,0,0,31,31,31,31,31,31);
LCD_RAM_Write(6,0,31,31,31,31,31,31,31);
LCD_RAM_Write(7,31,31,31,31,31,31,31,31);
Respectfully, Alexander

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Customized characters on the LCD

Post by alexander70 »

I do not need to write to the memory of the indicator ( LCD_RAM_Write ), all the characters already written in my display. But I do not know how to call them. For example, how to call the symbol with address: Lower 4 bit: LHLH, Upper 4 bit: HLHL?
Respectfully, Alexander

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:

Re: Customized characters on the LCD

Post by Benj »

Hello

You can simply do this.

calculation icon:
byte = bx10100101
or
byte = 0xA5

LCD hardware macro:
LCD_Send_ASCII - Parameter: byte

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Customized characters on the LCD

Post by alexander70 »

Thank you, it works. But the program alloved to write byte = 0xA5. When I tried to write bx10100101 appeared message: One or more of calculation line are invalid. Why so?
Respectfully, Alexander

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Customized characters on the LCD

Post by alexander70 »

How is calling 8-bit address of the symbol for the 4-pin address D4-D7 of the indicator? Hence these pins of the indicator (D0-D3 and R/W) are not needed at all? Why then they did in the indicator?
Respectfully, Alexander

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:

Re: Customized characters on the LCD

Post by Benj »

Hello

Sorry the binary entry should look like this.

var = 0b10100101

D0-D3 are not needed when using the display in 4-bit mode. However they are used when using the display in 8-bit mode.

The R/W pin is used to control data direction. Eg you can use the display as a memory device. Only its not particularily useful so we have instead put the display into write mode only by grounding the R/W pin.

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Customized characters on the LCD

Post by alexander70 »

Thank you, but what distinguishes the use of the LCD in 4-bit mode or 8-bit mode? LCD can display any characters in both modes?
Respectfully, Alexander

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:

Re: Customized characters on the LCD

Post by Benj »

Hello

The only difference is the way you communicate with the LCD. in 8-bit mode you clock all 8-bits into the LCD at once. In 4-bit mode you clock 4-bits in at a time and two successive 4-bit writes make up the 8-bit command. This is the only difference. At the front end there is no difference in operation.

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Customized characters on the LCD

Post by alexander70 »

Hi! Thank you for information, I have 1 more question. For what used string manipulation icon (example in Tut31) ? For what used PrintString of LCD macro?
Respectfully, Alexander

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:

Re: Customized characters on the LCD

Post by Benj »

Hello
For what used string manipulation icon (example in Tut31) ?
String manipulation icons are used for manipulating string variables. In the example TUT31 you have string manipulation icons contining code like this.

Input_string = Input_string + Current_Char
or
Input_string = Input_string + 'H'

This takes the current string and adds the value contained within Current_Char to the end of the string.
For what used PrintString of LCD macro?
The Print string LCD macro prints a string of ASCII characters to the LCD. A string is essentially a collection of ASCII byte variables.

TUT31 allows you to build up a string by using the three input buttons. I think the next tutorial TUT32 uses this method to input a password to unlock a device.

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Customized characters on the LCD

Post by alexander70 »

Hi! Thank you for information. Now I'm trying to change the example TUT31 to use the buttons connected to bits A1, A2, A3 (now used A0, A1, A2), but I do not get. What should I do for this?
Respectfully, Alexander

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:

Re: Customized characters on the LCD

Post by Benj »

Hello Alex

Ok first of all you should edit the switch component connection properties to allow the alternative pins to be used in the simulation of the switches.

Then you need to change any the decision icons that use switch = x

Basically you will need to double x to get the new bit value.

Eg
switch = 1 becomes switch = 2
switch = 2 becomes switch = 4
etc..

You have to do it like this because in the example we are getting the switch values by reading an I/O port rather then using the switch component hardware macros.

In the properties of the input icon you should also check the masking to ensure that the pins you are interested in are being read and any pins your not interested in are not.

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Customized characters on the LCD

Post by alexander70 »

Hi! Thank you, it works. I want to ask you about the Master Clear Enable in "Pic micro configuration". There I can choose 1 of 2 options: "MCLR is external" and "RE3 is digital input". MCLR and RE3 is 1 pin. How to use a hardware pin RE3 for the digital reset the controller?
Respectfully, Alexander

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:

Re: Customized characters on the LCD

Post by Benj »

Hello Alexander

The "MCLR is external" setting will use the RE3 pin as the reset pin. This pin must be held high by a 1K - 10K resistor from the 5v supply to allow the device to run. On our hardware this is already provided for you. The reset switch then forces the program to start from the beginning of memory.

The "RE3 is digital input" setting will allow you to use the pin as a digital input for your program. You can then control the input by pressing the onboard reset switch.

Unfortunatley the reset / IO pin cannot be used as an output even if you have disabled the MCLR functionality.

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Customized characters on the LCD

Post by alexander70 »

Thank you, if I chose RE3 as a digital input, in this case, the logic levels on the RE3 will not affect on the controller reset? How can happen controller reset in this case?
Respectfully, Alexander

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:

Re: Customized characters on the LCD

Post by Benj »

Hello Alexander

Yes if you use the digital input setting then the pin will no loger reset the chip.

If you need to reset the device then you can do this by toggling the power off and on or by enabling the watchdog timer in your configuration settings and then allowing it to overflow in software. The watchdog timer is quite advanced so I would avoid this while you are getting to grips with the software and device architecture.

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Customized characters on the LCD

Post by alexander70 »

Thank you, how to do Autoclear watchdog timer in Flowcode 3? In Flowcode 4 I saw such an opportunity, but in FlowCode 3 I does not see how to make Autoclear watchdog timer.
Respectfully, Alexander

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:

Re: Customized characters on the LCD

Post by Benj »

Hello

Auto clear watchdog is a new feature for v4 and is not available in V3.

You can use the watchdog in v3 by using the c command clr_wtd(); to clear the timer.

If you have anything like second delays or millisecond delays larger then 1ms or 2ms in your program then you will need to break down these delays into sections using the clr_wdt(); command in between.

If you let the timer rollover then your device will perform a reset.

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Customized characters on the LCD

Post by alexander70 »

Thank you, I will try this. There is a problem at FlowCode 4 installation . What does this mean?
install problem.jpg
install problem.jpg (16.05 KiB) Viewed 15785 times
Respectfully, Alexander

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: Customized characters on the LCD

Post by Steve »

You can safely ignore this.

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Customized characters on the LCD

Post by alexander70 »

Thank you, I have successfully installed Flowcode4, but I have a problem, I can not open the menu Chip / Configure. What am I wrong?
problem2.jpg
problem2.jpg (17.57 KiB) Viewed 15804 times
Respectfully, Alexander

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: Customized characters on the LCD

Post by Steve »

Please post a screenshot of your compiler options window.

Post Reply