完成实验1

This commit is contained in:
Jingfan Ke 2024-06-11 23:30:29 +08:00
parent 5fc6d8f2b4
commit 30189650c2
27 changed files with 503 additions and 0 deletions

View File

@ -0,0 +1,313 @@
# Inventory: inventory
- request
| 字段名称 | 比特数 |
| ------------ | ----------- |
| SOF | |
| Flags | 8 bits |
| Inventory | 8 bits |
| Optional AFI | 8 bits |
| Mask length | 8 bits |
| Mask value | 0 64 bits |
| CRC16 | 16 bits |
| EOF | |
- responses
| 字段名称 | 比特数 |
| -------- | ------- |
| SOF | |
| Flags | 8 bits |
| DSFID | 8 bits |
| UID | 64 bits |
| CRC16 | 16 bits |
| EOF | |
- 函数
```c
int inventory(
uint8 u8Flag,
uint8 u8AFI,
uint8 u8MaskLen, // bitlen
uint8 au8MaskValue[8], // .
uint8 *pu8RxFlags,
uint8 *pu8RxDSFID,
uint8 au8RxUID[8]
);
```
返回:
- `1` 表示清晰收到一个 VICC 的应答;
- `0` 表示没有 VICC 应答;
- `<0` 表示有多个 VICC 应答;
如果返回 `< 0` 或者VCD 发送 EOF继续点名或者修改 masklen & maskvalue重新发送 inventory()
# Stay quiet:
- request
| 字段名称 | 比特数 |
| ---------- | ------- |
| SOF | |
| Flags | 8 bits |
| Stay quiet | 8 bits |
| UID | 64 bits |
| CRC16 | 16 bits |
| EOF | |
- response
- 函数
```c
int stayQuiet(
uint8 u8Flags,
uint8 au8UID[8]
);
```
# Read Single Block
- request
| 字段名称 | 比特数 |
| ----------------- | ------- |
| SOF | |
| Flags | 8 bits |
| Read single block | 8 bits |
| UID | 64 bits |
| Block number | 8 bits |
| CRC16 | 16 bits |
| EOF | |
request 中,是否存在 UID由 flags 决定address mode or select mode
- response
| 字段名称 | 比特数 |
| ---------- | ------- |
| SOF | |
| Flags | 8 bits |
| Error code | 8 bits |
| CRC16 | 16 bits |
| EOF | |
| 字段名称 | 比特数 |
| --------------------- | ------- |
| SOF | |
| Flags | 8 bits |
| Block security status | 8 bits |
| Data | |
| Block length | |
| CRC16 | 16 bits |
| EOF | |
- 函数
```c
int readSingleBlk(
uint8 u8Flags,
uint8 au8UID[8],
uint8 u8BlkNo,
uint8 *pu8RxFlags,
uint8 *pu8ErrCode
uint8 *pu8BlkSecurityStatus,
uint8 au8Dat[]
);
```
返回值flags.
是否返回pu8BlkSecurityStatus要看 u8Flags 中 optional_flag。
```c
// 返回0正确否则 Flags.
Uint8 readSingleBlk(
uint8 u8VisitMode, // 1 for address mode, 0 for select mode
uint8 u8Optionalflag; // 1 return security status;
uint8 au8UID[8],
uint8 u8BlkNo,
uint8 *pu8BlkSecurityStatus, // optionalflag = 1 时,有效;
uint8 au8Dat[]
);
```
# Write Single Block
- request
| 字段名称 | 比特数 |
| ------------------ | ------- |
| SOF | |
| Flags | 8 bits |
| Write single block | 8 bits |
| UID | 64 bits |
| Block number | 8 bits |
| Data | |
| Block length | |
| CRC16 | 16 bits |
| EOF | |
- response
- 有 Error_flag
| 字段名称 | 比特数 |
| ---------- | ------- |
| SOF | |
| Flags | 8 bits |
| Error code | 8 bits |
| CRC16 | 16 bits |
| EOF | |
- 无 Error_flag
| 字段名称 | 比特数 |
| ---------- | ------- |
| SOF | |
| Flags | 8 bits |
| Error code | 8 bits |
| CRC16 | 16 bits |
| EOF | |
- 函数
```c
int writeSingleBlk(
uint8 u8Flags,
uint8 au8UID[8],
uint8 u8BlkNo,
uint8 au8Dat[],
uint8 *pu8RxFlags,
uint8 *pu8ErrCode
);
```
# Read multiple Blocks
- request
| 字段名称 | 比特数 |
| ------------------- | ------- |
| SOF | |
| Flags | 8 bits |
| Read multiple block | 8 bits |
| UID | 64 bits |
| First block number | 8 bits |
| Number of blocks | 8 bits |
| CRC16 | 16 bits |
| EOF | |
- response
- 有 Error_flag
| 字段名称 | 比特数 |
| ---------- | ------- |
| SOF | |
| Flags | 8 bits |
| Error code | 8 bits |
| CRC16 | 16 bits |
| EOF | |
- 无 Error_flag
| 字段名称 | 比特数 |
| --------------------- | ------- |
| SOF | |
| Flags | 8 bits |
| Block security status | 8 bits |
| Data | |
| Block length | |
| CRC16 | 16 bits |
| EOF | |
**注**: Data 和 Block length 的内容根据需要重复。
- 函数
```c
int readMultipleBlks(
uint8 u8Flags,
uint8 au8UID[8],
uint8 u8BlkFirstNo,
uint8 u8BlkNums,
uint8 *pu8RxFlags,
uint8 *pu8ErrCode
uint8 au8BlkSecurityStatus[],
uint8 au8Dat[]
);
```
# Write multiple Blocks
- request
| 字段名称 | 比特数 |
| -------------------- | ------- |
| SOF | |
| Flags | 8 bits |
| Write multiple block | 8 bits |
| UID | 64 bits |
| First block number | 8 bits |
| Number of blocks | 8 bits |
| Data | |
| Block length | |
| CRC16 | 16 bits |
| EOF | |
**注**: Data 和 Block length 的内容根据需要重复。
- response
- 有 Error_flag
| 字段名称 | 比特数 |
| ---------- | ------- |
| SOF | |
| Flags | 8 bits |
| Error code | 8 bits |
| CRC16 | 16 bits |
| EOF | |
- 无 Error_flag
| 字段名称 | 比特数 |
| -------- | ------- |
| SOF | |
| Flags | 8 bits |
| CRC16 | 16 bits |
| EOF | |
- 函数
```c
int writeMultipleBlks (
uint8 u8Flags,
uint8 au8UID[8],
uint8 u8BlkFirstNo,
uint8 u8BlkNums,
uint8 au8Dat[],
uint8 *pu8RxFlags,
uint8 *pu8ErrCode
);
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 MiB

After

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 MiB

After

Width:  |  Height:  |  Size: 3.0 MiB

View File

Before

Width:  |  Height:  |  Size: 2.9 MiB

After

Width:  |  Height:  |  Size: 2.9 MiB

View File

@ -0,0 +1,190 @@
<h1><center>课程实验</center></h1>
<div style="text-align: center;">
<div><span style="display: inline-block; width: 65px; text-align: center;">课程名称</span><span style="display: inline-block; width: 25px;">:</span><span style="display: inline-block; width: 210px; font-weight: bold; text-align: left;">RFID 原理与应用</span></div>
<div><span style="display: inline-block; width: 65px; text-align: center;">实验名称</span><span style="display: inline-block; width: 25px;">:</span><span style="display: inline-block; width: 210px; font-weight: bold; text-align: left;">原理机试验</span></div>
<div><span style="display: inline-block; width: 65px; text-align: center;">学号</span><span style="display: inline-block; width: 25px;">:</span><span style="display: inline-block; width: 210px; font-weight: bold; text-align: left;">21281280</span></div>
<div><span style="display: inline-block; width: 65px; text-align: center;">姓名</span><span style="display: inline-block; width: 25px;">:</span><span style="display: inline-block; width: 210px; font-weight: bold; text-align: left;">柯劲帆</span></div>
<div><span style="display: inline-block; width: 65px; text-align: center;">班级</span><span style="display: inline-block; width: 25px;">:</span><span style="display: inline-block; width: 210px; font-weight: bold; text-align: left;">物联网2101班</span></div>
<div><span style="display: inline-block; width: 65px; text-align: center;">指导老师</span><span style="display: inline-block; width: 25px;">:</span><span style="display: inline-block; width: 210px; font-weight: bold; text-align: left;">赵帅锋</span></div>
<div><span style="display: inline-block; width: 65px; text-align: center;">日期</span><span style="display: inline-block; width: 25px;">:</span><span style="display: inline-block; width: 210px; font-weight: bold; text-align: left;">2024年6月11日</span></div>
</div>
---
[TOC]
# 1. 实验原理
在ISO/IEC **15693** 协议中:
- **VCD -> VICC**
- 编码:
**脉冲位置编码**
**256 取 1** 方案:表示一个字节的值。连续 256 个脉冲,每个脉冲宽 $18.88\mu s$,在表示的值处,将后一半脉冲(宽度$9.44\mu s$ 降为低电平。例如当传送 225 = 0b1110,0001 时:
<img src="images\256取1.jpg" alt="256取1" style="zoom:33%;" />
<div id='i1_1' align='center'>图 1-1</div>
SOF 使用一个编码违例表示:
<img src="images\256取1-SOF.png" alt="256取1-SOF" style="zoom: 50%;" />
<div id='i1_2' align='center'>图 1-2</div>
(如果传输的是字节数据,不可能在前一半脉冲出现低电平)
EOF 同样使用一个编码违例表示:
<img src="images\256或4取1-EOF.png" alt="256或4取1-EOF" style="zoom: 50%;" />
<div id='i1_3' align='center'>图 1-3</div>
**4 取 1** 方案:表示 2 bit 的值。使用 8 个 $18.88\mu s$ 宽度的脉冲,在表示的值处,将后一半脉冲(宽度 $9.44\mu s$ 降为低电平。
<img src="images\4取1.jpg" alt="4取1" style="zoom: 33%;" />
<div id='i1_4' align='center'>图 1-4</div>
SOF 使用一个编码违例表示:
<img src="images\4取1-SOF.png" alt="4取1-SOF" style="zoom: 50%;" />
<div id='i1_5' align='center'>图 1-5</div>
EOF 同样使用一个编码违例表示(和 256 取 1 一样):
<img src="images\256或4取1-EOF.png" alt="256或4取1-EOF" style="zoom: 50%;" />
<div id='i1_6' align='center'>图 1-6</div>
- 调制:采用副载波调制,调制方式为 **ASK**Amplitude Shift Keying幅移键控调制指数可选 10% 和 100%(载波信号的幅度变化)
<img src="images\ASK调制.jpg" alt="ASK调制" style="zoom: 33%;" />
<div id='i1_6' align='center'>图 1-6</div>
- **VICC -> VCD**
- 编码:**反相曼彻斯特编码**
- 调制:
使用 **1 种副载波**,副载波负载调制频率为 $f_c / 32$(一个逻辑宽度为 $18.88\mu s$),结合反相曼彻斯特编码:
<img src="images\反相曼彻斯特编码-1种副载波.jpg" alt="反相曼彻斯特编码-1种副载波" style="zoom: 25%;" />
<div id='i1_7' align='center'>图 1-7</div>
使用 **2 种副载波**,副载波负载调制频率分别为 $f_{s1} = f_c / 32$(一个逻辑宽度为 $18.88\mu s$$f_{s2} = f_c / 28$(一个逻辑宽度为 $18.58\mu s$),结合反相曼彻斯特编码:
<img src="images\反相曼彻斯特编码-2种副载波.jpg" alt="反相曼彻斯特编码-2种副载波" style="zoom:33%;" />
<div id='i1_8' align='center'>图 1-8</div>
以上数据是采用高速率传输时的。如果使用了低速率,脉冲数和时间都要 $\times 4$
表示 **SOF 和 EOF** 时使用编码违例表示:
在原本反相曼彻斯特编码 SOF 的前面加了一段高电平表示帧开始;在原本反相曼彻斯特编码 0 的后面加了一段高电平表示帧结束:
<img src="images\15693-SOF and EOF.png" alt="15693-SOF and EOF" style="zoom: 33%;" />
<div id='i1_9' align='center'>图 1-9</div>
其中 $56.64 \mu s = 1.5 \times 37.76 \mu s$。因为正常情况下,无论传输 1 或者 0 ,高/低电平的保持时间都不会超过 1 个 ETU 时间($37.76 \mu s$​),因此定义出现超过 1 个 ETU 的高/低电平的信号表示 SOF / EOF实际为1.5 个 ETU
使用副载波时,可以使用 1 或 2 种副载波,副载波频率与传输比特数据一致。
# 2. 实验过程
## 2.1. 载波
载波是恒定频率的正弦波,这与[图 1-6 ](#i1_6)相符。
<img src="images\载波1.jpg" alt="载波1" style="zoom:10%;" />
<img src="images\载波2.jpg" alt="载波2" style="zoom:10%;" />
## 2.2. ASK 调制
### 2.2.1. SOF - 4 取 1
<img src="images\SOF-4取1.jpg" alt="SOF-4取1" style="zoom:10%;" />
实验波形与[图 1-5 ](#i1_5)相符。
### 2.2.2. SOF - 256 取 1
<img src="images\SOF-256取1.jpg" alt="SOF-256取1" style="zoom:25%;" />
实验波形与[图 1-2 ](#i1_2)相符。
### 2.2.3. EOF
<img src="images\EOF.jpg" alt="EOF" style="zoom:25%;" />
实验波形与[图 1-3 ](#i1_3)和[图 1-6 ](#i1_6)相符。
### 2.2.4. 数据输出 - 4 取 1
<img src="images\数据输出4取1.jpg" alt="数据输出4取1" style="zoom:25%;" />
实验波形与[图 1-4 ](#i1_4)相符。
## 2.3. 副载波调制与解调
### 2.3.1. 双副载波
<img src="images\双副载波.jpg" alt="双副载波" style="zoom: 25%;" />
实验波形与[图 1-8 ](#i1_8)相符。
### 2.3.2. 单副载波
<img src="images\单副载波.jpg" alt="单副载波" style="zoom: 25%;" />
实验波形与[图 1-7 ](#i1_7)相符。
### 3. 总结与感悟
通过此次实验我深入理解了ISO/IEC 15693协议在RFID系统中的实际应用特别是 VCD 与 VICC 之间的通信机制。在实验过程中,我主要进行了以下几方面的学习和体会:
1. 脉冲位置编码与反相曼彻斯特编码
- **脉冲位置编码**通过实践256取1和4取1编码方式我理解了如何在脉冲序列中通过改变脉冲的位置和宽度来表示数据信息。特别是通过SOF和EOF的编码违例能够有效地标识帧的开始和结束确保接收端能正确同步和解析数据。
- **反相曼彻斯特编码**在VICC到VCD方向的通信中反相曼彻斯特编码提供了一种可靠的方式通过高低电平的变化来表示数据并结合副载波调制实现了稳定的数据传输。
2. 调制技术
- **ASK调制**通过实验我体会到ASK调制的实现原理和优势。10% ASK调制在确保通信稳定性的同时还能为无源标签提供持续的电源。这对于实现稳定的RFID通信至关重要。
- **副载波调制**:副载波调制尤其是在使用两种副载波频率的情况下,能够有效地提高数据传输的可靠性。通过对副载波频率$f_{s1}$和$f_{s2}$的实践,我理解了如何在不同频率下进行数据调制和解调。
3. 实验波形对比
通过对实验波形的观察和分析,我验证了实验结果与理论图示的一致性。这不仅加深了我对理论知识的理解,也提升了我在实际操作中的能力。
4. 综合应用
此次实验不仅让我掌握了ISO/IEC 15693协议的具体实现方式还让我体会到数字通信系统中编码与调制技术的重要性。在实际应用中这些技术能有效提高数据传输的效率和可靠性。
**感悟**
通过此次实验我不仅提升了对RFID原理与应用的理解也感受到数字通信系统的复杂性和精妙之处。实验中遇到的一些问题和挑战比如如何正确实现脉冲位置编码和反相曼彻斯特编码使我对细节的重要性有了更深的体会。同时这也激发了我进一步学习和研究的兴趣。未来我希望能将这些知识应用到更广泛的实际场景中为物联网和智能系统的发展贡献自己的力量。

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.