loop index problem
slcott
Posts: 27
I'm trying to build a little handshaking protocol and am running into a problem with my loop.
The programming is a little different than the way I would program in C.
I get the error: "EXPECTED A VALUE BETWEEN 0 AND 7 "idx"
should i just make an array?
is there a convenient way to copy a byte into an array then?
any suggestions would really be appreciated.
The programming is a little different than the way I would program in C.
tmp1 VAR BYTE ... ... ... FUNC SHIFTOUT_VAL 'tmp0 = __PARAMCNT tmp1 = __PARAM1 'tmp2 = __PARAM2 'tmp3 = __PARAM3 'tmp4 = __PARAM4 FOR idx = 7 TO 0 STEP -1 IF SCLK = 1 THEN IF tmp1.idx <> 0 THEN HIGH MISO ELSE LOW MISO ENDIF ELSE pause 1 ENDIF NEXT ENDFUNC
I get the error: "EXPECTED A VALUE BETWEEN 0 AND 7 "idx"
should i just make an array?
is there a convenient way to copy a byte into an array then?
any suggestions would really be appreciated.
Comments
Note that if you're trying to synchronize with an external clock (coming in on SCLK) you cannot insert arbitrary delays as you have. The above code waits for a rising edge of the SCLK line before outputting the LSB of the value to sent over in __param1.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hodge
webbolts.com
forumexperts.com