LoginSignup
0
1

More than 3 years have passed since last update.

PYNQ-Z1 > AxiGPIOを使ったButtonの押下検知とLED点灯

Last updated at Posted at 2020-06-07
動作環境
Windows 10 Pro (v1909) 
PYNQ-Z1 (Digilent) (以下、PYNQと表記)
Vivado v2019.1 (64-bit)

概要

  • VivadoにてLEDとButtonを設定してbitstream作成
  • AxiGPIOを使ったButtonの押下検知

Block Design

コメント 2020-06-07 160435.png

AxiGPIO

switchesの部分をbuttonに読み替えた。

AxiGPIOを使ったButtonの押下検知とLED点灯

from pynq import Overlay
from pynq import PL
OL = Overlay("/home/xilinx/pynq/overlays/base/2020-06-07_LED_SW.bit")
OL.download()
from pynq.lib import AxiGPIO
led_ip = OL.ip_dict['leds']
buttons_ip = OL.ip_dict['buttons']
leds = AxiGPIO(led_ip).channel1
buttons = AxiGPIO(buttons_ip).channel1
buttons.read()

ボタンを押しながら実行すると[8]や[1]などになる。

LEDの点灯は下記でできる。2つ目と4つ目が点灯する。

mask = 0xffffffff
leds.write(10, mask)
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1