|Use:||lcd2w_enable( data_pin, clock_pin )|
|Description:||Defines the pins to be used for the 2 wire LCD interface, and resets the LCD|
|Parameters:||data_pin||Name of the pinname used for the LCD data connection. This can be a variable name or a name in the form Px_y. Where x is the port number, which can be 1 or 2, and y is the bit number which is between 0 and 7. (e.g. P2_3)|
|clock_pin||Name of the pinname used for the LCD clock connection. This can be a variable name or a name in the form Px_y. Where x is the port number, which can be 1 or 2, and y is the bit number which is between 0 and 7. (e.g. P2_3)|
|Related:||lcd_print, lcd_enable, print|
The lcd2w_enable function defines the pins to control an LCD using a 2 wire interface. To use the command you must connect the microcontroller to an external LCD and shift-register circuit. See details here.
The command will reset the LCD display so that it is ready to print text using the lcd_print command. The lcd2w_enable command must be run before the lcd_print command, and is needed only once in the program.
There are two different LCD interface connections in mpy, a 6 wire and a 2 wire interface. The lcd2w_enable command is only used for the 2 wire interface. It uses data and clock output signals from the microcontroller. These signals are used to to connect to a shift-register circuit which is used to connect to the LCD. See here for details of how to connect the 2 wire shift register circuit and the LCD.
Example using the lcd2w_enable and the lcd_print commands to display text onto the 2 wire LCD interface.
lcd2w_enable(P1_0, P1_6) # DATA,CLOCK lcd_print( 'x is', x )
This will print the following in the LCD
x is 200
The lcd2w_enable command defines pin P1_0 to be used as the data connection to the shift register and pin P1_6 as the clock signal to the shift register.
Note that pin P1_0 is also connected to the red LED on Launchpad board, and P1_6 is connected to the green LED. By using the LED pins for data and clock you can see the two LEDs flash whenever the program writes to the LCD. This can be useful when first trying to get the 2 wire LCD circuit up and running.