musaplayer + sorsat <--- might not work, development needed

C64 LCD DRIVER <--- includes basic and m/l listings

LCD PICTURES <--- some pictures

LCD CONNECTION:

  1. Search a HD 44780 compatible LCD screen. This code is tested with 16x2 lcd, but any size from 4x1 to 40x2 should work. This code does not support more than two lines.

  2. Create the connection as follows:

    1. Lcd power and gnd from 5v and 0v, respectively. Standard LCD has them on pins 1 as GND and 2 as 5v. Connect these to userport lines 1 and 2, where 1 is gnd.

    2. Connect R/W-line of the LCD with a short wire to GND. We do not need to read from the LCD, and who wants to use such a slow interface for 80 byte memory expansion anyway? We can just wait enough time to get the data written to LCD.

    3. Connect a 10 k potentiometer between 5v and 0v lines, and the middle pin of pot to pin 3 of the lcd. Sometimes you can just ground the line 3 (VO).

    4. Connect pins 11-14 (Lcd data 4 to 7) to pins C-F in userport (PB0-PB3). Also connect pin 4 from LCD to pin H in userport (PB4), and pin 6 (LCD E) to pin J (PB5). When looking from back of the computer, pin C is third from left and on underside of the motherboard. After datapins, next is the R/S line and then the E pin.

    5. Connect the user port connector to c64, and turn power on. After most of the smoke has disappeared, check out the wiring and change the 6526 in the system. If no smoke comes out, and the c64 starts normally, we can try to program the lcd. Adjust the contrast as needed so that you can see something from the screen. This connection also works just fine with a c128.

Basic listing to test out the LCD:



10 poke56579,255:r=16:e=32

15 input "give text";a$

20 d=56577:gosub1000

30 forl=1tolen(a$):p=asc(mid$(a$,l)):gosub2000:next

40 end

1000 rem lcd init

1005 restore

1010 readb:ifb=-1thenreturn

1020 poked,bore:poked,b:goto1010

1030 data3,3,3,2,2,8,0,12,0,6,0,1,-1

2000 oh=(pand240)/15orr:ol=pand15orr

2005 printchr$(p);

2010 poked,ohore:poked,oh:poked,olore:poked,oh:return



Type in the program and save it to disk or tape. After save, run the program. The text you input should come on your screen, but also on the lcd screen. If nothing happens, there is something wrong with your connection.

If nothing comes on the screen, type:

poke 56579,255:poke56577,0

Then use a multimeter with volt setting and check pins D0-D4, R/S and E. They all must now show 0 volts. Then type:

poke 56577,255

Now the pins should show close to 5 volts (it might be around 4.5 to 5 volts).

Now read the value from 56577 with:

?peek(56577).

It should respond with a 255. After that type

poke 56577,0

and after peeking 56577 it should also respond zero. If not, you have a faulty CIA chip or faulty LCD. If the reading becomes correct when you remove the LCD, then you have a short somewhere and sweat on your forehead.

Zip has files:

driver.a LCD driver source code for machine language. Format is ACME

driverold.a LCD driver under development for interrupt.

Lcdbasicdemo.prg Basic program to test LCD (same as listing)

lcdbastest2.prg Basic program that uses ”lcdtest” binary.

lcddriver compiled machine language from driverold.a

lcdtest and lcdtest.prg driver.a compiled binary

listing1 lcdbastest2 text source

listing2 lcdbasicdemo text source

labels compiler label listing

ALL OF THE CODE LISTED ON THESE COMMODORE PAGES AND THIS DOCUMENT IS LICENSED UNDER GPL 2 OR LATER. http://www.gnu.org/licenses/gpl-2.0.html