• Navigation überspringen
  • Zur Navigation
  • Zum Seitenende
Organisationsmenü öffnen Organisationsmenü schließen
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
  • FAUZur zentralen FAU Website
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Suche öffnen
  • English
  • Campo
  • StudOn
  • FAUdir
  • Stellenangebote
  • Lageplan
  • Hilfe im Notfall
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
Menu Menu schließen
  • Lehrstuhl
    • Team
    • Aktuelles
    • Kontakt und Anfahrt
    • Leitbild
    • 50-jähriges Jubiläum
    Portal Lehrstuhl
  • Forschung
    • Forschungsbereiche
      • Betriebssysteme
      • Confidential Computing
      • Eingebettete Systemsoftware
      • Verteilte Systeme
    • Projekte
      • AIMBOS
      • BALu
      • BFT2Chain
      • DOSS
      • Mirador
      • NEON
      • PAVE
      • ResPECT
      • Watwa
    • Projektkampagnen
      • maRE
    • Seminar
      • Systemsoftware
    Portal Forschung
  • Publikationen
  • Lehre
    • Sommersemester 2025
      • Applied Software Architecture
      • Ausgewählte Kapitel der Systemsoftware
      • Betriebssystemtechnik
      • Projekt angewandte Systemsoftwaretechnik
      • System-Level Programming
      • Systemnahe Programmierung in C
      • Systemprogrammierung 1
      • Verteilte Systeme
    • Wintersemester 2024/25
      • Betriebssysteme
      • Middleware – Cloud Computing
      • Systemprogrammierung 2
      • Verlässliche Echtzeitsysteme
      • Virtuelle Maschinen
      • Web-basierte Systeme
    Portal Lehre
  • Examensarbeiten
  1. Startseite
  2. Extern

Extern

Bereichsnavigation: Lehre
  • Systemnahe Programmierung in C
    • Vorlesung
      • Übung
        • Folien
        • Aufgaben
        • SPiCboard
          • Bauanleitung
            • Programmieren im CIP
              • Programmieren von zu Hause
                • libspicboard-Doku
                  • SPiC-IDE
                    • SPiCsim
                      • FAQ
                        • Projekte
                        • Linux libc-Doku
                        • Prüfung
                          • Evaluation
                            • Intern

                            FAQ

                            Files | Functions
                            7seg (Seven Segment Display)

                            Controls the two 7-segment displays on the board. More...

                            Files

                            file  7seg.h
                             

                            Functions

                            int8_t sb_7seg_showNumber (int8_t nmbr)
                             Prints a number in the range [-9; 99] on the 7-segment display. More...
                             
                            int8_t sb_7seg_showHexNumber (uint8_t nmbr)
                             Prints the hexadecimal representation of an 8-bit unsigned integer on the 7-segment display. More...
                             
                            int8_t sb_7seg_showString (const char *str)
                             Prints a 2 character string on the 7-segment display. More...
                             
                            void sb_7seg_setMask (uint8_t mask)
                             Set the LEDs of the 7-segment display manually. More...
                             
                            void sb_7seg_disable (void)
                             Disables the 7-segment displays. More...
                             

                            Detailed Description

                            Controls the two 7-segment displays on the board.

                            The two 7-segment displays of the SPiCboard share one common port of the MCU. The two displays can be connected and disconnected from the port using two transistors. By quickly and periodically connecting and disconnecting the displays an observer will not be able to notice when a display is disabled and both displays can be used apparently simultaneously.

                            The module uses the 8-bit Timer 2 of the ATmega328PB to multiplex the two 7-segment displays.

                            Note
                            As the timer is used, interrupts must be enabled for the display to work (if one of the 7 segments seems to be not working it is quite likely that interrupts are not enabled – you have to call sei() provided by avr/interrupt.h!)

                            Example code to display "ok":

                            #include <avr/interrupt.h>
                            #include "7seg.h"
                            void main(void){
                            // enable interrupts
                            sei();
                            // display "ok"
                            sb_7seg_showString("ok");
                            // spin forever
                            while(1) {};
                            }
                            7seg.h
                            sb_7seg_showString
                            int8_t sb_7seg_showString(const char *str)
                            Prints a 2 character string on the 7-segment display.
                            See also
                            timer.h

                            Function Documentation

                            void sb_7seg_disable ( void  )

                            Disables the 7-segment displays.

                            Any running alarms are unregistered.

                            void sb_7seg_setMask ( uint8_t  mask)

                            Set the LEDs of the 7-segment display manually.

                            The bitfield contains one bit for each of the 7 segment LEDs of a block. A set bit enables and a cleared bit disables the corresponding LED. The most significant bit determines the block: If set, the first block (tens' place) will be used, if cleared the second block (ones' place)

                            For example a value of 0x86 (decimal 134, binary representation: 1000 0110) will enlight the LEDs 1 and 2 of the first block.

                            Parameters
                            mask8-bit bitfield describing the desired 7 segment display state
                            int8_t sb_7seg_showHexNumber ( uint8_t  nmbr)

                            Prints the hexadecimal representation of an 8-bit unsigned integer on the 7-segment display.

                            Parameters
                            nmbrthe number to print
                            Return values
                            0on success
                            !0on error
                            int8_t sb_7seg_showNumber ( int8_t  nmbr)

                            Prints a number in the range [-9; 99] on the 7-segment display.

                            Parameters
                            nmbrthe number to print
                            Return values
                            0success
                            -1nmbr is smaller than -9
                            -2nmbr is greater than 99
                            int8_t sb_7seg_showString ( const char *  str)

                            Prints a 2 character string on the 7-segment display.

                            Supported characters are in the group [-_ 0-9A-Za-z] (contains space). Read this article for possible representations of these characters. Two characters of the set should never have the same representation. No differentiation is made between upper- and lowercase characters.

                            Parameters
                            strthe 0-terminated string
                            Return values
                            0success
                            -1character at position 0 not printable
                            -2character at position 1 not printable
                            -3both characters not printable
                            -4str is an empty string
                            Friedrich-Alexander-Universität
                            Erlangen-Nürnberg

                            Schlossplatz 4
                            91054 Erlangen
                            • Impressum
                            • Datenschutz
                            • Barrierefreiheit
                            • Facebook
                            • RSS Feed
                            • Xing
                            Nach oben