$regfile = "m128def.dat" $crystal = 16000000 $baud = 19200 ' baud rate on UART#1 $baud1 = 19200 ' baud rate on UART#2 $hwstack = 32 ' default use 32 for the hardware stack $swstack = 10 ' default use 10 for the SW stack $framesize = 40 ' default use 40 for the frame space '$sim $lib "lcd4busy.lib" Const _lcdport = Portc Const _lcdddr = Ddrc Const _lcdin = Pinc Const _lcd_e = 2 Const _lcd_rw = 1 Const _lcd_rs = 0 'Rs = Portc.0 'RW = Portc.1 ???we dont use the R/W option of the LCD in this version so connect to ground ' E = Portc.2 'E2 = ***optional for lcd with 2 chips ***not needed*** 'Db4 = Portc.4 the data bits must be in a nibble to save code 'Db5 = Portc.5 'Db6 = Portc.6 'Db7 = Portc.7 Config Lcdpin = Pin , Rs = Portc.0 , E = Portc.2 , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Postc.7 Config Lcd = 16 * 2 'Config Pinc.1 = Output '???config the i/o wired to R/W line of LCD 'Portc.1 = 0 '???set the R/W input on the LCD to Low 'The M128 has an extended UART. 'when CONFIG COMx is not used, the default N,8,1 will be used Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0 Config Com2 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0 'try the second hardware UART Open "com2:" For Binary As #1 Print #1 , Version() 'show date and time of compilation Do Cls 'clear LCD screen Print #1 , "Hello World!!" 'send output to rs232 Lcd "Hello World!!" 'send output to LCD Wait 1 'wait a sec Cls Porta.6 = 0 'Turn LED on Print #1 , "LED: ON" 'send output to rs232 Lcd "LED: ON" 'send output to LCD Lowerline 'skip line on LCD Wait 1 'wait a sec Porta.6 = 1 'Turn LED off Print #1 , "LED: OFF" 'send output to rs232 Lcd "LED: OFF" 'send output to LCD Wait 1 'wait a sec Loop Close #1 End