Skip to content

Instantly share code, notes, and snippets.

@katogiso
katogiso / raspberrypi_drive_motor.c
Created November 5, 2017 06:42
RaspberryPi drive motor sample
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#define PERI_BASE 0x3F000000
#define GPIO_BASE (PERI_BASE + 0x200000)
#define PWM_BASE (PERI_BASE + 0x20C000)
#define CLK_BASE (PERI_BASE + 0x101000)
@katogiso
katogiso / raspberrypi_pwm.c
Created November 5, 2017 06:39
RaspberryPi pwm sample
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#define PERI_BASE 0x3F000000
#define GPIO_BASE (PERI_BASE + 0x200000)
#define PWM_BASE (PERI_BASE + 0x20C000)
#define CLK_BASE (PERI_BASE + 0x101000)
@katogiso
katogiso / gpio.c
Created November 5, 2017 06:27
RaspberryPi gpio sample
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#define PERI_BASE 0x3F000000
#define GPIO_BASE (PERI_BASE + 0x200000) /* GPIO controller */
#define PAGE_SIZE (4*1024)
#define BLOCK_SIZE (4*1024)
Sub Pack()
Dim a() As String ' 文字列を入れる配列
Dim index As Integer ' 有効なセルの個数
index = 0
For Each c In ThisWorkbook.Sheets("Source").Range("B1:B10")
If c <> "" Then
ReDim Preserve a(index) ' 必要な配列を確保する
a(index) = c
index = index + 1
<!DOCTYPE html>
<head lang="en">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.min.js"></script>
</head>
<body>
<canvas id="myChart" width="400" height="400"></canvas>
</body>
<script>

TD4

[CPUの創りかた]で定義されている TD4 を参考にして、モックを作成する。

主な仕様

data
汎用レジスタ 4bit x 2
アドレス空間 4bit
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.min.js"></script>
<!-- https://github.com/google/palette.js -->
<script src="../../palette.js/palette.js"></script>
</head>
<body>
<canvas id="myChart" width="400" height="400"></canvas>
</body>
<script>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.js"></script>
<!-- https://github.com/google/palette.js -->
<script src="../../palette.js/palette.js"></script>
</head>
<body>
<canvas id="myChart"></canvas>
</body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>This is sample page</title>
</head>
<body>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.2/d3.js"></script>
<script>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.min.js"></script>
<!-- https://github.com/google/palette.js -->
<script src="../../palette.js/palette.js"></script>
</head>
<body>
<canvas id="myChart" width="400" height="400"></canvas>
</body>
<script>