Shop OBEX P1 Docs P2 Docs Learn Events
Useing lookup lookdown commands — Parallax Forums

Useing lookup lookdown commands

ArchiverArchiver Posts: 46,084
edited 2003-10-03 22:19 in General Discussion
ok so far in my quest to make things work in this trubled world, im
still confused on how to use those darn commands correctly
(lookup/down commands) so far this is what i got complied for my
program

TB_POS VAR byte

Again:

PULSIN 8, 1, TB_POS ' Measure thottole postion frm 555 timer.
DEBUG DEC ? TB_POS ' this is so i can see if the darn thing works

GOTO Again


when i hooked up my 555 timmer to this program with my thottle body
sensor, i get values starting at 5 (idle) all the way to 18 (full
open) useing only 13 steps or so...

this is the question ... how would i use a table of data so when the
stamp runs the program and see that the "TB_POS" variable is 5 , to
look up a table , get a predetermend out value for the injector
duration, then spit that data out to a pin thats hooked up to the
injector....

the way i want this to work is, when say pin 1 gose high (theres a
pick up on the engines crank shaft that tells stamp every time to
start the program) to start running the program, right off the start
it will see the thottle postion, do the look up command to get the
correct value for the injector pulse based off the value of the
TB_POS , then use pulse out command (not to sure if that be correct
command to use) to inject the gass into the engine... once thats dose
the stamp will wait agian for next trigger of the engines crank and
do it all over agian...

i beg anyone please help! [noparse]:)[/noparse]
i got pictures at http://photos.yahoo.com/djrevolution99

let me know what u guys think!! i want to already ride this turbo
sucker!


Sean...

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-10-03 22:19
    >i get values starting at 5 (idle) all the way to 18 (full
    >open) useing only 13 steps or so...
    >this is the question ... how would i use a table of data so when the
    >stamp runs the program and see that the "TB_POS" variable is 5 , to
    >look up a table , get a predetermend out value for the injector
    >duration, then spit that data out to a pin thats hooked up to the
    >injector....

    x var word
    lookup tb_pos min 5 max 18 - 5,[noparse][[/noparse]x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11], x
    pulsout i_pin,x


    The expression (tb_pos min 5 max 18 - 5) assures that the value will
    be a minimum of 5 and maximum of 18, and then subtracts 5 to get a
    value between 0 and 11. That is the index to look up in the table,
    the value that ends up in variable x. The values x0,..,x11 can be
    entered as constants:
    x0 CON 3152
    x1 CAN 3798
    etc.
    or you can enter the constants right into the lookup command.

    -- Tracy
Sign In or Register to comment.