主题中讨论的其他器件:RF430FRL152H、 TRF7970A
工具与软件:
我已经生成了一个 MATLAB 代码来获取存储在 RF430rfl152hevm 中的 Block9中的数据、但它不起作用。 可以帮助我更正该代码吗?
clear all; clc; % set serialport comPort = 'COM3'; baudRate = 115200; s = serialport(comPort, baudRate); % set port parameters set(s, 'Timeout', 3); configureTerminator(s, "LF"); %Communication begin fopen(s); % record file for debugging %s.RecordName = 'myRecord.txt'; %record(s); %%set up MCU % start MCU %010A0003041001210000 startMCU=uint8([0x01, 0x0A, 0x00, 0x03, 0x04, 0x10, 0x01, 0x21, 0x00, 0x00]); write(s, startMCU,"uint8"); % set datarate %010C00030410002101020000 datarate=uint8([0x01, 0x0c, 0x00, 0x03, 0x04, 0x10, 0x00, 0x21, 0x01, 0x02, 0x00, 0x00]); write(s, datarate,"uint8"); %set agc toggle % 0109000304F0000000 agcTtoggle=uint8([0x01, 0x09, 0x00, 0x03, 0x04, 0xF0, 0x00, 0x00, 0x00]); write(s, agcTtoggle,"uint8"); %set amp toggle % 0109000304F1FF0000 ampmToggle=uint8([0x01, 0x09, 0x00, 0x03, 0x04, 0xF1, 0xFF, 0x00, 0x00]); write(s, ampmToggle,"uint8"); pause(0.5); % set up command %010B000304180220090000 readingBlock=uint8([0x01, 0x0B, 0x00, 0x03, 0x04, 0x18, 0x02, 0x20, 0x09, 0x00, 0x00]); write(s,readingBlock,"uint8"); % delay to sample %pause(0.5); response = fgetl(s); % 显示响应数据 disp('从TRF7970A读取的数据:'); disp(response); % 完成后关闭串行端口 % 关闭串口 clear s;