A very simple for all my Freepascal members:
Inside UnoLib:
procedure Init(rs, rw, enable, d0, d1, d2, d3: UInt8); overload;
Now i use ccrause/fpc-avr:
unit lcd_config;
interface
const
// LCD configuration
lcd_lines = 4; // number of visible lines of the display
lcd_displayLength = 16; // visibles characters per line of the display
// Pin connections
lcd_dataPin4 = 3; // pin for 4bit data bit 0
lcd_dataPin5 = 4; // pin for 4bit data bit 1
lcd_dataPin6 = 5; // pin for 4bit data bit 2
lcd_dataPin7 = 6; // pin for 4bit data bit 3
LCD_RS_PIN = 2; // pin for RS line
LCD_RW_PIN = 1; // pin for RW line
LCD_E_PIN = 2; // pin for Enable line
var
LCD_DATA4_PORT: byte absolute PORTD; // port for 4bit data bit 0
LCD_DATA5_PORT: byte absolute PORTD; // port for 4bit data bit 1
LCD_DATA6_PORT: byte absolute PORTD; // port for 4bit data bit 2
LCD_DATA7_PORT: byte absolute PORTD; // port for 4bit data bit 3
LCD_RS_PORT: byte absolute PORTB; // port for RS line
LCD_RW_PORT: byte absolute PORTB; // port for RW line
LCD_E_PORT: byte absolute PORTD; // port for Enable line
Question: can somebody help me out with formatting the LC.Init(12, 11, 5, 4, 3, 2); procedure ?
Is it possible at all to use liquidcrystal.pas on a Atmega328p already own etched board ? or does it only work on Arduino?
Must i change something in the defined section ?
Greets, Wouter van Wegen, pascalbythree
I tried:
program TestLCDisplay;
{DEFINED(fpc_mcu_atmega328p)}
{$mode objfpc}
uses
timer, liquidcrystal;
begin
LC.Init(16, 15, 4, 5,6,11,12);
LC._begin(16, 4);
LC.Write('hello, world!');
while True do
begin
LC.NoDisplay;
Delay(500);
LC.Display;
Delay(500);
end;
end.
PS: I am using DataPin7 DataPin6 DataPin5 DataPin4 on my HD44780 display!