Forum > Embedded
LCD Displays on Pi or Beaglebone
jcdammeyer:
Here is another example of how easy it is to develop and test on the PC with either Linux or Windows and why I want to use Lazarus as is.
Once I had it working on the PC I did a drag and drop the folder onto in this case a BeagleBone Black running Stretch. The Beagle has a cable attached to a proto cape that runs to a board with a DS1822 temperature sensor/serial# chip. The driver on the Beagle automatically updates the file with two lines of information when it's read.
The application loads the File Dialog so you can find the w1_slave file in the folder with the devices serial #. Then when you click on OK it parses the strings of characters and generate the temperature to update into RackCtls package LED display I found on line by searching Lazarus 7 segment LED display.
The two attached screen shots show the result. With components like the LEDs and the graphs from Lazarus and an hour to write the application nice user interface applications with small LCD displays are trivial.
I'll add some documentation to the program and zip it up and attach it onto this subject thread. the program is huge but meant to test the parsing of some of the code. The LED display was an afterthought.
avra:
--- Quote from: jcdammeyer on July 20, 2020, 04:05:29 am ---Here is another example of how easy it is to develop and test on the PC with either Linux or Windows and why I want to use Lazarus as is.
--- End quote ---
That's one of the reasons why I advise sticking to LCL.
--- Quote from: jcdammeyer on July 20, 2020, 04:05:29 am ---The Beagle has a cable attached to a proto cape that runs to a board with a DS1822 temperature sensor/serial# chip.
--- End quote ---
Have this in mind: https://www.cnx-software.com/2020/07/13/fake-ds18b20-temperature-sensors-counterfeit-clones/
--- Quote from: jcdammeyer on July 20, 2020, 04:05:29 am ---The LED display was an afterthought.
--- End quote ---
You made me smile showing 3 decimals for the temperature. ;)
jcdammeyer:
--- Quote from: avra on July 20, 2020, 08:37:02 am ---Have this in mind: https://www.cnx-software.com/2020/07/13/fake-ds18b20-temperature-sensors-counterfeit-clones/
You made me smile showing 3 decimals for the temperature. ;)
--- End quote ---
Ha ha. It comes from the driver in the Beagle.
5d 01 4b 46 7f ff 03 10 8c : crc=8c YES
5d 01 4b 46 7f ff 03 10 8c t=21812
Divide by 1000.
Not worried about fakes. Mine were quite expensive even in 1000 qty. The board this particular sensor is connected to came from this:
http://www.autoartisans.com/rings/Barge1a.jpg The face of each lamp had one sensor in order to provide a unique serial number for each lamp which were on a CAN bus. We ended up using the temperature too.
http://www.autoartisans.com/rings/temperatures.jpg
The set at YVR airport one day in July had some lamps hit 60C. Very red on the display screen. I wish I'd captured a screen shot from that day now. When they were cold they were blue. Hover over the lamp indicator and at the bottom of the screen you'd get the reported temperature.
The lamps on the barge also reported DC voltage so the dual display but this screen shot doesn't shot that. http://www.autoartisans.com/rings/BargeRingsTemperatures.JPG The set facing North wasn't was warm as the set facing south.
Oh and the PC software? Delphi-7. PIC18F processors in the lamps (C code). Controller M9S12XDP512 (C-Code).
Going to take a closer look at this tomorrow. Now after midnight here.
Platform eXtended Library v1.1.0, dated 9-Dec-2017.
Copyright (c) 2000 - 2017 Yuriy Kotsarenko
https://asphyre.sourceforge.net
https://asphyre.net
-------------------------------------------------------------------------------
This product requires either Embarcadero Delphi XE 8 (or any later version) or
FreePascal 3.0 with Lazarus 1.4 (or any later versions).
When used with Embarcadero Delphi, the following platforms are supported:
1) Windows 32 and 64-bit
2) Mac OS X
3) Android
4) iOS 32 and 64-bit
avra:
--- Quote from: jcdammeyer on July 20, 2020, 09:17:05 am ---This product requires either Embarcadero Delphi XE 8 (or any later version) or
FreePascal 3.0 with Lazarus 1.4 (or any later versions).
--- End quote ---
I have mentioned it for Pi and BB using Laz/Fpc. This is from https://asphyre.net/products/pxl:
--- Quote ---Raspberry PI
- Fast access to CPU timer, GPIO, I²C, SPI and UART using direct manipulation of SoC registers.
- V4L2 video/image capture using onboard and USB cameras.
- OpenGL ES rendering with and without X server, including drawing to bitmaps. One of examples shows how to render your visual scene with GPU and then pass it to external display via SPI wiring!
- ...and many other features that are available for generic singleboard platforms.
BeagleBone Black
- Easy access to native Linux Sysfs interfaces such as GPIO, PWM, ADC, I²C, SPI and UART.
- Serial cameras such as VC0706 and LSY201.
- I²C and SPI displays such as SSD1306, SSD1351, PCB8544 (Nokia), HX8357 and ILI9340.
- Character LCDs with direct pin wiring.
- Support for Software SPI and UART (bit-banging).
- Support for SC16IS7x0 (UART controller connected via I²C or SPI), including extra GPIO pins.
- Support for sensors such as BMP180, DHT22, L3GD20, LSM303 and SHT10.
- Networking communications through UDP protocol.
- Video/image capturing through generic V4L2 interface.
- Software rendering for visual effects and user interfaces.
--- End quote ---
You can completely avoid PXL if you use LCL, since there are other libs for access to GPIO, SPI, I2C, serial...
https://wiki.freepascal.org/Hardware_Access
https://wiki.freepascal.org/Lazarus_on_Raspberry_Pi
https://wiki.freepascal.org/Raspberry_Pi_-_SPI
jcdammeyer:
--- Quote from: avra on July 20, 2020, 11:02:13 am ---
--- Quote from: jcdammeyer on July 20, 2020, 09:17:05 am ---This product requires either Embarcadero Delphi XE 8 (or any later version) or
FreePascal 3.0 with Lazarus 1.4 (or any later versions).
--- End quote ---
I have mentioned it for Pi and BB using Laz/Fpc.
You can completely avoid PXL if you use LCL, since there are other libs for access to GPIO, SPI, I2C, serial...
https://wiki.freepascal.org/Hardware_Access
--- End quote ---
Yes. And thanks for that link.
But the LCL and the link to
https://wiki.freepascal.org/Hardware_Access
seem more to address windows parallel ports than what is required for the Beagle. I must admit it's been over two yeas since I let the beagles out of their kennel. Been too busy with work-work projects. And the changes in how hardware is accessed over the lifetime of that device has been unsettling. I'm pretty sure the .dts files are still required. The Buster version is only available as command line not windowing. Maybe I should wait just in case the Beagle world has changed yet again.
The easy way to the I/O is just with the file operations.
--- Code: Text [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---debian@ebb:/sys/class/gpio/gpio68$ lsactive_low device direction edge label power subsystem uevent valuedebian@ebb:/sys/class/gpio/gpio68$ cat labelP8_10debian@ebb:/sys/class/gpio/gpio68$ cat directionindebian@ebb:/sys/class/gpio/gpio68$ cat value1debian@ebb:/sys/class/gpio/gpio68$ So slow I/O for turning on relays or reading switches isn't super difficult but certainly isn't compatible with the Pi. So the moment we dive into the world of control systems the software becomes somewhat system dependent.
But then that's true to a certain extent for embedded systems of any sort. Although I follow the same style regardless of whether I'm writing for a PIC18, dsPIC30 or PIC32 and M9X12X.
Generally the port bits are represented with a macro or a function that 'hides' the actual hardware so it can be moved inside the IOMapping.h file without affecting the application.
--- Code: C [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---if (fPowerSwitch) { ...}
The fPowerSwitch may well be a bit in a byte which is kept up to date via a PDO CANopen message from the network or local hardware. Or it may be local hardware.
In Lazarus or Delphi my guess would be to abstract it with property statements like
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- property PowerSwitch: TPortBit read FPowerSwitch write FPowerSwitch; and then
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- if PowerSwitch then begin ... end;
Now once again, depending on the Pi or Beagle or even PC where the power switch is doesn't matter. It could be on the parallel port of an embedded PC and the LCL ports are used.
Or just as easily on a CANUSB dongle with CAN bus support through the CAN library.
Or SPI bus and a port expansion chip.
But I need to get myself up to to date on how I/O is handled on the Beagle because the changes somewhere around 2017 or so were very significant. I believe the dts files are still needed.
At that point I didn't consider using Lazarus between a Pi and a BBB. But now things have changed.
I'll let you know what I find.
Navigation
[0] Message Index
[#] Next page
[*] Previous page