hsk-libs-dev  270
High Speed Karlsruhe XC878 library collection
Macros | Functions
hsk_icm7228.h File Reference

HSK ICM7228 8-Digit LED Display Decoder Driver generator. More...

#include <string.h>
Include dependency graph for hsk_icm7228.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ICM7228_FACTORY(prefix, regData, regMode, bitMode, regWrite, bitWrite)
 Generate an ICM7228 driver instance. More...
 

Functions

void hsk_icm7228_writeString (ubyte *const buffer, char const *str, ubyte pos, ubyte len)
 Convert an ASCII string to 7 segment encoding and store it in an xdata buffer. More...
 
void hsk_icm7228_writeDec (ubyte *const buffer, uword value, char power, ubyte const pos, ubyte len)
 Write a 7 segment encoded, right aligned decimal number into an xdata buffer. More...
 
void hsk_icm7228_writeHex (ubyte *const buffer, uword value, char power, ubyte const pos, ubyte len)
 Write a 7 segment encoded, right aligned hexadecimal number into an xdata buffer. More...
 
void hsk_icm7228_illuminate (ubyte *const buffer, ubyte segments, ubyte pos, ubyte len)
 Illumante the given number of segments. More...
 

Detailed Description

HSK ICM7228 8-Digit LED Display Decoder Driver generator.

This file is a code generating facility, that offers preprocessor macros that produce code for the Intersil ICM7228 display decoder.

Generating code in this fashion avoids the hard coding of I/O registers and bits and even allows the use of multiple ICM7228 ICs.

See also
Intersil ICM7228 Data Sheet: ICM7228.pdf
Author
kami

Macro Definition Documentation

§ ICM7228_FACTORY

#define ICM7228_FACTORY (   prefix,
  regData,
  regMode,
  bitMode,
  regWrite,
  bitWrite 
)

Generate an ICM7228 driver instance.

This creates functions to use a connect ICM7228 IC.

  • void <prefix>_init(void)
    • Initialize the buffer and I/O register bits
  • void <prefix>_refresh(void)
    • Commit buffered data to the 7 segment displays
  • void <prefix>_writeString(char * str, ubyte pos, ubyte len)
  • void <prefix>_writeDec(uword value, char power, ubyte pos, ubyte len)
  • void <prefix>_writeHex(uword value, char power, ubyte pos, ubyte len)
Parameters
prefixA prefix for the names of generated functions
regDataThe register that is connected to the data input
regModeThe register that is connected to the mode pin
bitModeThe bit of the regMode register that is connected to the mode pin
regWriteThe register that is connected to the write pin
bitWriteThe bit of the regWrite register that is connected to the write pin

Function Documentation

§ hsk_icm7228_illuminate()

void hsk_icm7228_illuminate ( ubyte *const  buffer,
ubyte  segments,
ubyte  pos,
ubyte  len 
)

Illumante the given number of segments.

Parameters
bufferThe target buffer for the encoded string
segmentsThe number of segments to illuminate
posThe target position in the buffer
lenThe number of digits available to encode the number

§ hsk_icm7228_writeDec()

void hsk_icm7228_writeDec ( ubyte *const  buffer,
uword  value,
char  power,
ubyte const  pos,
ubyte  len 
)

Write a 7 segment encoded, right aligned decimal number into an xdata buffer.

The power parameter controlls the placing of the '.' by 10 to the power. E.g. value = 12, power = -1 and len = 3 would result in the encoding of " 1.2". If power = 0, no dot is drawn. If the power is positive (typically 1), the resulting string would be filled with '0' characters. I.e. the previous example with power = 1 would result in an encoding of "012".

Parameters
bufferThe target buffer for the encoded string
valueThe number to encode
powerThe 10 base power of the number to encode
posThe target position in the buffer
lenThe number of digits available to encode the number

§ hsk_icm7228_writeHex()

void hsk_icm7228_writeHex ( ubyte *const  buffer,
uword  value,
char  power,
ubyte const  pos,
ubyte  len 
)

Write a 7 segment encoded, right aligned hexadecimal number into an xdata buffer.

The power parameter controlls the placing of the '.' by 16 to the power. E.g. value = 0x1A, power = -1 and len = 3 would result in the encoding of " 1.A". If power = 0, no dot is drawn. If the power is positive (typically 1), the resulting string would be filled with '0' characters. I.e. the previous example with power = 1 would result in an encoding of "01A".

Parameters
bufferThe target buffer for the encoded string
valueThe number to encode
powerThe 16 base power of the number to encode
posThe target position in the buffer
lenThe number of digits available to encode the number

§ hsk_icm7228_writeString()

void hsk_icm7228_writeString ( ubyte *const  buffer,
char const *  str,
ubyte  pos,
ubyte  len 
)

Convert an ASCII string to 7 segment encoding and store it in an xdata buffer.

This function is usually invoked through the <prefix>_writeString() function created by ICM7228_FACTORY.

The function will write into the buffer until it has been filled with len characters or it encounters a 0 character reading from str. If the character '.' is encountered it is merged with the previous character, unless that character is a '.' itself. Thus a single dot does not use additional buffer space. The 7 character string "foo ..." would result in 6 encoded bytes. Thus the proper len value for that string would be 6.

Parameters
bufferThe target buffer for the encoded string
strThe buffer to read the ASCII string from
posThe position in the buffer to write the encoded string to
lenThe target length of the encoded string