lookup command.

kinder

New Member
Hi there,

I was wondering if anyone knew of an issue with the BASIC 'lookup' command in the program compiler. I have been trying to simulate driving a Unipolar stepper motor using a PICAXE 08 and L293 chip. The program is listed below. The Picaxe 08 doesn't seem to be operating correctly - i.e the output are not being set after the lookup command selects them from the list of Hex numbers. The program simulates perfectly well using Picaxe programming editor, but seems to fall down using VSM.

Any help would be greatly appreciated.

thanks.

symbol singlestep = 4
symbol halfstep = 8
symbol delay = 1000

symbol stepcount = b0
symbol counter = b1

output 1
output 2
output 4

do
for counter = 1 to 20 'single step forward
for stepcount = 1 to singlestep
lookup stepcount, (0,$01,$02,$04,$10), pins
pause delay
next stepcount
next counter

pause 2000
.....
 
Last edited:

bgrabowski

Senior Member
Try using a different variable instead of 'pins' in the lookup line (say b9), then on the next line put 'let pins = b9'
 

kfahrner

New Member
Hi,
I am having the same issue, trying to control a 7 segment LED display using lookup. I am using code from David Lincoln's 'Experiments in Mechatronics' (2003), page 38. The critical line is:

lookup digitout, ($BE, $82, $DC, $D6, $E2, $76, $7E, $92, $FE, $F2), outbyte

Variables 'digitout' and 'outbyte' have both been defined with symbol statement. I have tried to replace them by direct references to b0 - b8 variables and everything else I could think of - to no effect. All other variables compute properly when stepping through. I have also checked that 'digitout' contains a valid numeric between 0 and 9 before stepping into lookup, but 'outbyte' remains 0.
 

animal2

New Member
Lookup does not work properly at the moment
i had same problem
Technical gave me this temporary solution


ORIGINAL CODE

'for counter=0 to 5
'lookup counter, ($33,$32,$28,$0C,$01,$06), outbyte
'gosub lcdout
'next counter

USE THIS FORMAT INSTEAD

outbyte = $33
gosub lcdout
outbyte = $32
gosub lcdout
outbyte = $28
gosub lcdout
outbyte = $0C
gosub lcdout
outbyte = $01
gosub lcdout
outbyte = $06
gosub lcdout
 

kfahrner

New Member
Thanks for the tip. In contrast to the step motor application, I need to look up only one of the byte codes at a time. This required a few additional conditional statements, but it all works now. I expect the lookup command will be fixed in due course with the first official release.
Kind regards Klaus
 
Top