Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VHDL LCD programming on xilinx processor 1

Status
Not open for further replies.

Zentan

Programmer
Jan 13, 2004
7
SG
I am currently doing a mini-project on LCD programming using VHDL. I need some assistant in display character on the LCD.

Now I in a difficulty of wondering where and how to start.
I hope to have a skeleton or a struncture on displaying character on LCD.

Thanks!
 
A bit short of details so I will make a lot of assumptions:
Assuming you want to make an asci display on a dot matrix display:

You need a display memory organised, say 80 by 24 bytes.
You need horizontal and vertical counters, the vertical counts the carry from horizontal.
You need a character ROM that carries the form of each possible character, say 8x8 dots, ie 8 bytes per char. The character ROM address is the
ascii_value;vertical_counter(2 downto 0);horz(2 downto 0).
The ROM data must be serialised by a shift register, at the dot rate.

You have to figure out all the timing based on number of dots, refresh rate, etc. All are locked by multiples. The data needs to be pipelined.

Nuff for now,
Steve

 
I am currently doing a mini-project on LCD programming using VHDL. I need to interface my VHDL program to the xilinx and output to the LCD Display. I do not know where my VHDL program went wrong and cant interface to my xilinx I had written out the VHDL structure. Can you kindly help me check through my VHDL program??

Item Used:
Reset Button<=1
MTC-16201>16 chars X 2lines
>TN/STN reflective /EL/LED backlight
>Display font 5X7 dots + cursor
>1/16 duty drive


Explanation of LCD Program

LCD is connected as an output display to show the different types of hazard that is causing the alarm to trigger. The LCD is programmed to display the words ‘Naked Flame’, ‘Water Overflowing’, ‘Gas Leakage’ whenever the sensors connecting to them are activated. The LCD can be place in any part of the house to allow user to react to the different types of hazards as the buzzer is programmed only to produce one long buzz which will not inform the user which type of hazard is on. When none of the hazard is detected, the LCD will display “Welcome To Kitchen Safety System” until if:
• Gas Sensor ”GS” is logic ‘1’, the program will loop to count 118. LCD will then display “Gas Leakage” until the Reset button is pressed.
• Water Sensor “WS” is logic ‘0’ , the program will loop to count 189. LCD will then display “Water Overflowing” until the Reset button is pressed.
• Temperature Sensor “TS” is logic ‘1’, the program will loop to count . LCD will then display “Naked Flame” until the Reset button is pressed.
The ASCII representations of each individual character are being entered into the program and displayed on to the LCD screen.
‘RW’, ‘RS’, and ‘EN’ are the signal pins use to command the LCD.
• ‘RW’ has to be set to ‘1’ when reading a character from the LCD display.
• ‘RS’ has to be set to ‘1’ when selecting the data register and ‘0’ when selecting the instruction register. It is a signal pin to select either data register or instruction register.
• ‘EN’ is a signal pin that allows the LCD to proceed to the next instruction.



LCD Program

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;


entity lcd is
port (
RESET: in STD_LOGIC;
clk: in STD_LOGIC;
WS: in STD_LOGIC; -- water sensor
GS: in STD_LOGIC; -- gas sensor
TS: in STD_LOGIC; -- represent the heat sensor, infra-red
RS: out STD_LOGIC; -- select data register or instruction register
RW: out STD_LOGIC; -- high when reading a character from the LCD display
EN: out STD_LOGIC; -- that allows LCD to process to the next instruction
LCD: out STD_LOGIC_VECTOR (7 downto 0));
end lcd;

architecture lcd_arch of lcd is
begin
process (RESET, clk)
variable count: integer range 0 to 370;
variable time_count: integer range 0 to 3;
begin
if (RESET = '1') then
COUNT := 0;
time_count := 0;
RW <= '0';
RS <= '0';
EN <= '0';
LCD <= &quot;00000000&quot;;
elsif (clk'event and clk = '1') then
if (count = 380) then
count := count;
else
count := count + 1;
end if;

case count is
when 2 => EN <= '0';
when 3 => EN <= '1';
when 4 => RW <= '0';
RS <= '0';
LCD <= &quot;00110000&quot;; --initialisation
when 5 => EN <= '0';
when 6 => EN <= '1';
when 7 => RW <= '0';
RS <= '0';
LCD <= &quot;00110000&quot;; --initialisation
when 8 => EN <= '0';
when 9 => EN <= '1';
when 10 => RW <= '0';
RS <= '0';
LCD <= &quot;00111000&quot;; --function set
when 11 => EN <= '0';
when 12 => EN <= '1';
when 13 => RW <= '0';
RS <= '0';
LCD <= &quot;00001100&quot;; --display on/off control
when 14 => EN <= '0';
when 15 => EN <= '1';
when 16 => RW <= '0';
RS <= '0';
LCD <= &quot;00000110&quot;; --entry mode set
when 17 => EN <= '0';
when 18 => EN <= '1';
when 19 => RW <= '0';
RS <= '0';
LCD <= &quot;00000001&quot;; --clear display
when 20 => EN <= '0';
when 21 => EN <= '1';
when 22 => RW <= '0'; --writing character to LCD disp
RS <= '1'; --selecting the data register
LCD <= &quot;01010111&quot;; --W
when 23 => EN <= '0';
when 24 => EN <= '1';
when 25 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 26 => EN <= '0';
when 27 => EN <= '1';
when 28 => RW <= '0';
RS <= '1';
LCD <= &quot;01101100&quot;; --l
when 29 => EN <= '0';
when 30 => EN <= '1';
when 31 => RW <= '0';
RS <= '1';
LCD <= &quot;01100011&quot;; --c
when 32 => EN <= '0';
when 33 => EN <= '1';
when 34 => RW <= '0';
RS <= '1';
LCD <= &quot;01101111&quot;; --o
when 35 => EN <= '0';
when 36 => EN <= '1';
when 37 => RW <= '0';
RS <= '1';
LCD <= &quot;01101101&quot;; --m
when 38 => EN <= '0';
when 39 => EN <= '1';
when 40 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 41 => EN <= '0';
when 42 => EN <= '1';
when 43 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 44 => EN <= '0';
when 45 => EN <= '1';
when 46 => RW <= '0';
RS <= '1';
LCD <= &quot;01010100&quot;; --T
when 47 => EN <= '0';
when 48 => EN <= '1';
when 49 => RW <= '0';
RS <= '1';
LCD <= &quot;01101111&quot;; --o
when 50 => EN <= '0';
when 51 => EN <= '1';
when 52 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 53 => EN <= '0';
when 54 => EN <= '1';
when 55 => RW <= '0';
RS <= '1';
LCD <= &quot;01001011&quot;; --K
when 56 => EN <= '0';
when 57 => EN <= '1';
when 58 => RW <= '0';
RS <= '1';
LCD <= &quot;01101001&quot;; --i
when 59 => EN <= '0';
when 60 => EN <= '1';
when 61 => RW <= '0';
RS <= '1';
LCD <= &quot;01110100&quot;; --t
when 62 => EN <= '0';
when 63 => EN <= '1';
when 64 => RW <= '0';
RS <= '1';
LCD <= &quot;01100011&quot;; --c
when 65 => EN <= '0';
when 66 => EN <= '1';
when 67 => RW <= '0';
RS <= '0';
LCD <= &quot;01101000&quot;; --h
when 68 => EN <= '0';
when 69 => EN <= '1';
when 70 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 71 => EN <= '0';
when 72 => EN <= '1';
when 73 => RW <= '0';
RS <= '1';
LCD <= &quot;01101110&quot;; --n
when 74 => EN <= '0';
when 75 => EN <= '1';
when 76 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 77 => EN <= '0';
when 78 => EN <= '1';
when 79 => RW <= '0';
RS <= '1';
LCD <= &quot;01010011&quot;; --S
when 80 => EN <= '0';
when 81 => EN <= '1';
when 82 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 83 => EN <= '0';
when 84 => EN <= '1';
when 85 => RW <= '0';
RS <= '1';
LCD <= &quot;01100110&quot;; --f
when 86 => EN <= '0';
when 87 => EN <= '1';
when 88 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 89 => EN <= '0';
when 90 => EN <= '1';
when 91 => RW <= '0';
RS <= '1';
LCD <= &quot;01110100&quot;; --t
when 92 => EN <= '0';
when 93 => EN <= '1';
when 94 => RW <= '0';
RS <= '1';
LCD <= &quot;01111001&quot;; --y
when 95 => EN <= '0';
when 96 => EN <= '1';
when 97 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 98 => EN <= '0';
when 99 => EN <= '1';
when 100 => RW <= '0';
RS <= '1';
LCD <= &quot;01010011&quot;; --S
when 101 => EN <= '0';
when 102 => EN <= '1';
when 103 => RW <= '0';
RS <= '1';
LCD <= &quot;01111001&quot;; --y
when 104 => EN <= '0';
when 105 => EN <= '1';
when 106 => RW <= '0';
RS <= '1';
LCD <= &quot;01110011&quot;; --s
when 107 => EN <= '0';
when 108 => EN <= '1';
when 109 => RW <= '0';
RS <= '1';
LCD <= &quot;01110100&quot;; --t
when 110 => EN <= '0';
when 111 => EN <= '1';
when 112 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 113 => EN <= '0';
when 114 => EN <= '1';
when 115 => RW <= '0';
RS <= '1';
LCD <= &quot;01101101&quot;; --m


when 116 => EN <= '0';
when 117 => EN <= '1';

if (GS = '1') then
if (time_count = 1) then
count := 116;
else
count := 118; --loop to disp gas leakage
end if;
elsif (WS = '0') then
if (time_count = 2) then
count := 116;
else
count := 189; --loop to disp water overflowing
end if;
elsif (TS = '1') then
if (time_count = 3) then
count := 116;
else
count := 296; --loop to disp naked flame
end if;
else
count := 17;
end if;

when 118 => EN <= '0';
when 119 => EN <= '1';
when 120 => RW <= '0';
RS <= '0';
LCD <= &quot;00000001&quot;; --clear display
when 121 => EN <= '0';
when 122 => EN <= '1';
when 123 => RW <= '0';
RS <= '1';
LCD <= &quot;01000111&quot;; --G
when 124 => EN <= '0';
when 125 => EN <= '1';
when 126 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 127 => EN <= '0';
when 128 => EN <= '1';
when 129 => RW <= '0';
RS <= '1';
LCD <= &quot;01110011&quot;; --s
when 130 => EN <= '0';
when 131 => EN <= '1';
when 132 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 133 => EN <= '0';
when 134 => EN <= '1';
when 135 => RW <= '0';
RS <= '1';
LCD <= &quot;01001100&quot;; --L
when 136 => EN <= '0';
when 137 => EN <= '1';
when 138 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 139 => EN <= '0';
when 140 => EN <= '1';
when 141 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 142 => EN <= '0';
when 143 => EN <= '1';
when 144 => RW <= '0';
RS <= '1';
LCD <= &quot;01101011&quot;; --k
when 145 => EN <= '0';
when 146 => EN <= '1';
when 147 => RW <= '0';
RS <= '1';
LCD <= &quot;01100111&quot;; --a
when 148 => EN <= '0';
when 149 => EN <= '1';
when 150 => RW <= '0';
RS <= '1';
LCD <= &quot;01100111&quot;; --g
when 151 => EN <= '0';
when 152 => EN <= '1';
when 153 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 154 => EN <= '0';
when 155 => EN <= '1';
when 156 => RW <= '0';
RS <= '1';
LCD <= &quot;00010000&quot;; --shift
when 157 => EN <= '0';
when 158 => EN <= '1';
when 159 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 160 => EN <= '0';
when 161 => EN <= '1';
when 162 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 163 => EN <= '0';
when 164 => EN <= '1';
when 165 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 166 => EN <= '0';
when 167 => EN <= '1';
when 168 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 169 => EN <= '0';
when 170 => EN <= '1';
when 171 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 172 => EN <= '0';
when 173 => EN <= '1';
when 174 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 175 => EN <= '0';
when 176 => EN <= '1';
when 177 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 178 => EN <= '0';
when 179 => EN <= '1';
when 180 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 181 => EN <= '0';
when 182 => EN <= '1';
when 183 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 184 => EN <= '0';
when 185 => EN <= '1';
when 186 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift

when 187 => EN <= '0';
when 188 => EN <= '1';
time_count := 1;
count := 116; --loop back to check

when 189 => EN <= '0';
when 190 => EN <= '1';
when 191 => RW <= '0';
RS <= '0';
LCD <= &quot;00000001&quot;; --clear display
when 192 => EN <= '0';
when 193 => EN <= '1';
when 194 => RW <= '0';
RS <= '1';
LCD <= &quot;01010111&quot;; --W
when 195 => EN <= '0';
when 196 => EN <= '1';
when 197 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 198 => EN <= '0';
when 199 => EN <= '1';
when 200 => RW <= '0';
RS <= '1';
LCD <= &quot;01110100&quot;; --t
when 201 => EN <= '0';
when 202 => EN <= '1';
when 203 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 204 => EN <= '0';
when 205 => EN <= '1';
when 206 => RW <= '0';
RS <= '1';
LCD <= &quot;01110010&quot;; --r
when 207 => EN <= '0';
when 208 => EN <= '1';
when 209 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 210 => EN <= '0';
when 211 => EN <= '1';
when 212 => RW <= '0';
RS <= '1';
LCD <= &quot;01001111&quot;; --O
when 213 => EN <= '0';
when 214 => EN <= '1';
when 215 => RW <= '0';
RS <= '1';
LCD <= &quot;01110110&quot;; --v
when 216 => EN <= '0';
when 217 => EN <= '1';
when 218 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 219 => EN <= '0';
when 220 => EN <= '1';
when 221 => RW <= '0';
RS <= '0';
LCD <= &quot;01110010&quot;; --r
when 222 => EN <= '0';
when 223 => EN <= '1';
when 224 => RW <= '0';
RS <= '1';
LCD <= &quot;01100110&quot;; --f
when 225 => EN <= '0';
when 226 => EN <= '1';
when 227 => RW <= '0';
RS <= '1';
LCD <= &quot;01011000&quot;; --l
when 228 => EN <= '0';
when 229 => EN <= '1';
when 230 => RW <= '0';
RS <= '1';
LCD <= &quot;01101111&quot;; --o
when 231 => EN <= '0';
when 232 => EN <= '1';
when 233 => RW <= '0';
RS <= '1';
LCD <= &quot;01110111&quot;; --w
when 234 => EN <= '0';
when 235 => EN <= '1';
when 236 => RW <= '0';
RS <= '1';
LCD <= &quot;01101001&quot;; --i
when 237 => EN <= '0';
when 238 => EN <= '1';
when 239 => RW <= '0';
RS <= '1';
LCD <= &quot;01101110&quot;; --n
when 240 => EN <= '0';
when 241 => EN <= '1';
when 242 => RW <= '0';
RS <= '1';
LCD <= &quot;01100111&quot;; --g
when 243 => EN <= '0';
when 244 => EN <= '1';
when 245 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 246 => EN <= '0';
when 247 => EN <= '1';
when 248 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 249 => EN <= '0';
when 250 => EN <= '1';
when 251 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 252 => EN <= '0';
when 253 => EN <= '1';
when 254 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 255 => EN <= '0';
when 256 => EN <= '1';
when 257 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 258 => EN <= '0';
when 259 => EN <= '1';
when 260 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 261 => EN <= '0';
when 262 => EN <= '1';
when 263 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 264 => EN <= '0';
when 265 => EN <= '1';
when 266 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 267 => EN <= '0';
when 268 => EN <= '1';
when 269 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 270 => EN <= '0';
when 271 => EN <= '1';
when 272 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 273 => EN <= '0';
when 274 => EN <= '1';
when 275 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 276 => EN <= '0';
when 277 => EN <= '1';
when 278 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 279 => EN <= '0';
when 280 => EN <= '1';
when 281 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 282 => EN <= '0';
when 283 => EN <= '1';
when 284 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 285 => EN <= '0';
when 286 => EN <= '1';
when 287 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 288 => EN <= '0';
when 289 => EN <= '1';
when 290 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 291 => EN <= '0';
when 292 => EN <= '1';
when 293 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 294 => EN <= '0';
when 295 => EN <= '1';
time_count := 2;
count := 116; --loop back to check

when 296 => EN <= '0';
when 297 => EN <= '1';
when 298 => RW <= '0';
RS <= '0';
LCD <= &quot;00000001&quot;; --clear display
when 299 => EN <= '0';
when 300 => EN <= '1';
when 301 => RW <= '0';
RS <= '1';
LCD <= &quot;01001110&quot;; --N
when 302 => EN <= '0';
when 303 => EN <= '1';
when 304 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 305 => EN <= '0';
when 306 => EN <= '1';
when 307 => RW <= '0';
RS <= '1';
LCD <= &quot;01101011&quot;; --k
when 308 => EN <= '0';
when 309 => EN <= '1';
when 310 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 311 => EN <= '0';
when 312 => EN <= '1';
when 313 => RW <= '0';
RS <= '1';
LCD <= &quot;01100100&quot;; --d
when 314 => EN <= '0';
when 315 => EN <= '1';
when 316 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 317 => EN <= '0';
when 318 => EN <= '1';
when 319 => RW <= '0';
RS <= '1';
LCD <= &quot;01000110&quot;; --F
when 320 => EN <= '0';
when 321 => EN <= '1';
when 322 => RW <= '0';
RS <= '1';
LCD <= &quot;01101100&quot;; --l
when 323 => EN <= '0';
when 324 => EN <= '1';
when 325 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 326 => EN <= '0';
when 327 => EN <= '1';
when 328 => RW <= '0';
RS <= '1';
LCD <= &quot;01101101&quot;; --m
when 329 => EN <= '0';
when 330 => EN <= '1';
when 331 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 332 => EN <= '0';
when 333 => EN <= '1';
when 334 => RW <= '0';
RS <= '1';
LCD <= &quot;01000001&quot;; --shift
when 335 => EN <= '0';
when 336 => EN <= '1';
when 337 => RW <= '0';
RS <= '1';
LCD <= &quot;00010000&quot;; --shift
when 338 => EN <= '0';
when 339 => EN <= '1';
when 340 => RW <= '0';
RS <= '1';
LCD <= &quot;00010000&quot;; --shift
when 341 => EN <= '0';
when 342 => EN <= '1';
when 343 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 344 => EN <= '0';
when 345 => EN <= '1';
when 346 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 347 => EN <= '0';
when 348 => EN <= '1';
when 349 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 350 => EN <= '0';
when 351 => EN <= '1';
when 352 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 353 => EN <= '0';
when 354 => EN <= '1';
when 355 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 356 => EN <= '0';
when 357 => EN <= '1';
when 358 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 359 => EN <= '0';
when 360 => EN <= '1';
when 361 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 362 => EN <= '0';
when 363 => EN <= '1';
when 364 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 365 => EN <= '0';
when 366 => EN <= '1';
time_count := 3;
count := 116; --loop back to check
when 367 => EN <= '0';
when others => EN <= '0';
count := count; --end
end case;
end if;
end process;
end lcd_arch;

 
I am currently doing a mini-project on LCD programming using VHDL. I need to interface my VHDL program to the xilinx and output to the LCD Display. I do not know where my VHDL program went wrong and cant interface to my xilinx. I had written out the VHDL structure. Can you kindly help me check through my VHDL program?? i will really appreaciate it. Thanks!
i'm so Sorry, the VHDL program i attached perviously is incomplete. Sorry for any inconvenient.

Item Used:
Reset Button<=1
MTC-16201>16 chars X 2lines
>TN/STN reflective /EL/LED backlight
>Display font 5X7 dots + cursor
>1/16 duty drive


Explanation of LCD Program

LCD is connected as an output display to show the different types of hazard that is causing the alarm to trigger. The LCD is programmed to display the words ‘Naked Flame’, ‘Water Overflowing’, ‘Gas Leakage’ whenever the sensors connecting to them are activated. The LCD can be place in any part of the house to allow user to react to the different types of hazards as the buzzer is programmed only to produce one long buzz which will not inform the user which type of hazard is on. When none of the hazard is detected, the LCD will display “Welcome To Kitchen Safety System” until if:
• Gas Sensor ”GS” is logic ‘1’, the program will loop to count 118. LCD will then display “Gas Leakage” until the Reset button is pressed.
• Water Sensor “WS” is logic ‘0’ , the program will loop to count 189. LCD will then display “Water Overflowing” until the Reset button is pressed.
• Temperature Sensor “TS” is logic ‘1’, the program will loop to count . LCD will then display “Naked Flame” until the Reset button is pressed.
The ASCII representations of each individual character are being entered into the program and displayed on to the LCD screen.
‘RW’, ‘RS’, and ‘EN’ are the signal pins use to command the LCD.
• ‘RW’ has to be set to ‘1’ when reading a character from the LCD display.
• ‘RS’ has to be set to ‘1’ when selecting the data register and ‘0’ when selecting the instruction register. It is a signal pin to select either data register or instruction register.
• ‘EN’ is a signal pin that allows the LCD to proceed to the next instruction.

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;

entity lcd is
port (
RESET: in STD_LOGIC;
clk: in STD_LOGIC;
WS: in STD_LOGIC; -- water sensor
GS: in STD_LOGIC; -- gas sensor
TS: in STD_LOGIC; -- represent the heat sensor, infra-red
RS: out STD_LOGIC; -- select data register or instruction register
RW: out STD_LOGIC; -- high when reading a character from the LCD display
EN: out STD_LOGIC; -- that allows LCD to process to the next instruction
LCD: out STD_LOGIC_VECTOR (7 downto 0)
);
end lcd;

architecture lcd_arch of lcd is
begin
process (RESET, clk)
variable count: integer range 0 to 370;
variable time_count: integer range 0 to 3;
begin
if (RESET = '1') then
COUNT := 0;
time_count := 0;
RW <= '0';
RS <= '0';
EN <= '0';
LCD <= &quot;00000000&quot;;
elsif (clk'event and clk = '1') then
if (count = 380) then
count := count;
else
count := count + 1;
end if;

case count is
when 2 => EN <= '0';
when 3 => EN <= '1';
when 4 => RW <= '0';
RS <= '0';
LCD <= &quot;00110000&quot;; --initialisation
when 5 => EN <= '0';
when 6 => EN <= '1';
when 7 => RW <= '0';
RS <= '0';
LCD <= &quot;00110000&quot;; --initialisation
when 8 => EN <= '0';
when 9 => EN <= '1';
when 10 => RW <= '0';
RS <= '0';
LCD <= &quot;00111000&quot;; --function set
when 11 => EN <= '0';
when 12 => EN <= '1';
when 13 => RW <= '0';
RS <= '0';
LCD <= &quot;00001100&quot;; --display on/off control
when 14 => EN <= '0';
when 15 => EN <= '1';
when 16 => RW <= '0';
RS <= '0';
LCD <= &quot;00000110&quot;; --entry mode set
when 17 => EN <= '0';
when 18 => EN <= '1';
when 19 => RW <= '0';
RS <= '0';
LCD <= &quot;00000001&quot;; --clear display
when 20 => EN <= '0';
when 21 => EN <= '1';
when 22 => RW <= '0'; --writing character to LCD disp
RS <= '1'; --selecting the data register
LCD <= &quot;01010111&quot;; --W
when 23 => EN <= '0';
when 24 => EN <= '1';
when 25 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 26 => EN <= '0';
when 27 => EN <= '1';
when 28 => RW <= '0';
RS <= '1';
LCD <= &quot;01101100&quot;; --l
when 29 => EN <= '0';
when 30 => EN <= '1';
when 31 => RW <= '0';
RS <= '1';
LCD <= &quot;01100011&quot;; --c
when 32 => EN <= '0';
when 33 => EN <= '1';
when 34 => RW <= '0';
RS <= '1';
LCD <= &quot;01101111&quot;; --o
when 35 => EN <= '0';
when 36 => EN <= '1';
when 37 => RW <= '0';
RS <= '1';
LCD <= &quot;01101101&quot;; --m
when 38 => EN <= '0';
when 39 => EN <= '1';
when 40 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 41 => EN <= '0';
when 42 => EN <= '1';
when 43 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 44 => EN <= '0';
when 45 => EN <= '1';
when 46 => RW <= '0';
RS <= '1';
LCD <= &quot;01010100&quot;; --T
when 47 => EN <= '0';
when 48 => EN <= '1';
when 49 => RW <= '0';
RS <= '1';
LCD <= &quot;01101111&quot;; --o
when 50 => EN <= '0';
when 51 => EN <= '1';
when 52 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 53 => EN <= '0';
when 54 => EN <= '1';
when 55 => RW <= '0';
RS <= '1';
LCD <= &quot;01001011&quot;; --K
when 56 => EN <= '0';
when 57 => EN <= '1';
when 58 => RW <= '0';
RS <= '1';
LCD <= &quot;01101001&quot;; --i
when 59 => EN <= '0';
when 60 => EN <= '1';
when 61 => RW <= '0';
RS <= '1';
LCD <= &quot;01110100&quot;; --t
when 62 => EN <= '0';
when 63 => EN <= '1';
when 64 => RW <= '0';
RS <= '1';
LCD <= &quot;01100011&quot;; --c
when 65 => EN <= '0';
when 66 => EN <= '1';
when 67 => RW <= '0';
RS <= '0';
LCD <= &quot;01101000&quot;; --h
when 68 => EN <= '0';
when 69 => EN <= '1';
when 70 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 71 => EN <= '0';
when 72 => EN <= '1';
when 73 => RW <= '0';
RS <= '1';
LCD <= &quot;01101110&quot;; --n
when 74 => EN <= '0';
when 75 => EN <= '1';
when 76 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 77 => EN <= '0';
when 78 => EN <= '1';
when 79 => RW <= '0';
RS <= '1';
LCD <= &quot;01010011&quot;; --S
when 80 => EN <= '0';
when 81 => EN <= '1';
when 82 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 83 => EN <= '0';
when 84 => EN <= '1';
when 85 => RW <= '0';
RS <= '1';
LCD <= &quot;01100110&quot;; --f
when 86 => EN <= '0';
when 87 => EN <= '1';
when 88 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 89 => EN <= '0';
when 90 => EN <= '1';
when 91 => RW <= '0';
RS <= '1';
LCD <= &quot;01110100&quot;; --t
when 92 => EN <= '0';
when 93 => EN <= '1';
when 94 => RW <= '0';
RS <= '1';
LCD <= &quot;01111001&quot;; --y
when 95 => EN <= '0';
when 96 => EN <= '1';
when 97 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 98 => EN <= '0';
when 99 => EN <= '1';
when 100 => RW <= '0';
RS <= '1';
LCD <= &quot;01010011&quot;; --S
when 101 => EN <= '0';
when 102 => EN <= '1';
when 103 => RW <= '0';
RS <= '1';
LCD <= &quot;01111001&quot;; --y
when 104 => EN <= '0';
when 105 => EN <= '1';
when 106 => RW <= '0';
RS <= '1';
LCD <= &quot;01110011&quot;; --s
when 107 => EN <= '0';
when 108 => EN <= '1';
when 109 => RW <= '0';
RS <= '1';
LCD <= &quot;01110100&quot;; --t
when 110 => EN <= '0';
when 111 => EN <= '1';
when 112 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 113 => EN <= '0';
when 114 => EN <= '1';
when 115 => RW <= '0';
RS <= '1';
LCD <= &quot;01101101&quot;; --m


when 116 => EN <= '0';
when 117 => EN <= '1';

if (GS = '1') then
if (time_count = 1) then
count := 116;
else
count := 118; --loop to disp gas leakage
end if;
elsif (WS = '0') then
if (time_count = 2) then
count := 116;
else
count := 189; --loop to disp water overflowing
end if;
elsif (TS = '1') then
if (time_count = 3) then
count := 116;
else
count := 296; --loop to disp naked flame
end if;
else
count := 17;
end if;

when 118 => EN <= '0';
when 119 => EN <= '1';
when 120 => RW <= '0';
RS <= '0';
LCD <= &quot;00000001&quot;; --clear display
when 121 => EN <= '0';
when 122 => EN <= '1';
when 123 => RW <= '0';
RS <= '1';
LCD <= &quot;01000111&quot;; --G
when 124 => EN <= '0';
when 125 => EN <= '1';
when 126 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 127 => EN <= '0';
when 128 => EN <= '1';
when 129 => RW <= '0';
RS <= '1';
LCD <= &quot;01110011&quot;; --s
when 130 => EN <= '0';
when 131 => EN <= '1';
when 132 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 133 => EN <= '0';
when 134 => EN <= '1';
when 135 => RW <= '0';
RS <= '1';
LCD <= &quot;01001100&quot;; --L
when 136 => EN <= '0';
when 137 => EN <= '1';
when 138 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 139 => EN <= '0';
when 140 => EN <= '1';
when 141 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 142 => EN <= '0';
when 143 => EN <= '1';
when 144 => RW <= '0';
RS <= '1';
LCD <= &quot;01101011&quot;; --k
when 145 => EN <= '0';
when 146 => EN <= '1';
when 147 => RW <= '0';
RS <= '1';
LCD <= &quot;01100111&quot;; --a
when 148 => EN <= '0';
when 149 => EN <= '1';
when 150 => RW <= '0';
RS <= '1';
LCD <= &quot;01100111&quot;; --g
when 151 => EN <= '0';
when 152 => EN <= '1';
when 153 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 154 => EN <= '0';
when 155 => EN <= '1';
when 156 => RW <= '0';
RS <= '1';
LCD <= &quot;00010000&quot;; --shift
when 157 => EN <= '0';
when 158 => EN <= '1';
when 159 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 160 => EN <= '0';
when 161 => EN <= '1';
when 162 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 163 => EN <= '0';
when 164 => EN <= '1';
when 165 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 166 => EN <= '0';
when 167 => EN <= '1';
when 168 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 169 => EN <= '0';
when 170 => EN <= '1';
when 171 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 172 => EN <= '0';
when 173 => EN <= '1';
when 174 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 175 => EN <= '0';
when 176 => EN <= '1';
when 177 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 178 => EN <= '0';
when 179 => EN <= '1';
when 180 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 181 => EN <= '0';
when 182 => EN <= '1';
when 183 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 184 => EN <= '0';
when 185 => EN <= '1';
when 186 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift

when 187 => EN <= '0';
when 188 => EN <= '1';
time_count := 1;
count := 116; --loop back to check

when 189 => EN <= '0';
when 190 => EN <= '1';
when 191 => RW <= '0';
RS <= '0';
LCD <= &quot;00000001&quot;; --clear display
when 192 => EN <= '0';
when 193 => EN <= '1';
when 194 => RW <= '0';
RS <= '1';
LCD <= &quot;01010111&quot;; --W
when 195 => EN <= '0';
when 196 => EN <= '1';
when 197 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 198 => EN <= '0';
when 199 => EN <= '1';
when 200 => RW <= '0';
RS <= '1';
LCD <= &quot;01110100&quot;; --t
when 201 => EN <= '0';
when 202 => EN <= '1';
when 203 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 204 => EN <= '0';
when 205 => EN <= '1';
when 206 => RW <= '0';
RS <= '1';
LCD <= &quot;01110010&quot;; --r
when 207 => EN <= '0';
when 208 => EN <= '1';
when 209 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 210 => EN <= '0';
when 211 => EN <= '1';
when 212 => RW <= '0';
RS <= '1';
LCD <= &quot;01001111&quot;; --O
when 213 => EN <= '0';
when 214 => EN <= '1';
when 215 => RW <= '0';
RS <= '1';
LCD <= &quot;01110110&quot;; --v
when 216 => EN <= '0';
when 217 => EN <= '1';
when 218 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 219 => EN <= '0';
when 220 => EN <= '1';
when 221 => RW <= '0';
RS <= '0';
LCD <= &quot;01110010&quot;; --r
when 222 => EN <= '0';
when 223 => EN <= '1';
when 224 => RW <= '0';
RS <= '1';
LCD <= &quot;01100110&quot;; --f
when 225 => EN <= '0';
when 226 => EN <= '1';
when 227 => RW <= '0';
RS <= '1';
LCD <= &quot;01011000&quot;; --l
when 228 => EN <= '0';
when 229 => EN <= '1';
when 230 => RW <= '0';
RS <= '1';
LCD <= &quot;01101111&quot;; --o
when 231 => EN <= '0';
when 232 => EN <= '1';
when 233 => RW <= '0';
RS <= '1';
LCD <= &quot;01110111&quot;; --w
when 234 => EN <= '0';
when 235 => EN <= '1';
when 236 => RW <= '0';
RS <= '1';
LCD <= &quot;01101001&quot;; --i
when 237 => EN <= '0';
when 238 => EN <= '1';
when 239 => RW <= '0';
RS <= '1';
LCD <= &quot;01101110&quot;; --n
when 240 => EN <= '0';
when 241 => EN <= '1';
when 242 => RW <= '0';
RS <= '1';
LCD <= &quot;01100111&quot;; --g
when 243 => EN <= '0';
when 244 => EN <= '1';
when 245 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 246 => EN <= '0';
when 247 => EN <= '1';
when 248 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 249 => EN <= '0';
when 250 => EN <= '1';
when 251 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 252 => EN <= '0';
when 253 => EN <= '1';
when 254 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 255 => EN <= '0';
when 256 => EN <= '1';
when 257 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 258 => EN <= '0';
when 259 => EN <= '1';
when 260 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 261 => EN <= '0';
when 262 => EN <= '1';
when 263 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 264 => EN <= '0';
when 265 => EN <= '1';
when 266 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 267 => EN <= '0';
when 268 => EN <= '1';
when 269 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 270 => EN <= '0';
when 271 => EN <= '1';
when 272 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 273 => EN <= '0';
when 274 => EN <= '1';
when 275 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 276 => EN <= '0';
when 277 => EN <= '1';
when 278 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 279 => EN <= '0';
when 280 => EN <= '1';
when 281 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 282 => EN <= '0';
when 283 => EN <= '1';
when 284 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 285 => EN <= '0';
when 286 => EN <= '1';
when 287 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 288 => EN <= '0';
when 289 => EN <= '1';
when 290 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 291 => EN <= '0';
when 292 => EN <= '1';
when 293 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 294 => EN <= '0';
when 295 => EN <= '1';
time_count := 2;
count := 116; --loop back to check

when 296 => EN <= '0';
when 297 => EN <= '1';
when 298 => RW <= '0';
RS <= '0';
LCD <= &quot;00000001&quot;; --clear display
when 299 => EN <= '0';
when 300 => EN <= '1';
when 301 => RW <= '0';
RS <= '1';
LCD <= &quot;01001110&quot;; --N
when 302 => EN <= '0';
when 303 => EN <= '1';
when 304 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 305 => EN <= '0';
when 306 => EN <= '1';
when 307 => RW <= '0';
RS <= '1';
LCD <= &quot;01101011&quot;; --k
when 308 => EN <= '0';
when 309 => EN <= '1';
when 310 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 311 => EN <= '0';
when 312 => EN <= '1';
when 313 => RW <= '0';
RS <= '1';
LCD <= &quot;01100100&quot;; --d
when 314 => EN <= '0';
when 315 => EN <= '1';
when 316 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 317 => EN <= '0';
when 318 => EN <= '1';
when 319 => RW <= '0';
RS <= '1';
LCD <= &quot;01000110&quot;; --F
when 320 => EN <= '0';
when 321 => EN <= '1';
when 322 => RW <= '0';
RS <= '1';
LCD <= &quot;01101100&quot;; --l
when 323 => EN <= '0';
when 324 => EN <= '1';
when 325 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 326 => EN <= '0';
when 327 => EN <= '1';
when 328 => RW <= '0';
RS <= '1';
LCD <= &quot;01101101&quot;; --m
when 329 => EN <= '0';
when 330 => EN <= '1';
when 331 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 332 => EN <= '0';
when 333 => EN <= '1';
when 334 => RW <= '0';
RS <= '1';
LCD <= &quot;01000001&quot;; --shift
when 335 => EN <= '0';
when 336 => EN <= '1';
when 337 => RW <= '0';
RS <= '1';
LCD <= &quot;00010000&quot;; --shift
when 338 => EN <= '0';
when 339 => EN <= '1';
when 340 => RW <= '0';
RS <= '1';
LCD <= &quot;00010000&quot;; --shift
when 341 => EN <= '0';
when 342 => EN <= '1';
when 343 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 344 => EN <= '0';
when 345 => EN <= '1';
when 346 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 347 => EN <= '0';
when 348 => EN <= '1';
when 349 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 350 => EN <= '0';
when 351 => EN <= '1';
when 352 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 353 => EN <= '0';
when 354 => EN <= '1';
when 355 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 356 => EN <= '0';
when 357 => EN <= '1';
when 358 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 359 => EN <= '0';
when 360 => EN <= '1';
when 361 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 362 => EN <= '0';
when 363 => EN <= '1';
when 364 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 365 => EN <= '0';
when 366 => EN <= '1';
time_count := 3;
count := 116; --loop back to check
when 367 => EN <= '0';
when others => EN <= '0';
count := count; --end
end case;
end if;
end process;
end lcd_arch;
 
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;

entity lcd is
port (
RESET: in STD_LOGIC;
clk: in STD_LOGIC;
WS: in STD_LOGIC; -- water sensor
GS: in STD_LOGIC; -- gas sensor
TS: in STD_LOGIC; -- represent the heat sensor, infra-red
RS: out STD_LOGIC; -- select data register or instruction register
RW: out STD_LOGIC; -- high when reading a character from the LCD display
EN: out STD_LOGIC; -- that allows LCD to process to the next instruction
LCD: out STD_LOGIC_VECTOR (7 downto 0)
);
end lcd;

architecture lcd_arch of lcd is
begin
process (RESET, clk)
variable count: integer range 0 to 370;
variable time_count: integer range 0 to 3;
begin
if (RESET = '1') then
COUNT := 0;
time_count := 0;
RW <= '0';
RS <= '0';
EN <= '0';
LCD <= &quot;00000000&quot;;
elsif (clk'event and clk = '1') then
if (count = 380) then
count := count;
else
count := count + 1;
end if;

case count is
when 2 => EN <= '0';
when 3 => EN <= '1';
when 4 => RW <= '0';
RS <= '0';
LCD <= &quot;00110000&quot;; --initialisation
when 5 => EN <= '0';
when 6 => EN <= '1';
when 7 => RW <= '0';
RS <= '0';
LCD <= &quot;00110000&quot;; --initialisation
when 8 => EN <= '0';
when 9 => EN <= '1';
when 10 => RW <= '0';
RS <= '0';
LCD <= &quot;00111000&quot;; --function set
when 11 => EN <= '0';
when 12 => EN <= '1';
when 13 => RW <= '0';
RS <= '0';
LCD <= &quot;00001100&quot;; --display on/off control
when 14 => EN <= '0';
when 15 => EN <= '1';
when 16 => RW <= '0';
RS <= '0';
LCD <= &quot;00000110&quot;; --entry mode set
when 17 => EN <= '0';
when 18 => EN <= '1';
when 19 => RW <= '0';
RS <= '0';
LCD <= &quot;00000001&quot;; --clear display
when 20 => EN <= '0';
when 21 => EN <= '1';
when 22 => RW <= '0'; --writing character to LCD disp
RS <= '1'; --selecting the data register
LCD <= &quot;01010111&quot;; --W
when 23 => EN <= '0';
when 24 => EN <= '1';
when 25 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 26 => EN <= '0';
when 27 => EN <= '1';
when 28 => RW <= '0';
RS <= '1';
LCD <= &quot;01101100&quot;; --l
when 29 => EN <= '0';
when 30 => EN <= '1';
when 31 => RW <= '0';
RS <= '1';
LCD <= &quot;01100011&quot;; --c
when 32 => EN <= '0';
when 33 => EN <= '1';
when 34 => RW <= '0';
RS <= '1';
LCD <= &quot;01101111&quot;; --o
when 35 => EN <= '0';
when 36 => EN <= '1';
when 37 => RW <= '0';
RS <= '1';
LCD <= &quot;01101101&quot;; --m
when 38 => EN <= '0';
when 39 => EN <= '1';
when 40 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 41 => EN <= '0';
when 42 => EN <= '1';
when 43 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 44 => EN <= '0';
when 45 => EN <= '1';
when 46 => RW <= '0';
RS <= '1';
LCD <= &quot;01010100&quot;; --T
when 47 => EN <= '0';
when 48 => EN <= '1';
when 49 => RW <= '0';
RS <= '1';
LCD <= &quot;01101111&quot;; --o
when 50 => EN <= '0';
when 51 => EN <= '1';
when 52 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 53 => EN <= '0';
when 54 => EN <= '1';
when 55 => RW <= '0';
RS <= '1';
LCD <= &quot;01001011&quot;; --K
when 56 => EN <= '0';
when 57 => EN <= '1';
when 58 => RW <= '0';
RS <= '1';
LCD <= &quot;01101001&quot;; --i
when 59 => EN <= '0';
when 60 => EN <= '1';
when 61 => RW <= '0';
RS <= '1';
LCD <= &quot;01110100&quot;; --t
when 62 => EN <= '0';
when 63 => EN <= '1';
when 64 => RW <= '0';
RS <= '1';
LCD <= &quot;01100011&quot;; --c
when 65 => EN <= '0';
when 66 => EN <= '1';
when 67 => RW <= '0';
RS <= '0';
LCD <= &quot;01101000&quot;; --h
when 68 => EN <= '0';
when 69 => EN <= '1';
when 70 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 71 => EN <= '0';
when 72 => EN <= '1';
when 73 => RW <= '0';
RS <= '1';
LCD <= &quot;01101110&quot;; --n
when 74 => EN <= '0';
when 75 => EN <= '1';
when 76 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 77 => EN <= '0';
when 78 => EN <= '1';
when 79 => RW <= '0';
RS <= '1';
LCD <= &quot;01010011&quot;; --S
when 80 => EN <= '0';
when 81 => EN <= '1';
when 82 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 83 => EN <= '0';
when 84 => EN <= '1';
when 85 => RW <= '0';
RS <= '1';
LCD <= &quot;01100110&quot;; --f
when 86 => EN <= '0';
when 87 => EN <= '1';
when 88 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 89 => EN <= '0';
when 90 => EN <= '1';
when 91 => RW <= '0';
RS <= '1';
LCD <= &quot;01110100&quot;; --t
when 92 => EN <= '0';
when 93 => EN <= '1';
when 94 => RW <= '0';
RS <= '1';
LCD <= &quot;01111001&quot;; --y
when 95 => EN <= '0';
when 96 => EN <= '1';
when 97 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 98 => EN <= '0';
when 99 => EN <= '1';
when 100 => RW <= '0';
RS <= '1';
LCD <= &quot;01010011&quot;; --S
when 101 => EN <= '0';
when 102 => EN <= '1';
when 103 => RW <= '0';
RS <= '1';
LCD <= &quot;01111001&quot;; --y
when 104 => EN <= '0';
when 105 => EN <= '1';
when 106 => RW <= '0';
RS <= '1';
LCD <= &quot;01110011&quot;; --s
when 107 => EN <= '0';
when 108 => EN <= '1';
when 109 => RW <= '0';
RS <= '1';
LCD <= &quot;01110100&quot;; --t
when 110 => EN <= '0';
when 111 => EN <= '1';
when 112 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 113 => EN <= '0';
when 114 => EN <= '1';
when 115 => RW <= '0';
RS <= '1';
LCD <= &quot;01101101&quot;; --m


when 116 => EN <= '0';
when 117 => EN <= '1';

if (GS = '1') then
if (time_count = 1) then
count := 116;
else
count := 118; --loop to disp gas leakage
end if;
elsif (WS = '0') then
if (time_count = 2) then
count := 116;
else
count := 189; --loop to disp water overflowing
end if;
elsif (TS = '1') then
if (time_count = 3) then
count := 116;
else
count := 296; --loop to disp naked flame
end if;
else
count := 17;
end if;

when 118 => EN <= '0';
when 119 => EN <= '1';
when 120 => RW <= '0';
RS <= '0';
LCD <= &quot;00000001&quot;; --clear display
when 121 => EN <= '0';
when 122 => EN <= '1';
when 123 => RW <= '0';
RS <= '1';
LCD <= &quot;01000111&quot;; --G
when 124 => EN <= '0';
when 125 => EN <= '1';
when 126 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 127 => EN <= '0';
when 128 => EN <= '1';
when 129 => RW <= '0';
RS <= '1';
LCD <= &quot;01110011&quot;; --s
when 130 => EN <= '0';
when 131 => EN <= '1';
when 132 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 133 => EN <= '0';
when 134 => EN <= '1';
when 135 => RW <= '0';
RS <= '1';
LCD <= &quot;01001100&quot;; --L
when 136 => EN <= '0';
when 137 => EN <= '1';
when 138 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 139 => EN <= '0';
when 140 => EN <= '1';
when 141 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 142 => EN <= '0';
when 143 => EN <= '1';
when 144 => RW <= '0';
RS <= '1';
LCD <= &quot;01101011&quot;; --k
when 145 => EN <= '0';
when 146 => EN <= '1';
when 147 => RW <= '0';
RS <= '1';
LCD <= &quot;01100111&quot;; --a
when 148 => EN <= '0';
when 149 => EN <= '1';
when 150 => RW <= '0';
RS <= '1';
LCD <= &quot;01100111&quot;; --g
when 151 => EN <= '0';
when 152 => EN <= '1';
when 153 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 154 => EN <= '0';
when 155 => EN <= '1';
when 156 => RW <= '0';
RS <= '1';
LCD <= &quot;00010000&quot;; --shift
when 157 => EN <= '0';
when 158 => EN <= '1';
when 159 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 160 => EN <= '0';
when 161 => EN <= '1';
when 162 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 163 => EN <= '0';
when 164 => EN <= '1';
when 165 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 166 => EN <= '0';
when 167 => EN <= '1';
when 168 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 169 => EN <= '0';
when 170 => EN <= '1';
when 171 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 172 => EN <= '0';
when 173 => EN <= '1';
when 174 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 175 => EN <= '0';
when 176 => EN <= '1';
when 177 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 178 => EN <= '0';
when 179 => EN <= '1';
when 180 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 181 => EN <= '0';
when 182 => EN <= '1';
when 183 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 184 => EN <= '0';
when 185 => EN <= '1';
when 186 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift

when 187 => EN <= '0';
when 188 => EN <= '1';
time_count := 1;
count := 116; --loop back to check

when 189 => EN <= '0';
when 190 => EN <= '1';
when 191 => RW <= '0';
RS <= '0';
LCD <= &quot;00000001&quot;; --clear display
when 192 => EN <= '0';
when 193 => EN <= '1';
when 194 => RW <= '0';
RS <= '1';
LCD <= &quot;01010111&quot;; --W
when 195 => EN <= '0';
when 196 => EN <= '1';
when 197 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 198 => EN <= '0';
when 199 => EN <= '1';
when 200 => RW <= '0';
RS <= '1';
LCD <= &quot;01110100&quot;; --t
when 201 => EN <= '0';
when 202 => EN <= '1';
when 203 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 204 => EN <= '0';
when 205 => EN <= '1';
when 206 => RW <= '0';
RS <= '1';
LCD <= &quot;01110010&quot;; --r
when 207 => EN <= '0';
when 208 => EN <= '1';
when 209 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 210 => EN <= '0';
when 211 => EN <= '1';
when 212 => RW <= '0';
RS <= '1';
LCD <= &quot;01001111&quot;; --O
when 213 => EN <= '0';
when 214 => EN <= '1';
when 215 => RW <= '0';
RS <= '1';
LCD <= &quot;01110110&quot;; --v
when 216 => EN <= '0';
when 217 => EN <= '1';
when 218 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 219 => EN <= '0';
when 220 => EN <= '1';
when 221 => RW <= '0';
RS <= '0';
LCD <= &quot;01110010&quot;; --r
when 222 => EN <= '0';
when 223 => EN <= '1';
when 224 => RW <= '0';
RS <= '1';
LCD <= &quot;01100110&quot;; --f
when 225 => EN <= '0';
when 226 => EN <= '1';
when 227 => RW <= '0';
RS <= '1';
LCD <= &quot;01011000&quot;; --l
when 228 => EN <= '0';
when 229 => EN <= '1';
when 230 => RW <= '0';
RS <= '1';
LCD <= &quot;01101111&quot;; --o
when 231 => EN <= '0';
when 232 => EN <= '1';
when 233 => RW <= '0';
RS <= '1';
LCD <= &quot;01110111&quot;; --w
when 234 => EN <= '0';
when 235 => EN <= '1';
when 236 => RW <= '0';
RS <= '1';
LCD <= &quot;01101001&quot;; --i
when 237 => EN <= '0';
when 238 => EN <= '1';
when 239 => RW <= '0';
RS <= '1';
LCD <= &quot;01101110&quot;; --n
when 240 => EN <= '0';
when 241 => EN <= '1';
when 242 => RW <= '0';
RS <= '1';
LCD <= &quot;01100111&quot;; --g
when 243 => EN <= '0';
when 244 => EN <= '1';
when 245 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 246 => EN <= '0';
when 247 => EN <= '1';
when 248 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 249 => EN <= '0';
when 250 => EN <= '1';
when 251 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 252 => EN <= '0';
when 253 => EN <= '1';
when 254 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 255 => EN <= '0';
when 256 => EN <= '1';
when 257 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 258 => EN <= '0';
when 259 => EN <= '1';
when 260 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 261 => EN <= '0';
when 262 => EN <= '1';
when 263 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 264 => EN <= '0';
when 265 => EN <= '1';
when 266 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 267 => EN <= '0';
when 268 => EN <= '1';
when 269 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 270 => EN <= '0';
when 271 => EN <= '1';
when 272 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 273 => EN <= '0';
when 274 => EN <= '1';
when 275 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 276 => EN <= '0';
when 277 => EN <= '1';
when 278 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 279 => EN <= '0';
when 280 => EN <= '1';
when 281 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 282 => EN <= '0';
when 283 => EN <= '1';
when 284 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 285 => EN <= '0';
when 286 => EN <= '1';
when 287 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 288 => EN <= '0';
when 289 => EN <= '1';
when 290 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 291 => EN <= '0';
when 292 => EN <= '1';
when 293 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 294 => EN <= '0';
when 295 => EN <= '1';
time_count := 2;
count := 116; --loop back to check

when 296 => EN <= '0';
when 297 => EN <= '1';
when 298 => RW <= '0';
RS <= '0';
LCD <= &quot;00000001&quot;; --clear display
when 299 => EN <= '0';
when 300 => EN <= '1';
when 301 => RW <= '0';
RS <= '1';
LCD <= &quot;01001110&quot;; --N
when 302 => EN <= '0';
when 303 => EN <= '1';
when 304 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 305 => EN <= '0';
when 306 => EN <= '1';
when 307 => RW <= '0';
RS <= '1';
LCD <= &quot;01101011&quot;; --k
when 308 => EN <= '0';
when 309 => EN <= '1';
when 310 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 311 => EN <= '0';
when 312 => EN <= '1';
when 313 => RW <= '0';
RS <= '1';
LCD <= &quot;01100100&quot;; --d
when 314 => EN <= '0';
when 315 => EN <= '1';
when 316 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 317 => EN <= '0';
when 318 => EN <= '1';
when 319 => RW <= '0';
RS <= '1';
LCD <= &quot;01000110&quot;; --F
when 320 => EN <= '0';
when 321 => EN <= '1';
when 322 => RW <= '0';
RS <= '1';
LCD <= &quot;01101100&quot;; --l
when 323 => EN <= '0';
when 324 => EN <= '1';
when 325 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 326 => EN <= '0';
when 327 => EN <= '1';
when 328 => RW <= '0';
RS <= '1';
LCD <= &quot;01101101&quot;; --m
when 329 => EN <= '0';
when 330 => EN <= '1';
when 331 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 332 => EN <= '0';
when 333 => EN <= '1';
when 334 => RW <= '0';
RS <= '1';
LCD <= &quot;01000001&quot;; --shift
when 335 => EN <= '0';
when 336 => EN <= '1';
when 337 => RW <= '0';
RS <= '1';
LCD <= &quot;00010000&quot;; --shift
when 338 => EN <= '0';
when 339 => EN <= '1';
when 340 => RW <= '0';
RS <= '1';
LCD <= &quot;00010000&quot;; --shift
when 341 => EN <= '0';
when 342 => EN <= '1';
when 343 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 344 => EN <= '0';
when 345 => EN <= '1';
when 346 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 347 => EN <= '0';
when 348 => EN <= '1';
when 349 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 350 => EN <= '0';
when 351 => EN <= '1';
when 352 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 353 => EN <= '0';
when 354 => EN <= '1';
when 355 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 356 => EN <= '0';
when 357 => EN <= '1';
when 358 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 359 => EN <= '0';
when 360 => EN <= '1';
when 361 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 362 => EN <= '0';
when 363 => EN <= '1';
when 364 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 365 => EN <= '0';
when 366 => EN <= '1';
time_count := 3;
count := 116; --loop back to check
when 367 => EN <= '0';
when others => EN <= '0';
count := count; --end
end case;
end if;
end process;
end lcd_arch;


 
;
when 295 => EN <= '1';
time_count := 2;
count := 116; --loop back to check

when 296 => EN <= '0';
when 297 => EN <= '1';
when 298 => RW <= '0';
RS <= '0';
LCD <= &quot;00000001&quot;; --clear display
when 299 => EN <= '0';
when 300 => EN <= '1';
when 301 => RW <= '0';
RS <= '1';
LCD <= &quot;01001110&quot;; --N
when 302 => EN <= '0';
when 303 => EN <= '1';
when 304 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 305 => EN <= '0';
when 306 => EN <= '1';
when 307 => RW <= '0';
RS <= '1';
LCD <= &quot;01101011&quot;; --k
when 308 => EN <= '0';
when 309 => EN <= '1';
when 310 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 311 => EN <= '0';
when 312 => EN <= '1';
when 313 => RW <= '0';
RS <= '1';
LCD <= &quot;01100100&quot;; --d
when 314 => EN <= '0';
when 315 => EN <= '1';
when 316 => RW <= '0';
RS <= '1';
LCD <= &quot;00100000&quot;; --space
when 317 => EN <= '0';
when 318 => EN <= '1';
when 319 => RW <= '0';
RS <= '1';
LCD <= &quot;01000110&quot;; --F
when 320 => EN <= '0';
when 321 => EN <= '1';
when 322 => RW <= '0';
RS <= '1';
LCD <= &quot;01101100&quot;; --l
when 323 => EN <= '0';
when 324 => EN <= '1';
when 325 => RW <= '0';
RS <= '1';
LCD <= &quot;01100001&quot;; --a
when 326 => EN <= '0';
when 327 => EN <= '1';
when 328 => RW <= '0';
RS <= '1';
LCD <= &quot;01101101&quot;; --m
when 329 => EN <= '0';
when 330 => EN <= '1';
when 331 => RW <= '0';
RS <= '1';
LCD <= &quot;01100101&quot;; --e
when 332 => EN <= '0';
when 333 => EN <= '1';
when 334 => RW <= '0';
RS <= '1';
LCD <= &quot;01000001&quot;; --shift
when 335 => EN <= '0';
when 336 => EN <= '1';
when 337 => RW <= '0';
RS <= '1';
LCD <= &quot;00010000&quot;; --shift
when 338 => EN <= '0';
when 339 => EN <= '1';
when 340 => RW <= '0';
RS <= '1';
LCD <= &quot;00010000&quot;; --shift
when 341 => EN <= '0';
when 342 => EN <= '1';
when 343 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 344 => EN <= '0';
when 345 => EN <= '1';
when 346 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 347 => EN <= '0';
when 348 => EN <= '1';
when 349 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 350 => EN <= '0';
when 351 => EN <= '1';
when 352 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 353 => EN <= '0';
when 354 => EN <= '1';
when 355 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 356 => EN <= '0';
when 357 => EN <= '1';
when 358 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 359 => EN <= '0';
when 360 => EN <= '1';
when 361 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 362 => EN <= '0';
when 363 => EN <= '1';
when 364 => RW <= '0';
RS <= '0';
LCD <= &quot;00010000&quot;; --shift
when 365 => EN <= '0';
when 366 => EN <= '1';
time_count := 3;
count := 116; --loop back to check
when 367 => EN <= '0';
when others => EN <= '0';
count := count; --end
end case;
end if;
end process;
end lcd_arch;
 
Hi, Zentan. I looked over your code. The code is perfectly fine
except one thing in the beginning:

if (RESET = '1')then
COUNT:=0
time_count:= 0
RW<= '0'
RS<= '0'
EN<= '0'
LCD<= "00000001";

there has to be 1 in the end.

The reason why your program doesn't work,95% chance, is the clock. The clock MUST be 1 KHz for an LCD, or check the datasheet on your LCD. The clock you use is either too slow or too high.

If this doesn't help, tell me what's wrong with it.

P.S. If you need a clock divider just tell me.
 
Hi Robotan,

Thanks for your help. I really appreaciate it. I have encountered another problem. The LCD is able to display the words "Welcome to kitc gas leakage". This is not i want. By right it should display "Welcome to Kitchen Monitoring System". What's wrong with my VHDL codes?
How can i solve this problem?
Can you give me your email address?? so that i can send you my data sheet for reference.
Hope to receive your reply soon! Thanks...

Regards,
From Zentan

I was using Sanyo DM1622 is an LCD dot matrix display module that consist of an LCD panel and the controller / driver circuits. It is capable of displaying two lines of 16 characters. The DM 1622 module incorporates the control circuits, data RAM, and character generator ROM required for display. The DM 1622 provides both 8-bit and 4bit parallel interfaces and allows the controlling microprocessor to read and write data directly.

General Specifications
1) Drive method: 1/16 duty, 1/5 bias ( ¼ bias for the STN version)
2) Display size: 16 characters x 2lines
3) Character structure: 5 x 7 dots + cursor
4) Display data RAM: 80 characters (80 x 8 bits)


 
Firstly, two things:

1. What is time_count used for? It looks like your system will get stuck at loop count 116 when time_count gets set, unless a higher priority error occurs. Priority high to low being GS, WS, TS.

I have never used an LCD, I am not sure if you are expecting to to continue looping to the display parts of your code, or if you only want to do them once (i.e write gas leakage once, and it stays there).


2. Just a guide to better code. In your when others statement you set count := count. In this case count is the argument for your case statement, and getting into the when others is obviously a bad situation. If you were to set count := 0, then it would reset the system. Right now it will simply get stuck in the bad state.

of course a reset might not be a good thing either. Maybe a error state would be better.

--
 
Hi to all expert,
I'm having a problem with displaying 16 characters on Sanyo DM1622 . Does anybody know how to solve this problems? Is there a way to solve it.
Thanks a lot.

Regards
from zentan
 
I think your problem might be the entry mode.

The entry mode increments the address counter each time you send new data. But my guess is that if you want to get to the second line you need to manually set the address counter to the start of the second line, then start sending your data again.

Not sure since I couldn't find a datasheet for this device, but it seems thats the way other devices work.

So you might need to keep a counter to figure out where you are, then change the address to the second line when needed.

--
 
You have to make a command with the adress, usually it's in hex, change it to binary, and put it as an initialization command before the actual 2nd line but after 1st line.
 
I have problem with dinamically changing numbers in one character. It's no a problem with static, but i want them to change dinamically. Take a look at my simple code, it's rough, but it still doesn't work.

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
library UNISIM;
use UNISIM.VComponents.all;



entity meter is
port (
CLKIN : in std_logic;

reset: in std_logic;
RS: out std_logic;
RW: out std_logic;
EN: out std_logic;
LCD: inout std_logic_vector (7 downto 0)
);
end meter;

architecture beh of meter is
constant CLK_STOP : std_logic_vector(15 downto 0) := X"C350";

signal dm:std_logic;
signal bin:std_logic_vector (7 downto 0);

signal CLK_COUNT : std_logic_vector(15 downto 0);
signal INT_CLK : std_logic;
signal clk:std_logic;


begin


--------------------------------------------------------------------------
-- PROCESS STATEMENTS
--------------------------------------------------------------------------
clk <= INT_CLK;

DIVIDE_CLOCK: process (CLKIN)
begin
if rising_edge(CLKIN) then
-- Check to see if the count value has been met
if (CLK_COUNT = CLK_STOP) then
-- Flip the output clock signal
INT_CLK <= not INT_CLK;

-- Reset the count
CLK_COUNT <= X"0000";
else
-- Add 1 to the count
CLK_COUNT <= CLK_COUNT + X"0001";
end if;
end if;
end process DIVIDE_CLOCK; --Clock div 1KHz










Process(clk,reset)
variable count: integer range 2 to 20;
variable count1: integer range 0 to 9:=0;

variable count2: integer range 0 to 6;

begin



if (reset='1') then
count:=2;
count1:=0;
count2:=0;
RW<='0';
RS<='0';
EN<='0';
LCD<="00000001";

elsif (clk'event and clk='1')then
if (count=20)then
count:=20;

else
count:=count+1;
end if;

case count is

when 2=>EN<='0';
when 3=>EN<='1';
when 4=>RW<='0';
RS<='0';
LCD<= "00110000";

when 5=>EN<='0';
when 6=>EN<='1';
when 7=>RW<='0';
RS<='0';
LCD<= "00110000";

when 8=>EN<='0';
when 9=>EN<='1';
when 10=>RW<='0';
RS<='0';
LCD<="00111000";

when 11=>EN<='0';
when 12=>EN<='1';
when 13=>RW<='0';
RS<='0';
LCD<="00001100";

when 14=>EN<='0';
when 15=>EN<='1';
when 16=>RW<='0';
RS<='0';
LCD<="00000110";

when 17=>EN<='0';
when 18=>EN<='1';
when 19=>RW<='0';
RS<='0';
LCD<="00000001";

when 20=>
count:=count;
end case;

if (count2 = 5) then
if(count1=9)then
count1:=0;
else count1:=count1+1;
end if;
case count1 is
when 0=>bin<= "00110000";
when 1=>bin<= "00110001";
when 2=>bin<= "00110010";
when 3=>bin<= "00110011";
when 4=>bin<= "00110100";
when 5=>bin<= "00110101";
when 6=>bin<= "00110110";
when 7=>bin<= "00110111";
when 8=>bin<= "00111000";
when 9=>bin<= "00111001";
end case;
end if;




if (count=20) then
if (count2=6) then
count2:=0;
else count2:= count2+1;
end if;

case count2 is
when 0=> EN<='0';
when 1=> EN<='1';
when 2=> RW<='0';
RS<='0';
LCD<="10000000";
when 3=> EN<='0';
when 4=> EN<='1';
when 5=> RW<='0';
RS<='1';
LCD<=bin;
when 6=>
count2:=0;
end case;

end if;
end if;
end process;
end beh;
 
Well without knowing exactly how the LCD works I couldn't say. Plus you haven't really told me what is happening, that is even more useful information.

By the looks of your code, you have a 20 clock initialisation sequence, you then have a 6 clock sequence from count2 which sends some kind of instruction to the LCD followed by the value bin.

bin is incremented on the 5th or 6th count of count 2 (I never use variables, but it looks to me that bin will change when count2=6 rather than the 5 that you probably wanted, but either way the code should still work).

why do I think it changes on the 6th count? because variables change immediately, and signals change based on your wait statement. in this case, because the if (count2 = 5) statement is before the code when count2 is incremented. Count2 will only = 5 on the next clock cycle, and immediately following this the count2 will change to 6.
Since bin is a clocked signal it won't change till the next rising edge, which will be the rising edge at which count2 will get set to 7. In this case it doesn't matter since you don't really care when bin changes as long as the frequency that it changes is the same as when its used. But beware of this in places where it might matter. I always say don't use variables until the timing of signals etc is just comes natural to you.

Anyway,
So what you end up with is a number that increments 0-9 continuously. Assuming that all the LCD values are correct, you may want to check through them.

--
 
Hi, im currently working on a project to program an LCD and i dont know what im doing wrong. After writing the program,downloading it unto an FPGA Board, powering up the LCD and connecting it to the FPGA board, i dont see any characters. But when i abruptly lower then increase the Vcc on the LCD, it starts to diaplay some of what i programmed with some other jargons.......Can u help me?
 
Are you connecting the LCD while the FPGA is powered up, or did you just write that in the wrong order?

The FPGA wouldn't support hot plug, and im guessin the LCD wouldn't either.

Anyway, that is probably not your problem.

First things... check your clock and your reset lines. And do you see anything happening on your outputs? (EN, RW, RS, LCD)

--
 
by the way.... ABCguy - you should start a new thread. I just noticed that you are not the same person who started the thread. Otherwise it will get complicated (who is answering what etc).

--
 
thanks VHDLguy, i actually found out that my timing might be way off but now i think i fixed it but its still not working. By the way, the LCD always stays connected to the FPGA and i also power it up and wait for a while before i download the code. Do you have any idea why flashes of my code shows up on the LCD when i flunctuate the Vcc of the LCD. Thanks!!!!
 
VHDLguy, thanks for your help on the previous changes.
What I'm actually trying to do as the final is a frequency counter.
Along with all the synthesis problems, I have a big problems with loop statements.

Why does it always ask for "generate"?
How can I make the loop statement synthesisable?

If you want you can send your answer to
andreik.@sympatico.ca

I started VHDL not too long ago and still come along with
simple problems.

Thank you very much.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top