Pages

Friday, January 6, 2023

AVR serial to 8 digits seven segment numeric display


The avr_serial7segment8bitdisplay is an ATmega8 based device that get's 8 digits numbers from the UART line and display to a seven segment display with 8 digits.

As example, it can be used as exchange rate display.


By default it can display positive (max 8 digits) and negative (max 9 digits) integer and double precision numbers.

The display driver used for the seven segment display is the MAX7219.

It can perform pad left of pad right justification.
Also it can load the last values recorded to the internal EEPROM.


The protocol used to send data to the device is simple, find below the format:
STX CRC dd n ETX
  • STX is 0x02
  • CRC 1 byte check code
  • dd (2 char numbers) is the display number 00..99
  • n (1 to 8 char numbers + optional . or first character minus) is the float digit, one dot, negative char and numbers allowed
  • ETX is 0x03
As you may notice it can handle up to 99 8 digits seven segment display.
A CRC 1 byte code is required to be sure that the data is received with success.
If the CRC code is checked successfully then the number is parsed, and eventually displayed and recorded in the internal EEPROM.


 Errors in getting data can be skipped or displayed by setting the desired behavior at compile time.

A PowerShell script (https://en.wikipedia.org/wiki/PowerShell) has been used to test this device. You can use this script to write your own or to send directly your data.

The sample board provided use 2 seven segment display.

The UART to USB interface chip is the CP2102. I've select this chip cause it works without problem over the main operating systems.

The power as the data are provided through a micro USB port. 

The ATmega8 runs @1Mhz using the internal LC oscillator.

I've also design a small 3D printable enclosure that I've printed using PLA.


 
Code and Schematics

Notes
  • read risk disclaimer
  • excuse my bad english

No comments:

Post a Comment