Skip to content

Commit 2f4dae3

Browse files
committed
Update
1 parent 89919f6 commit 2f4dae3

File tree

7 files changed

+956
-0
lines changed

7 files changed

+956
-0
lines changed

.github/workflows/build.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build Chip
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build:
9+
name: Build
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- name: Check out repository
13+
uses: actions/checkout@v3
14+
- name: Build chip
15+
uses: wokwi/wokwi-chip-clang-action@main
16+
with:
17+
sources: "src/main.c"
18+
- name: Copy chip.json
19+
run: sudo cp chip.json dist
20+
- name: 'Upload Artifacts'
21+
uses: actions/upload-artifact@v3
22+
with:
23+
name: chip
24+
path: |
25+
dist/chip.json
26+
dist/chip.wasm
27+
28+
# The release job only runs when you push a tag starting with "v", e.g. v1.0.0
29+
release:
30+
name: Release
31+
needs: build
32+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Download compiled chip
36+
uses: actions/download-artifact@v3
37+
with:
38+
name: chip
39+
path: chip
40+
- name: Create a zip archive
41+
run: cd chip && zip -9 ../chip.zip chip.*
42+
env:
43+
ZIP_VERSION: ${{ github.ref_name }}
44+
- name: Upload release
45+
uses: ncipollo/release-action@v1
46+
with:
47+
artifacts: chip.zip
48+
token: ${{ secrets.GITHUB_TOKEN }}
49+
generateReleaseNotes: true

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,62 @@
11
# Wokwi-Chip-Scope
2+
3+
## Description
4+
25
This 4 channel scope chip allows you to graph four analog or digital signals as they vary over time.
6+
7+
- Scope `Sample Time μs` range is 10µs to 10000 ms (default 100 µs).
8+
- Width of plot is 250 samples.
9+
- Trigger Channel selector (0-3) for analog or digital signals, default 0
10+
- `Trigger` modes are Off (`0`) Rising (default) ⬆ and Falling ⬇
11+
- Displays analog volts`Vmax`, and volts `Vmin`
12+
- Displays Sample Raye `S/s` and Capture Time `ms`
13+
- Displays Trigger Channel selection `>`
14+
- Displays Frequency Hz and Duty of digital signals
15+
16+
17+
18+
![image](https://user-images.githubusercontent.com/63488701/225511219-88cb7d44-6541-4598-9401-b627d5cc918f.png)
19+
20+
21+
22+
![image](https://user-images.githubusercontent.com/63488701/225514429-6fb7f9e2-90ab-4ad2-bad7-86c1d0b3c08f.png)
23+
24+
| Name | Description |
25+
| -------------- | ------------------------------------------------- |
26+
| D0, D1, D2, D3 | Digital INPUTs, located on left side of the chip. |
27+
| A0, A1, A2, A3 | Analog INPUTs, located on right side of the chip. |
28+
29+
If both a digital and analog signal are connected for the same channel, then the analog signal will be shown on the screen if any analog voltage is detected. In this case, the minimum volts may start at 1.0V due to activity of the digital signal. If the analog signal is set to 0.0 volts, then the digital signal will be shown.
30+
31+
For digital signals, the frequency (Hz) and duty (%) is calculated for the selected channel for trigger. Just select each channel for trigger to lock in on its signal and display the calculated parameters.
32+
33+
In the image above, D0 is selected for trigger shown by `>`. The analog voltage for the slide pot is not shown, as it is adjusted to minimum (0V). The signal generator is connected to A3 and the sine wave is displayed, If this analog signal is adjusted to 0.0 volts, then the waveform on channel D3 will be shown.
34+
35+
## Usage
36+
37+
To use this chip in your project, include it as a dependency in your `diagram.json` file:
38+
39+
```json
40+
"dependencies": {
41+
"chip-scope": "github:Dlloydev/Wokwi-Chip-scope@1.0.0"
42+
}
43+
```
44+
45+
Then, add the chip to your circuit by adding a `chip-scope` item to the `parts` section of `diagram.json`:
46+
47+
```json
48+
"parts": {
49+
...,
50+
{ "type": "chip-scope", "id": "chip-scope1" }
51+
},
52+
```
53+
54+
The actual source code for the chip lives in [src/main.c](https://github.com/Dlloydev/Wokwi-Chip-Scope/blob/main/src/main.c), and the pins are described in [chip.json](https://github.com/Dlloydev/Wokwi-Chip-Scope/blob/main/chip.json).
55+
56+
## Example
57+
58+
[![Wokwi_badge](https://user-images.githubusercontent.com/63488701/212449119-a8510897-c860-4545-8c1a-794169547ba1.svg)](https://wokwi.com/projects/359330496025635841) Graph four analog or digital signals as they vary over time.
59+
60+
## License
61+
62+
This project is licensed under the MIT license. See the [LICENSE](https://github.com/Dlloydev/Wokwi-Chip-Scope/blob/main/LICENSE) file for more details.

chip.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "Scope",
3+
"author": "David Lloyd",
4+
"license": "MIT",
5+
"docs": "https://github.com/Dlloydev/Wokwi-Chip-Scope/blob/main/docs/README.md",
6+
"pins": [
7+
"D0",
8+
"D1",
9+
"D2",
10+
"D3",
11+
"A3",
12+
"A2",
13+
"A1",
14+
"A0"
15+
],
16+
"display": {
17+
"width": 252,
18+
"height": 168
19+
},
20+
"controls": [
21+
{
22+
"id": "sampleTimeUs",
23+
"label": "Sample Time (μs)",
24+
"type": "range",
25+
"min": 0,
26+
"max": 400,
27+
"step": 10
28+
}, {
29+
"id": "sampleTimeMs",
30+
"label": "Sample Time (ms)",
31+
"type": "range",
32+
"min": 0,
33+
"max": 40,
34+
"step": 1
35+
},
36+
{
37+
"id": "triggerChannel",
38+
"label": "Trigger Channel",
39+
"type": "range",
40+
"min": 0,
41+
"max": 3,
42+
"step": 1
43+
},
44+
{
45+
"id": "triggerMode",
46+
"label": ".🇴┈┈┈┈┈┈⬆️┈┈┈┈┈┈⬇️",
47+
"type": "range",
48+
"min": 0,
49+
"max": 2,
50+
"step": 1
51+
}
52+
]
53+
}
54+

diagram.json

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"version": 1,
3+
"author": "David Lloyd",
4+
"editor": "wokwi",
5+
"parts": [
6+
{
7+
"type": "chip-scope",
8+
"id": "chip-scope1",
9+
"top": -565.38,
10+
"left": 43.2,
11+
"attrs": {}
12+
},
13+
{
14+
"type": "wokwi-photoresistor-sensor",
15+
"id": "ldr1",
16+
"top": -505.6,
17+
"left": -181.6,
18+
"attrs": {}
19+
},
20+
{ "type": "wokwi-gnd", "id": "gnd1", "top": -441.6, "left": -0.6, "attrs": {} },
21+
{
22+
"type": "wokwi-clock-generator",
23+
"id": "clkgen2",
24+
"top": -652.8,
25+
"left": -249.6,
26+
"attrs": {}
27+
},
28+
{ "type": "wokwi-flip-flop-d", "id": "flipflop1", "top": -662.4, "left": -163.2, "attrs": {} },
29+
{ "type": "wokwi-flip-flop-d", "id": "flipflop2", "top": -662.4, "left": -38.4, "attrs": {} },
30+
{ "type": "wokwi-flip-flop-d", "id": "flipflop3", "top": -662.4, "left": 86.4, "attrs": {} },
31+
{ "type": "wokwi-flip-flop-d", "id": "flipflop4", "top": -662.4, "left": 211.2, "attrs": {} },
32+
{ "type": "wokwi-flip-flop-d", "id": "flipflop5", "top": -662.4, "left": 336, "attrs": {} },
33+
{
34+
"type": "wokwi-slide-potentiometer",
35+
"id": "pot1",
36+
"top": -590.2,
37+
"left": 325.4,
38+
"attrs": { "travelLength": "30" }
39+
}
40+
],
41+
"connections": [
42+
[ "ldr1:GND", "gnd1:GND", "black", [ "h19.2", "v38" ] ],
43+
[ "chip-plot3-1:A0", "ldr1:AO", "green", [ "h-25.67", "v88.7" ] ],
44+
[ "clkgen2:CLK", "flipflop1:CLK", "purple", [ "v0" ] ],
45+
[ "flipflop1:Q", "flipflop2:CLK", "purple", [ "v0", "h9.6", "v19.2" ] ],
46+
[ "flipflop2:Q", "flipflop3:CLK", "purple", [ "v0", "h9.6", "v19.2" ] ],
47+
[ "flipflop3:Q", "flipflop4:CLK", "purple", [ "v0", "h9.6", "v19.2" ] ],
48+
[ "flipflop4:Q", "flipflop5:CLK", "purple", [ "v0", "h9.6", "v19.2" ] ],
49+
[ "flipflop1:NOTQ", "flipflop1:D", "purple", [ "h0", "v19.2", "h-105.6", "v-28.8" ] ],
50+
[ "flipflop2:NOTQ", "flipflop2:D", "purple", [ "h0", "v19.2", "h-105.6", "v-38.4" ] ],
51+
[ "flipflop3:NOTQ", "flipflop3:D", "purple", [ "h0", "v19.2", "h-105.6", "v-28.8" ] ],
52+
[ "flipflop4:NOTQ", "flipflop4:D", "purple", [ "h0", "v19.2", "h-105.6", "v-38.4" ] ],
53+
[ "flipflop5:NOTQ", "flipflop5:D", "purple", [ "h9.6", "v28.8", "h-115.2", "v-48" ] ],
54+
[ "ldr1:DO", "chip-scope1:D2", "green", [ "h28.8", "v-48.6" ] ],
55+
[ "chip-scope1:D1", "flipflop5:Q", "green", [ "h-38.4", "v-48", "h441.6", "v-9.6" ] ],
56+
[
57+
"chip-scope1:D0",
58+
"flipflop4:Q",
59+
"green",
60+
[ "h-28.8", "v-28.8", "h297.6", "v-67.2" ]
61+
]
62+
],
63+
"dependencies": { "chip-scope": "github:Dlloydev/Wokwi-Chip-Scope@1.0.0" }
64+
}

docs/README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Wokwi-Chip-Scope
2+
3+
## Description
4+
5+
This 4 channel scope chip allows you to graph four analog or digital signals as they vary over time.
6+
7+
- Scope `Sample Time μs` range is 10µs to 10000 ms (default 100 µs).
8+
- Width of plot is 250 samples.
9+
- Trigger Channel selector (0-3) for analog or digital signals, default 0
10+
- `Trigger` modes are Off (`0`) Rising (default) ⬆ and Falling ⬇
11+
- Displays analog volts`Vmax`, and volts `Vmin`
12+
- Displays Sample Raye `S/s` and Capture Time `ms`
13+
- Displays Trigger Channel selection `>`
14+
- Displays Frequency Hz and Duty of digital signals
15+
16+
17+
18+
![image](https://user-images.githubusercontent.com/63488701/225511219-88cb7d44-6541-4598-9401-b627d5cc918f.png)
19+
20+
21+
22+
![image](https://user-images.githubusercontent.com/63488701/225514429-6fb7f9e2-90ab-4ad2-bad7-86c1d0b3c08f.png)
23+
24+
| Name | Description |
25+
| -------------- | ------------------------------------------------- |
26+
| D0, D1, D2, D3 | Digital INPUTs, located on left side of the chip. |
27+
| A0, A1, A2, A3 | Analog INPUTs, located on right side of the chip. |
28+
29+
If both a digital and analog signal are connected for the same channel, then the analog signal will be shown on the screen if any analog voltage is detected. In this case, the minimum volts may start at 1.0V due to activity of the digital signal. If the analog signal is set to 0.0 volts, then the digital signal will be shown.
30+
31+
For digital signals, the frequency (Hz) and duty (%) is calculated for the selected channel for trigger. Just select each channel for trigger to lock in on its signal and display the calculated parameters.
32+
33+
In the image above, D0 is selected for trigger shown by `>`. The analog voltage for the slide pot is not shown, as it is adjusted to minimum (0V). The signal generator is connected to A3 and the sine wave is displayed, If this analog signal is adjusted to 0.0 volts, then the waveform on channel D3 will be shown.
34+
35+
## Usage
36+
37+
To use this chip in your project, include it as a dependency in your `diagram.json` file:
38+
39+
```json
40+
"dependencies": {
41+
"chip-scope": "github:Dlloydev/Wokwi-Chip-scope@1.0.0"
42+
}
43+
```
44+
45+
Then, add the chip to your circuit by adding a `chip-scope` item to the `parts` section of `diagram.json`:
46+
47+
```json
48+
"parts": {
49+
...,
50+
{ "type": "chip-scope", "id": "chip-scope1" }
51+
},
52+
```
53+
54+
The actual source code for the chip lives in [src/main.c](https://github.com/Dlloydev/Wokwi-Chip-Scope/blob/main/src/main.c), and the pins are described in [chip.json](https://github.com/Dlloydev/Wokwi-Chip-Scope/blob/main/chip.json).
55+
56+
## Example
57+
58+
[![Wokwi_badge](https://user-images.githubusercontent.com/63488701/212449119-a8510897-c860-4545-8c1a-794169547ba1.svg)](https://wokwi.com/projects/359330496025635841) Graph four analog or digital signals as they vary over time.
59+
60+
## License
61+
62+
This project is licensed under the MIT license. See the [LICENSE](https://github.com/Dlloydev/Wokwi-Chip-Scope/blob/main/LICENSE) file for more details.

0 commit comments

Comments
 (0)