1 changed files with 0 additions and 90 deletions
@ -1,90 +0,0 @@ |
|||
------------------------------------------------------- |
|||
-- 设置CV的值 |
|||
------------------------------------------------------- |
|||
local CV_Index = 0 |
|||
local CV_value = -2 |
|||
|
|||
|
|||
local str |
|||
local can_id = 0x120 |
|||
local byte0 = 0x00 |
|||
local byte1 = 0x00 |
|||
local byte2 = 0x00 |
|||
local byte3 = 0x00 |
|||
local byte4 = 0x00 |
|||
local byte5 = 0x00 |
|||
local byte6 = 0x00 |
|||
local byte7 = 0x00 |
|||
|
|||
print("设置CV的值") |
|||
can_bus("open", 0, 8, 500000, 500000) |
|||
|
|||
byte0 = ((CV_Index >> 0) & 0xFF) |
|||
byte1 = ((CV_Index >> 8) & 0xFF) |
|||
|
|||
byte2 = ((CV_value >> 0) & 0xFF) |
|||
byte3 = ((CV_value >> 8) & 0xFF) |
|||
byte4 = ((CV_value >> 16) & 0xFF) |
|||
byte5 = ((CV_value >> 24) & 0xFF) |
|||
|
|||
str= string.format("%c%c%c%c%c%c%c%c", byte0, byte1, byte2, byte3, byte4, byte5, byte6, byte7) |
|||
|
|||
can_bus("send", 0, 0, can_id, str) |
|||
------------------------------------------------------- |
|||
-- 读取CV的值 |
|||
------------------------------------------------------- |
|||
local CV_Index = 0 |
|||
|
|||
local str |
|||
local can_id = 0x121 |
|||
local byte0 = 0x00 |
|||
local byte1 = 0x00 |
|||
local byte2 = 0x00 |
|||
local byte3 = 0x00 |
|||
local byte4 = 0x00 |
|||
local byte5 = 0x00 |
|||
local byte6 = 0x00 |
|||
local byte7 = 0x00 |
|||
|
|||
print("读取CV的值") |
|||
can_bus("open", 0, 8, 500000, 500000) |
|||
|
|||
byte0 = ((CV_Index >> 0) & 0xFF) |
|||
byte1 = ((CV_Index >> 8) & 0xFF) |
|||
|
|||
str= string.format("%c%c%c%c%c%c%c%c", byte0, byte1, byte2, byte3, byte4, byte5, byte6, byte7) |
|||
|
|||
can_bus("send", 0, 0, can_id, str) |
|||
|
|||
------------------------------------------------------- |
|||
-- 读取GV |
|||
------------------------------------------------------- |
|||
local GV_Index = 0 |
|||
local GV_Length = 1 |
|||
local GV_config = 1 |
|||
|
|||
local str |
|||
local can_id = 0x130 |
|||
local byte0 = 0x00 |
|||
local byte1 = 0x00 |
|||
local byte2 = 0x00 |
|||
local byte3 = 0x00 |
|||
local byte4 = 0x00 |
|||
local byte5 = 0x00 |
|||
local byte6 = 0x00 |
|||
local byte7 = 0x00 |
|||
|
|||
print("读取GV的值") |
|||
can_bus("open", 0, 8, 500000, 500000) |
|||
|
|||
byte0 = ((GV_Index >> 0) & 0xFF) |
|||
byte1 = ((GV_Index >> 8) & 0xFF) |
|||
|
|||
byte2 = ((GV_Length >> 0) & 0xFF) |
|||
byte3 = ((GV_Length >> 8) & 0xFF) |
|||
|
|||
byte4 = ((GV_config >> 0) & 0xFF) |
|||
|
|||
str= string.format("%c%c%c%c%c%c%c%c", byte0, byte1, byte2, byte3, byte4, byte5, byte6, byte7) |
|||
|
|||
can_bus("send", 0, 0, can_id, str) |
|||
Loading…
Reference in new issue