private byte[] writeBuf={ (byte)0x03,(byte)0x03,(byte)0x00,(byte)0x05,(byte)0x00,(byte)0x02,(byte) 0xd5,(byte) 0xe8 };
// private byte writeBuf[]={ 0x00,0x00,0x00,0x00,0x00,0x00, 0x00, 0x00 };
// private byte[] writeBuf={ (byte)'a',(byte)'b',(byte)'c',(byte)'d',(byte)'e',(byte)'f',(byte)'g',(byte)'h' };
@Override
public void run() {
// TODO Auto-generated method stub
file = HardwareControler.openSerialPort("/dev/s3c2410_serial3", 9600, 8, 1);
while(MainActivity.isRun()){
HardwareControler.write(file ,writeBuf);
if(HardwareControler.select(file, 0, 0)==1){
int len = HardwareControler.read(file, readBuf, readBuf.length);
if(len>0)
for(int i=0;i<len;i++){
System.out.println(readBuf
); StatusThread.status += String.format("%d", readBuf); readBuf=0; } try { sleep(5000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } super.run(); }发送数据不一致,发的是:0x03,0x03,0x00,0x05,0x00,0x02, 0xd5, 0xe8
收到的是: a0 2 5 0 2 d5 e8
发送 :a b c d e f g h
收到 :58 AC 2C 56 96 D6 16 FB
我用的tiny210的板子 走的是485接口 和pc通信拿的232转485转USB接口(其他仪器测试转接口没问题)
请问如何解决,iTest出来的数据和我的是一样的 也是错的!
接收部分,老是接收到0 接收多次后出现JNI提示,见附件。
求工程师解答呀!急
[ 此帖被mindee在2012-11-21 11:52重新编辑 ]