单片机的 FIFO循环队列实现

本文介绍了队列的FIFO特性,并详细阐述了如何使用链表和顺序存储结构实现链队列。重点讨论了循环队列的概念,包括其结构、头尾指针的关系以及满队列和空队列的判断,同时指出在C语言中实现循环队列的注意事项。
摘要由CSDN通过智能技术生成

 

//
// 文件:config.h
//
#ifndef __CONFIG_H 
#define __CONFIG_H
//这一段无需改动
//This segment should not be modified
#ifndef TRUE
#define TRUE  1
#endif
#ifndef FALSE
#define FALSE 0
#endif
typedef unsigned char  uint8;
typedef signed   char  int8;
typedef unsigned short uint16;
typedef signed   short int16;
typedef unsigned int   uint32;
typedef signed   int   int32;
typedef float          fp32;

#include "FIFOQUEUE.h"
#endif
//
// 文件:FIFOQUEUE.h
//
#ifndef _FIFOQUEUE_H
#define _FIFOQUEUE_H
#define ElemType       uint8
#define QueueSize      20 //fifo队列的大小
#define QueueFull      0  //fifo满置0
#define QueueEmpty     1  //FIFO空置1
#define QueueOperateOk 2  //队列操作完成 赋值为2
struct FifoQueue
{
    uint16 front;     //队列头
    uint16 rear;        //队列尾
    uint16 count;       //队列计数
    ElemType dat[QueueSize];
};
//Queue Initalize
extern void QueueInit(struct FifoQueue *Qu
  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值