;
; This code fragment illustrates how to define the
; numerical digits and a few characters for use with a 7
; segment display. You only need to adjust the 8
; _SEG_x defines, the rest is done for you.
;
; Daniel Johnson
; Map LED segments to PORT bit positions, bit0 to bit7. ; This depends on how you circuit is wired
#define _SEG_A 0
#define _SEG_B 1
#define _SEG_C 3
#define _SEG_D 2
#define _SEG_E 6
#define _SEG_F 5
#define _SEG_G 7
#define _SEG_DP 4
;;; ---- no need to change code below this line ----
; map bit positions to bit values
#define _SA (1<<_SEG_A)
#define _SB (1<<_SEG_B)
#define _SC (1<<_SEG_C)
#define _SD (1<<_SEG_D)
#define _SE (1<<_SEG_E)
#define _SF (1<<_SEG_F)
#define _SG (1<<_SEG_G)
#define _SDP (1<<_SEG_DP)
; values to display digits 0 to 9
#define _0 _SA | _SB | _SC | _SD | _SE | _SF
#define _1 _SB | _SC
#define _2 _SA | _SB | _SE | _SD | _SG
#define _3 _SA | _SB | _SC | _SD | _SG
#define _4 _SB | _SC | _SF | _SG
#define _5 _SA | _SC | _SD | _SF | _SG
#define _6 _SA | _SC | _SD | _SE | _SF | _SG
#define _7 _SA | _SB | _SC
#define _8 _SA | _SB | _SC | _SD | _SE | _SF | _SG
#define _9 _SA | _SB | _SC | _SF | _SG
; other characters
#define _C _SA | _SD | _SE | _SF
#define _H _SB | _SC | _SE | _SF | _SG
;...