Recent

Author Topic: Lazarus oscilloscope - FPC firmware + Lazarus GUI  (Read 7591 times)

ccrause

  • Hero Member
  • *****
  • Posts: 856
Lazarus oscilloscope - FPC firmware + Lazarus GUI
« on: June 30, 2019, 10:15:20 pm »
I am exited to have build a first useful project integrating embedded controller (atmega328P on Arduino Uno board) and desktop app using only FPC as compiler and Lazarus as IDE!  The controller collects 1200 10 bit samples in a buffer, which is then transmitted to a PC over serial/USB.  The desktop app collect the data and display it in a TChart.

Note that this post is not really about yet another Arduino oscilloscope (Github alone lists 153 projects for Arduino oscilloscope) - I'm exited by having the option of a Pascal toolchain from firmware to desktop software.

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Lazarus oscilloscope - FPC firmware + Lazarus GUI
« Reply #1 on: June 30, 2019, 11:01:24 pm »
This is very interesting. Did you program the embedded controller in Pascal or Object Pascal, too? Can you provide a link to the software, its description or a paper about it?
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Lazarus oscilloscope - FPC firmware + Lazarus GUI
« Reply #2 on: June 30, 2019, 11:37:20 pm »
Sounds quite impressive. Congratulations! ;D
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

kupferstecher

  • Hero Member
  • *****
  • Posts: 583
Re: Lazarus oscilloscope - FPC firmware + Lazarus GUI
« Reply #3 on: June 30, 2019, 11:46:08 pm »
Nice!

I did something similiar with an STM32, also programmed in FreePascal. But not as sophisticated as yours: No trigger, fixed ports and only single shot.

d.ioannidis

  • Full Member
  • ***
  • Posts: 221
    • Nephelae
Re: Lazarus oscilloscope - FPC firmware + Lazarus GUI
« Reply #4 on: July 01, 2019, 12:23:15 am »
Congrats Christo !

Does continuously sends live the data via uart ?

I'm finishing the driver for the enc28j60 ethernet controller. What do you think, will be possible to send the data via ethernet ?

regards,

ccrause

  • Hero Member
  • *****
  • Posts: 856
Re: Lazarus oscilloscope - FPC firmware + Lazarus GUI
« Reply #5 on: July 01, 2019, 07:12:16 am »
This is very interesting. Did you program the embedded controller in Pascal or Object Pascal, too? Can you provide a link to the software, its description or a paper about it?
Firmware is pure Pascal, it isn't sophisticated enough to warrant OP.  Code: https://github.com/ccrause/LazScope

Does continuously sends live the data via uart ?

I'm finishing the driver for the enc28j60 ethernet controller. What do you think, will be possible to send the data via ethernet ?
Not really live streaming, it is more a packet of data on request protocol. The GUI requests a data packet from the controller, the controller then read the ADC until the data buffer is full, then sends the data buffer to the GUI.

I think it will be easy to update the firmware to communicate over ethernet (if the ethernet driver can allow a say a 100 millisecond gap to collect and  pack the ADC readings).

Thaddy

  • Hero Member
  • *****
  • Posts: 14361
  • Sensorship about opinions does not belong here.
Re: Lazarus oscilloscope - FPC firmware + Lazarus GUI
« Reply #6 on: July 01, 2019, 08:45:22 am »
I did something similar, but probably less complete for KOL. NoteTChart is actually a very, very slow component, so I wrote my own (in 2003) with a ~ 10 millisecond resolution and a 64 bit buffer.
I have always loved these kind of projects. Good job!!
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

wp

  • Hero Member
  • *****
  • Posts: 11910
Re: Lazarus oscilloscope - FPC firmware + Lazarus GUI
« Reply #7 on: July 01, 2019, 10:33:27 am »
TChart is actually a very, very slow component, so I wrote my own (in 2003)
Why do you think that TAChart is "very, very slow". Did you apply it properly? And the first commit for TAChart in the Lazarus repository is dated 2007. So how could you say in 2003 that TAChart is slow?

Thaddy

  • Hero Member
  • *****
  • Posts: 14361
  • Sensorship about opinions does not belong here.
Re: Lazarus oscilloscope - FPC firmware + Lazarus GUI
« Reply #8 on: July 01, 2019, 10:37:02 am »
I did not write TAChart, I wrote TChart... which is around since Delphi 1..... And slow.
The author of TAchart must have thought the same thing....Reading is an art...
« Last Edit: July 01, 2019, 10:43:24 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

wp

  • Hero Member
  • *****
  • Posts: 11910
Re: Lazarus oscilloscope - FPC firmware + Lazarus GUI
« Reply #9 on: July 01, 2019, 10:51:43 am »
Reading is an art...
Yes, and I am aware that I am not the best in it. But in this case your post was misleading because the main chart component of both Delphi and Lazarus is called "TChart". "TAChart" is the name of the entire charting library of Lazarus while that of Delphi is called "TeeChart". So, it was not clear that you mean "TeeChart" when you were talking of "TChart".

ccrause

  • Hero Member
  • *****
  • Posts: 856
Re: Lazarus oscilloscope - FPC firmware + Lazarus GUI
« Reply #10 on: July 06, 2019, 06:04:59 pm »
Rearranged main form, serial port can now be selected from dropdown list.  Baud rate could be changed if firmware runs over slower connection. GUI tested on Linux Mint 19.1 and Windows 10.

Paul Breneman

  • Sr. Member
  • ****
  • Posts: 290
    • Control Pascal
Re: Lazarus oscilloscope - FPC firmware + Lazarus GUI
« Reply #11 on: July 07, 2019, 01:28:25 pm »
Rearranged main form, serial port can now be selected from dropdown list.  Baud rate could be changed if firmware runs over slower connection. GUI tested on Linux Mint 19.1 and Windows 10.

Fantastic!  What you've created and the new embedded forum sections made my day!
Regards,
Paul Breneman
www.ControlPascal.com

fred

  • Full Member
  • ***
  • Posts: 201
Re: Lazarus oscilloscope - FPC firmware + Lazarus GUI
« Reply #12 on: July 07, 2019, 03:06:03 pm »
Great!
Now I have to look for my Arduino and find time :)

GAN

  • Sr. Member
  • ****
  • Posts: 370
Re: Lazarus oscilloscope - FPC firmware + Lazarus GUI
« Reply #13 on: July 07, 2019, 10:34:31 pm »
Congratulations!

Can you add this to the wiki? https://wiki.freepascal.org/Lazarus_Application_Gallery
Lazarus 2.0.8 FPC 3.0.4 Linux Mint Mate 19.3
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite 3.32.3 - LazReport

ccrause

  • Hero Member
  • *****
  • Posts: 856
Re: Lazarus oscilloscope - FPC firmware + Lazarus GUI
« Reply #14 on: July 08, 2019, 09:56:49 am »

 

TinyPortal © 2005-2018