我试图通过将列表传递给函数来打印列表:
set GPO_regs "0x70034 0x70038 0x7003C 0x70040 0x70044"
proc write_register {$regs $value} {
puts [format "Value to be written at %s register is %s" $regs $value]
}
foreach regs $GPO_regs {write_register $regs 0x0000}
但是我收到了一个错误:
can't read "regs": no such variable
答案 0 :(得分:1)
得到答案,'$'应该从参数中删除:
proc write_register {regs value} {