A comand similar to lookup
I was woundering if there was a comand similar to LOOKUP. But instead of taking a value out of the list and storing it in a variable.
I would like to take a value and store it in a variable within the list.
I would like to take a value and store it in a variable within the list.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
I mean. in this example
for counter = 0 to 6
lookup counter,[noparse][[/noparse]var0,var1,var2,var3,var4,var5,var6], var7
next
Instead of taking the value out of the list and storing it in var7. I would like to take the value of var7 and store it into one of the variables in the list. based on the variable counter.
What this will be used for is. I'm tring to manualy do a SHIFTIN. because i need to shift in data on the rising edge a clock and shift out data on the falling edge of a clock. this has to happen at the same time. so i cannot just do a SHIFTOUT camand followed by a SHIFTIN camand.
I hope this helps you under stand what im trying to do.
mike
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
there needs to be two clock pulses befor data is sent. For a total of 10 clock cycles.
focus.ti.com/lit/ds/symlink/tlc541.pdf
mike
Set the Pin definitions to the pins you are actually using.
This routine starts off with the channel to be read for next transmission in the upper 4 bits of the data, as this is shifted out of the top of the byte, the data for the previously selected channel is shifted in. This is the bit bang approach to doing simultaneous bidirectional communications. At the end you would have the data of the previously selected channel in data, and obviously you would run this once with the selected channel and ignore the data shifted in, the next time you run the loop you would aquire the data for the previously recorded channel. You will likely want to put·everything between LOW CS and HIGH CS·into a subroutine, setting Channel and Data = Channel << 4 before calling it. Upon return Data will contain the value.
I don't ordinarily program Basic stamps so the code may contain some errors, though I did my best to prevent that from happening considering I don't have my stamp on hand to check it out, also some of the operations may have a faster method of doing the same thing (like Data = Data + 1 is the same as Data = Data | 1, and may or may not execute faster).
<edit> Clarification: Data = Data + 1 is the same as Data = Data | 1 only when Data is an even number (bit 0 is low (0)) which is true for this case. </edit>
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Post Edited (Paul Baker) : 3/11/2006 5:55:40 AM GMT