主题中讨论的其他器件:SN74LV8154、
大家好!
我使用 SN74HC165移位寄存器 IC 从二进制计数器 IC (SN74LV8154)读取并行输出数据。 如何从该 IC 读取串行数据输出? 是通过 RX 引脚实现的吗?
谢谢、此致<
Apurv
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
大家好!
我使用 SN74HC165移位寄存器 IC 从二进制计数器 IC (SN74LV8154)读取并行输出数据。 如何从该 IC 读取串行数据输出? 是通过 RX 引脚实现的吗?
谢谢、此致<
Apurv
您好!
我已经为 SN74LV8154二进制计数器 IC 编写了此代码、但它不会连续计数、它会复位为7、有时仅复位为较低的值。
//包含文件
#include "hL_sys_common.h"
#include "HL_Gio.h"
#include "hL_sci.h"
#include "hL_het.h"
#include
#define GAL 2.
#define Gau 18.
#define GBL 16.
#define GBU 30
#define RCLK 14.
#define CCLR 12.
#define CLK 22.
字符计数[20];
void main()
{
unsigned long freq = 0;
uint8 b0、b1、b2、b3、b4、b5、b6、b7、b8、b9、b10、b11、b12、b13、b14、b15、b16、b17、b18、b19、b20、b21、b22、b23、b24、b25、b26、b27、b29、b29、b29、b29、b30;
//初始化 GIO 驱动程序
gioInit();
//初始化 SCI 驱动程序
sciInit();
//初始化 HET 驱动程序
hetInit();
//将 HET1驱动器引脚设置为输出
gioSetDirection (hetPORT1、0xFFFFFFFF);
//将 GIOA 和 GIOB 驱动器引脚设置为输入
gioSetDirection (gioPORTA、0x00000000);
gioSetDirection (gioPORTB、0x00000000);
//初始化寄存器
gioSetBit (hetPORT1、GAL、1);
gioSetBit (hetPORT1、CCLR、0);
gioSetBit (hetPORT1、Gau、1);
gioSetBit (hetPORT1、GBL、1);
gioSetBit (hetPORT1、GBU、1);
gioSetBit (hetPORT1、RCLK、0);
gioSetBit (hetPORT1、CCLR、1);
gioSetBit (hetPORT1、CLK、0);
while (1)
{
频率= 0;
//设置时钟脉冲
gioSetBit (hetPORT1、CLK、1);
gioSetBit (hetPORT1、CLK、0);
//设置 RCLK 脉冲
gioSetBit (hetPORT1、RCLK、1);
gioSetBit (hetPORT1、RCLK、0);
//读取 GBU 字节
gioSetBit (hetPORT1、GBU、0);
//读取位
B31 = gioGetBit (gioPORTB、3);
FREQ = FREQ|B31;
频率<=1;
B30 = gioGetBit (gioPORTB、2);
FREQ = FREQ|B30;
频率<=1;
B29 = gioGetBit (gioPORTA、7);
FREQ = FREQ|B29;
频率<=1;
B28 = gioGetBit (gioPORTA、6);
FREQ = FREQ|B28;
频率<=1;
B27 = gioGetBit (gioPORTA、5);
FREQ = FREQ|B27;
频率<=1;
B26 = gioGetBit (gioPORTA、2);
FREQ = FREQ|B26;
频率<=1;
B25 = gioGetBit (gioPORTA、1);
FREQ = FREQ|B25;
频率<=1;
B24 = gioGetBit (gioPORTA、0);
FREQ = FREQ|B24;
频率<=1;
//再次将 GBU 设置为高电平
gioSetBit (hetPORT1、GBU、1);
//读取 GBL 字节
gioSetBit (hetPORT1、GBL、0);
//读取位
B23 = gioGetBit (gioPORTB、3);
FREQ = FREQ|B23;
频率<=1;
B22 = gioGetBit (gioPORTB、2);
FREQ = FREQ|B22;
频率<=1;
B21 = gioGetBit (gioPORTA、7);
FREQ = FREQ|B21;
频率<=1;
B20 = gioGetBit (gioPORTA、6);
FREQ = FREQ|B20;
频率<=1;
B19 = gioGetBit (gioPORTA、5);
FREQ = FREQ|B19;
频率<=1;
B18 = gioGetBit (gioPORTA、2);
FREQ = FREQ|B18;
频率<=1;
B17 = gioGetBit (gioPORTA、1);
FREQ = FREQ|B17;
频率<=1;
B16 = gioGetBit (gioPORTA、0);
FREQ = FREQ|B16;
频率<=1;
//再次将 GBL 设置为高电平
gioSetBit (hetPORT1、GBL、1);
//读取 Gau 字节
gioSetBit (hetPORT1、Gau、0);
//读取位
B15 = gioGetBit (gioPORTB、3);
FREQ = FREQ|B15;
频率<=1;
b14 = gioGetBit (gioPORTB、2);
FREQ = FREQ|B14;
频率<=1;
B13 = gioGetBit (gioPORTA、7);
FREQ = FREQ|B13;
频率<=1;
B12 = gioGetBit (gioPORTA、6);
FREQ = FREQ|B12;
频率<=1;
B11 = gioGetBit (gioPORTA、5);
FREQ = FREQ|B11;
频率<=1;
B10 = gioGetBit (gioPORTA、2);
FREQ = FREQ|B10;
频率<=1;
B9 = gioGetBit (gioPORTA、1);
FREQ = freq|b9;
频率<=1;
B8 = gioGetBit (gioPORTA、0);
FREQ = FREQ|B8;
频率<=1;
//再次将 Gau 设置为高电平
gioSetBit (hetPORT1、Gau、1);
//读取 GAL 字节
gioSetBit (hetPORT1、GAL、0);
//读取位
b7 = gioGetBit (gioPORTB、3);
FREQ = FREQ|B7;
频率<=1;
B6 = gioGetBit (gioPORTB、2);
FREQ = FREQ|B6;
频率<=1;
B5 = gioGetBit (gioPORTA、7);
频率= freq|B5;
频率<=1;
B4 = gioGetBit (gioPORTA、6);
FREQ = freq|b4;
频率<=1;
B3 = gioGetBit (gioPORTA、5);
FREQ = FREQ|B3;
频率<=1;
B2 = gioGetBit (gioPORTA、2);
FREQ = FREQ|B2;
频率<=1;
B1 = gioGetBit (gioPORTA、1);
频率= freq|b1;
频率<=1;
B0 = gioGetBit (gioPORTA、0);
FREQ = freq|b0;
//再次将 GAL 设置为高电平
gioSetBit (hetPORT1、GAL、1);
printf ("%d\r\n"、freq);
}
}
我哪里出错了?
此致、
Apurv