Forum > Embedded - AVR

Lazarus control Arduino Nano with Enc28J60

(1/9) > >>

This is my first time to post. Hope this is right place to post about control Arduino. I would like to use Lazarus with Arduino. My computer is window 10. I just download Lazarus and got it working. I have been use Delphi 5 for a long time.  Now I would like to learn how we can control Arduino with several LEDs and servos. I have google it but still not understand how to use. I understand we need to download serial port communication. Which one should we use? I would like to use USB port. Someone mention to use Synaser. I am not sure How do we use it.  Is there a step by step instruction how we add serial componet on Lazarus? Is there a webpage where I can download and run it? I just want to control Arduino with several LEDs at first then I will add some servos. Please don't give me the link to YouTube. I am very hard of hearing and having hard time to understand video. I am 58 years old.

There are a few things you need to be aware of:
Arduino Nano is Atmel Microcontroller (, you can easily program it using C language. On Arduino website there are enough resources for start (look for some examples about Ethernet) (

ENC28J60 is not compatible with Arduino Ethernet Library (it is for WS5xxx), so you need other library to program Arduino as TCP client or server. Here are some resources:

And then you can try communicating with it using TCP (or UDP) (eg. Lazarus + LNet or Synapse).


No need for C. FPC supports AVR, and afaik it can target the ATMega328 directly.
It is also possible to control an ATMega328 from any of the Lazarus supported platforms with software written for that platform.

You just have to build a ppcrossavr compiler using the GNU C toolchain for AVR to compile for the ATmega328 itself.

- you can write controlling software for atmega with Lazarus on e.g., linux.mac, windows
- you can target the ATMega328 directly with an FPC cross compiler. (ignore the warning: the current state works)

For serial port communication in your Lazarus application take a look at these links:,36523.msg245030.html#msg245030
You will find small examples to get you started, but first you need to decide which serial lib/component to use. Wiki will help you with the choice. Have in mind that Synaser is not event based. Others are. Any of them will be able to talk to Arduino over USB virtual COM port.

For developing Arduino and other ATMEL AVR microcontrollers in Pascal take a look at these links:,30960.0.html,32816.msg211887.html#msg211887,24665.msg196700.html#msg196700,29128.msg183767.html#msg183767

Using forum search would bring you much more links.

You are asking for serial communication, but your topic mentions ENC28J60 which can be used for Arduino TCP or UDP networking communication. If you decide to go that path instead then you can use Synapse, Dataport, Indy and several other networking communication libraries available for Free Pascal and Lazarus.

I wasn't aware of that. Thanks for the info Thaddy.
But I'm not sure how to control ENC28J60 shield with FPC.


[0] Message Index

[#] Next page

Go to full version