bits are written to the PmodCLP’s data bus. We have to raise
the PmodCLP’s E control pin logically high for a minimum
of 220 ns and then bring it logically low for another 280
ns to allow the PmodCLP’s LCD electronics to process
the function_set command. So, we start the lcd_clk ticks
within the else clause by incrementing the lcd_clk register.
We give the PmodCLP’s LCD controller plenty of time to
digest the signals on the RS pin and databus as the PmodCLP’s
E control line is raised to a logically high level 1 μS later
when the lcd_clk value has been incremented to 10 ticks.
The E control line will remain at a logically high level for
10 more ticks. When the lcd_clk value is equal to 20 ticks,
the E control line will be driven logically low. We must
wait a minimum of 37 μs before issuing the next command.
The lcd_state register is loaded with the next desired state
and the function_set state is exited when the lcd_clk
expends another 38 μs (lcd_clk == 400). In addition to
setting up the next state to hop to, upon exiting the
function_set state we also clear the lcd_clk tick count to
zero. As you can see in the function_set source code, we
worked our way through the case statement code from
bottom to top performing tasks according to the ticks
contained within the lcd_clk. Note also that we always
made sure that the lcd_state register was loaded with the
currently executing state as we
incremented the lcd_clk register to its
exit value. There’s only one state that
doesn’t operate in the manner we’ve
just examined. However, I don’t think
that you will have any problems
grasping the concepts used in the
NEW! HIDmaker FS for Full Speed FLASH PIC18F4550
Creates complete PC and Peripheral
programs that talk to each other over
USB. Ready to compile and run!
• Large data Reports
• 64,000 bytes/sec per Interface
• Easily creates devices with multiple
Interfaces, even multiple Identities!
• Automatically does MULTITASKING
• Makes standard or special USB HID
NEW! “Developers Guide for USB HID
Peripherals” shows you how to make
devices for special requirements.
Both PC and Peripheral programs
understand your data items (even odd
sized ones), and give you convenient
variables to handle them.
PIC18F Compilers: PICBASIC Pro,
MPASM, C18, Hi-Tech C.
PIC16C Compilers: PICBASIC Pro,
MPASM, Hi-Tech C, CCS C.
PC Compilers: Delphi, C++ Builder,
Visual Basic 6.
HIDmaker FS Combo: Only $599.95
if(char_ptr == 17)
lcd_clk <= 0;
lcd_state <= display_line2;
else if(char_ptr == 34)
lcd_clk <= 0;
lcd_state <= idle;
DOWNLOAD the HIDmaker FS Test Drive today!
1:char2display <= “ “;
2:char2display <= “N”;
3:char2display <= “U”;
4:char2display <= “T”;
5:char2display <= “S”;
6:char2display <= “ “;
7:char2display <= “A”;
8:char2display <= “N”;
■ PHOTO 9. I still get excited when
things like this go as planned. In the
end when the firmware and hardware
are proven to work, it just doesn’t
get any better than that.