vfd_hv518.c File Reference

library to drive vacuum fluorescent display using supertex HV518 shift register VFD drivers (code) More...

Go to the source code of this file.

## Macros

#define | VFD_PORT GPIOA
| GPIO port.
#define | VFD_PORT_RCC RCC_GPIOA
| GPIO port peripheral clock.
#define | VFD_STR GPIO6
| strobe pin to enable high voltage output, high voltage is output on low
#define | VFD_NLE GPIO4
| latch enable pin, stores the shifted data on low, output the parallel data on high
#define | VFD_SPI_RCC RCC_SPI1
| SPI peripheral.
#define | VFD_SPI_PORT GPIOA
| GPIO port.
#define | VFD_SPI_PORT_RCC RCC_GPIOA
| GPIO port peripheral clock.
#define | VFD_SPI_IRQ NVIC_SPI1_IRQ
| SPI peripheral interrupt signal.
#define | VFD_SPI_ISR spi1_isr
| SPI interrupt service routine.
#define | VFD_CLK GPIO_SPI1_SCK
| clock signal
#define | VFD_DIN GPIO_SPI1_MOSI
| data input, where the data is shifted to
#define | VFD_TIMER_RCC RCC_TIM2
| timer peripheral clock
#define | VFD_TIMER_IRQ NVIC_TIM2_IRQ
| timer interrupt signal
#define | VFD_TIMER_ISR tim2_isr
| timer interrupt service routine

## Functions

void | vfd_digit (uint8_t nb, char c)
| set character to digit block More...
void | vfd_matrix (uint8_t nb, char c)
| set character to matrix block More...
void | vfd_clear (void)
| clear VFD display
void | vfd_test (void)
| test VFD display (light up all segments)
void | vfd_on (void)
| switch VFD on
void | vfd_off (void)
| switch VFD display off
void | vfd_setup (void)
| setup VFD
void | VFD_SPI_ISR (void)
| SPI interrupt service routine called when data has been transmitted.
void | VFD_TIMER_ISR (void)
| timer interrupt service routine called time passed

## Variables

static const uint8_t | ascii_7segments []
| ASCII characters encoded for the 7 segments digit block. More...
static const uint8_t | font5x7 [][5]
| font for the 5x7 dot matrix block More...
static const uint8_t | pict5x7 [][5]
| pictures for the 5x7 dot matrix block More...
static uint16_t | driver_data [VFD_MATRIX][VFD_DRIVERS *2] = {0}
| the 32 bits values to be shifted out to the VFD driver More...
static volatile uint8_t | spi_i = 0
| which driver data is being transmitted
static volatile uint8_t | vfd_grid = 0
| which grid/part to activate More...
static const uint32_t | digit_mask = 0x00fffff0
| the bits used for selecting then digit and 7 segment anodes More...

## Detailed Description

library to drive vacuum fluorescent display using supertex HV518 shift register VFD drivers (code)

the current configuration is for a VFD extracted from a Samsung SER-6500 cash register

Author
  King Kévin kingk.nosp@m.evin.nosp@m.@cuvo.nosp@m.odoo.nosp@m..info

Date
  2016

Note
  peripherals used: SPI SPI to send data to supertex HV518 VFD drivers , GPIO GPIO to control supertex HV518 VFD drivers , timer timer for automatic display blocks refresh

Definition in file vfd_hv518.c.

## Function Documentation

## vfd_digit()

void vfd_digit | ( | uint8_t | nb,
|  | char | c
| ) |  |

set character to digit block

Parameters

  [in] | nb | digit block to set
  [in] | c | ASCII character to set

Note
  use the MSB of `nb` to enable the dot

Definition at line 305 of file vfd_hv518.c.

## vfd_matrix()

void vfd_matrix | ( | uint8_t | nb,
|  | char | c
| ) |  |

set character to matrix block

Parameters

  [in] | nb | matrix block to set
  [in] | c | ASCII character to set

Note
  on ASCII characters are used for pictures

Definition at line 345 of file vfd_hv518.c.

## Variable Documentation

## ascii_7segments

const uint8_t ascii_7segments[]

static

ASCII characters encoded for the 7 segments digit block.

Note
  starts with space

Definition at line 68 of file vfd_hv518.c.

## digit_mask

const uint32_t digit_mask = 0x00fffff0

static

the bits used for selecting then digit and 7 segment anodes

Note
  for the second driver

Definition at line 303 of file vfd_hv518.c.

## driver_data

uint16_t driver_data[VFD_MATRIX][VFD_DRIVERS *2] = {0}

static

the 32 bits values to be shifted out to the VFD driver

Note
  split into 16 bit for SPI transfer
  since the bits for digits and matrix are independent, they can be combined
  we have more matrix (12) than digits (10)

Definition at line 293 of file vfd_hv518.c.

## font5x7

const uint8_t font5x7[][5]

static

font for the 5x7 dot matrix block

first value is left-most line, LSB is top dot, MSB is not used

Note
  from http://sunge.awardspace.com/glcd-sd/node4.html

Definition at line 170 of file vfd_hv518.c.

## pict5x7

const uint8_t pict5x7[][5]

static

Initial value:
= {
{0x08, 0x08, 0x2A, 0x1C, 0x08},
{0x08, 0x1C, 0x2A, 0x08, 0x08},
{0b01110000, 0b01110000, 0b01111010, 0b01111100, 0b01011000},
{0b00100000, 0b01110000, 0b01110010, 0b01111100, 0b01011000},
{0b00111110, 0b01001001, 0b01010110, 0b01001001, 0b00111110},
{0b00111110, 0b01010001, 0b01100110, 0b01010001, 0b00111110},
{0b00111000, 0b01010111, 0b01100100, 0b01010111, 0b00111000},
{0b00111000, 0b01001111, 0b01010100, 0b01001111, 0b00111000},
{0b00111000, 0b01011110, 0b01101000, 0b01011110, 0b00111000},
{0b01000001, 0b00110110, 0b00001000, 0b00110110, 0b01000001},
{~0b01000001, ~0b00110110, ~0b00001000, ~0b00110110, ~0b01000001},
{0b00100010, 0b00010100, 0b00001000, 0b00010100, 0b00100010},
{~0b00100010, ~0b00010100, ~0b00001000, ~0b00010100, ~0b00100010},
{0x00, 0x00, 0x00, 0x00, 0x00}
}

pictures for the 5x7 dot matrix block

first value is left-most line, LSB is top dot, MSB is not used

Definition at line 271 of file vfd_hv518.c.

## vfd_grid

volatile uint8_t vfd_grid = 0

static

which grid/part to activate

Note
  digits and matrix can be combined

Definition at line 299 of file vfd_hv518.c.