Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Shreyas N R
Published © GPL3+

PMOD IP for Kria KV260 using Vivado/VitisHLS/Petalinux2022.1

This project demonstrates how to control the PMOD IO on the KV260 carrier board running Petalinux 2023.1 & develop IP for it using VitisHLS.

IntermediateFull instructions provided3 hours1,096
PMOD IP for Kria KV260 using Vivado/VitisHLS/Petalinux2022.1

Things used in this project

Story

Read more

Code

CLock display on 7 segment display

Python
import time
import seven_segment_display
import seven_segment_i2c




def main():    
    try:
        bus = seven_segment_i2c.SevenSegmentI2c(3)
        display = seven_segment_display.SevenSegmentDisplay(bus)
        display.clear_display()
        enable_colon = False
        display_military = False
        #store the previous time, so that
        #we only update the display when the time
        #changes
        prev_time = 0
        while True:
            if display_military:
                #24 hour format
                h = int(time.strftime("%H", time.localtime()))
            else:
                #12 hour format
                h = int(time.strftime("%I", time.localtime()))
            m = time.localtime().tm_min
            #time value to write to device
            val = h * 100 + m
            
            #make the colon blink every other cycle
            enable_colon = not enable_colon
            nondigits = []
            if enable_colon:
                nondigits.append(seven_segment_display.DotEnum.COLON)
            display.set_nondigits(nondigits)
            if prev_time != val:
                display.write_int(val)
            #save the current time as previous for the next iteration
            #of the loop so we can check if we actually need to update
            #the display with the new time
            prev_time = val
            time.sleep(1)
    except IOError as ex:
        print (ex)

        
if  __name__ =='__main__':
    main()

Basic Test code for 4 Digit 7 segment display

Python
import seven_segment_display
import seven_segment_i2c
bus = seven_segment_i2c.SevenSegmentI2c(3)
display = seven_segment_display.SevenSegmentDisplay(bus)
display.clear_display()
display.write_int('SHRE')

Installing PIP on the KV260 board

Credits

Shreyas N R
2 projects • 5 followers
Contact
Thanks to Whitney Knitter.

Comments

Please log in or sign up to comment.