' Port 80 project. By E. Negus June 20, 2000 ' ' This project is used to help diagnose problems with ' IBM compatible motherboards by displaying the ' results of the Power On Self Test via the Port 80 ' diagnostic port, in english, using a 2 Line x 40 ' character LCD display. An EPROM is used for holding ' this data, which can be simply what is being tested ' or even the component locations of the components ' being tested. ' ' Program Operation: ' ' Get 2 chars from an EPROM, one nibble at a time via a ' `257 or `157 data selector. Display on LCD and advance ' the CD4040 address counter for the next character. If ' the same post code is displayed for three seconds, write ' the entire text to the LCD display, if not, clear the ' CD4040 counter and home the display cursor to display ' the next code. Also outputs short codes to a serial port ' which can be used to determine if an alternate branch ' is taken by the BIOS during POST. ' Plenty of space for additional instructions (also 16 chars ' on the LCD aren't in use!) Symbol E = 5 ' Enable pin, 1 = enabled Symbol RS = 4 ' Register select pin, 0 = instruction ' + clears the CD4040, 1 = text Symbol AB = 7 ' Doubles as Serial output Symbol clk = 6 ' Increments CD4040 Symbol lsc = w0 ' temp holding word Symbol lcs = w4 ' temp holding word Symbol nsub = b2 ' used to build character to display Symbol cnt = b3 ' counter Symbol temb = b4 ' temp holding byte Symbol char = b5 ' character to display Symbol last = b6 ' temp holding byte Symbol bnt = b7 ' timing byte ' Set up the Stamp's I/O lines and initialize the LCD. begin: let pins = %00000000 'Clear the output lines let dirs = %01111111 'One input, 7 outputs. pause 100 'Wait 100 ms for LCD to reset. i_LCD: let pins = %00000011 'Set to 8-bit operation. pulsout E,1 'Send data three times pause 10 'to initialize LCD. pulsout E,1 pause 10 pulsout E,1 pause 10 let pins = %00000010 'Set to 4-bit operation. pulsout E,1 'Send above data three times. pulsout E,1 let pins = %00001000 pulsout E,1 let char = 14 'Set up LCD in accordance with gosub wr_LCD 'Hitachi instruction manual. let char = 6 'Turn on cursor and enable gosub wr_LCD 'left-to-right printing. let char = 1 'Clear the display. gosub wr_LCD high RS 'Prepare to send characters. ' LCD is setup. Now display Port80 text. loop: for cnt=0 to 1 'Get & display first two characters gosub getdat next cnt let lcs = last * 256 + nsub if lsc = lcs then cbnt 'if same as last, check for how long serout ab,n2400,(nsub,last,10,13) 'if unique send it out let lsc = lcs 'for comparing later clbnt: let bnt = 0 'Clear timing variable svbnt: low RS 'Home the LCD cursor , clear CD4040 let char = 2 gosub wr_LCD high rs goto loop cbnt: let bnt = bnt + 1 if bnt < 60 then svbnt 'if same code for > 3 sec, display all text for cnt = 2 to 63 gosub getdat next cnt goto clbnt ' Get character from `257 and display it on LCD getdat: let dirs = %11110000 'Set up I/O directions. let pins = %00010000 let last = nsub low ab let nsub = pins & %00001111 'Take low and high nibble high ab 'readings from the 74HCT257 let nsub = pins & %00001111 * 16 + nsub pulsout clk,1 'Increment counter for next byte let char = nsub let pins = %00010000 'Keep RS High let dirs = %11111111 'All output pins. gosub wr_LCD 'write character to LCD return ' Write the ASCII character in char to the LCD. wr_LCD: let pins = pins & %00010000 let temb = char / 16 'Put high nib of char into temb let pins = pins | temb 'OR the contents of char into pins pulsout E,1 'Blip enable pin let temb = char & %00001111 'Put low nib of char into temb let pins = pins & %00010000 'Clear 4-bit data bus let pins = pins | temb 'OR the contents of temb into pins pulsout E,1 'Blip enable pin return