'------------------------------------------------------------------------------ ' Testprog Interface-Controller ' ' ATMEGA328A intern 8MHz Clock 21.06.2021 '----------------------------------------------------------------------------- $regfile = "m328pdef.dat" 'Atmega328P config data $programmer = 19 'USBASP-Programmer $prog &HFF , &HE2 , &HD9 , &HFF ' generat Fuse Bits, CLK 8MHz intern, CLK divide disabled $lib "lcd_i2c_ludwig.lib" $crystal = 8000000 'CPU Clock intern Config Scl = Portb.2 'SCL I2C Config Sda = Portb.1 'SDA I2C Config I2cdelay = 1 'Wert für I2C-Port Dim _lcd_e As Byte Const Pcf8574_lcd = 78 'Address of I2C-LCD = 78 Enable Interrupts Config Int0 = Falling 'Int signal from PCF8574_KBD is connected to INT0 Const PCF_D4 = 4 ' Pin assignments for connection PCF8574 to LCD Const PCF_D5 = 5 Const PCF_D6 = 6 Const PCF_D7 = 7 Const PCF_RS = 0 Const PCF_RW = 1 Const PCF_E2 = 3 Const PCF_E1 = 2 '_lcd_e = 128 select E1, 64 select E2, 192 select both (for CLS or DefLCDChar etc.) _lcd_e = 128 Dim A As Byte Config Lcd = 16 * 2 'configure lcd screen 'other options are 16 * 4 and 20 * 4, 20 * 2 , 16 * 1a 'When you dont include this option 16 * 2 is assumed '16 * 1a is intended for 16 character displays with split addresses over 2 lines '$LCD = address will turn LCD into 8-bit databus mode ' use this with uP with external RAM and/or ROM ' because it aint need the port pins ! ' Put your own strings here Start_prog: Cls 'clear the LCD display locate 1,1:Lcd "Hello world." 'display this at the top line Wait 1 'Lowerline 'select the lower line 'Wait 1 locate 2,1:Lcd "Shift this." 'display this at the lower line Wait 1 For A = 1 To 10 Shiftlcd Right 'shift the text to the right Waitms 250 'wait a moment Next For A = 1 To 10 Shiftlcd Left 'shift the text to the left Waitms 250 'wait a moment Next Locate 2 , 1 'set cursor position Lcd "*" 'display this Wait 1 'wait a moment Shiftcursor Right 'shift the cursor Lcd "@" 'display this Wait 1 'wait a moment Home Upper 'select line 1 and return home Lcd "Replaced." 'replace the text Wait 1 'wait a moment Cursor Off Noblink 'hide cursor Wait 1 'wait a moment Cursor On Blink 'show cursor Wait 1 'wait a moment Display Off 'turn display off Wait 1 'wait a moment Display On 'turn display on goto start_prog end