我的工作是机器人,它必须控制使用无线串行通信。机器人在微控制器上运行(通过燃烧一个.hex文件)。我想用我的Linux () PC来控制它。我是新来的串口编程。我能够发送数据,但我不能读取数据。
在微控制器上运行的几段代码:
函数发送数据:
void TxData(unsigned char tx_data)
{
SBUF = tx_data; // Transmit data that is passed to this function
while(TI == 0) // Wait while data is being transmitted
;
}
我使用的收银机是裸露的RedHat Linux机箱。这些寄存器有一个扫描器连接到一个串口(ttyS0)。
我们做了很多测试,要求有人站在注册和刷产品的扫描仪。我正在想办法把这个人从方程中移开。
是否有一种简单的方法来模拟来自串口的输入?
显然,向串口发送信息很容易:
echo [whatever] > /dev/ttyS0
但我真正喜欢的是某种bash代码,我可以在其中输入:
echo [barcode number] > (some code that makes the machine think the barcode number is coming from the se
我有一个ECR(电子收银机)设备,它有一个RS-232串口电缆连接到PC,但我没有给它的任何驱动程序。我正在尝试将设备连接到PC,但PC无法检测到电缆。如何检测此RS-232上连接的设备?我在Linux下工作。有什么关于如何找到这个设备的帮助吗?
下面是我在C中找到的基于波特率和COM端口号连接到设备的代码片段。
int OpenComport(int comport_number, int baudrate)
int SendByte(int comport_number, unsigned char byte)
int SendBuf(int comport_number, unsig