Recent content by edmunds

  1. E

    Pushbutton ON/OFF

    Dear all, Thank you all for your inputs. I worked for some time more on it last night after posting and I have something like this that works: #macro EnterSleepMode() low D.7 'STSPIN220 EN low to save power and reduce heat low A.5...
  2. E

    Pushbutton ON/OFF

    Dear all, How would you go about implementing a single pushbutton ON/OFF control for a device? The program flow could be something like this: 1) Battery connected; 2) Sleep; 3) If button pressed, run init: procedure and do main: continuously; 4) If button pressed for like three seconds, run...
  3. E

    Limiting signed numbers to some value

    True, thanks for the reminder. Had slipped out of my head totally. Edmunds
  4. E

    Limiting signed numbers to some value

    Dear all, I have been fiddling with this for a few evenings, but had nothing to report. Tonight, I did a fresh attempt and got everything to work as expected. The problem so far [also with my own initial attempt] was I was trying to re-use variables. There were places where this was OK and...
  5. E

    Limiting signed numbers to some value

    Dear @Aries , Not there yet either :). I have successfully ported your code on top of mine, figured out how it works and while it tracks current_pos, which could be used to know that no more Movement commands should be accepted, the MAX operators only deal with immediate inputs, not the...
  6. E

    Limiting signed numbers to some value

    Dear @hippy, I got your code working on top of mine (i.e. in the vehicle) and what it seems to be doing is limiting the steering response per loop to what the limit is. Not quite there yet, but closing in :). Thank you for your input, Edmunds
  7. E

    Limiting signed numbers to some value

    I added a few numbers to @hippy's input data and made a table of what the position and outputs need to be with limits set at -200 and +200 Input Position Output 0 0 0 'all zero for start -350 -200 -200...
  8. E

    Limiting signed numbers to some value

    Looks promising :). Have not tried it yet, will try to do this tonight, too. Thank you for your time, Edmunds
  9. E

    Limiting signed numbers to some value

    That is a good summary, I think with exception of this Above is done by P(I)D algorithm and while it might not look like much, is reasonably tuned for the chassis I'm working with through many painful iterations. I would like to avoid touching it, so I want to stick addition and limiting on...
  10. E

    Limiting signed numbers to some value

    I replaced all the macroses with code for now, so now the main loop is pretty understandable and should compile with MagLine function removed. Symbol No_magnet = bit30 'No magnet [1], magnet present [0] Symbol counter0 = w17 'b34:b33; Just a counter Symbol ELine = w15...
  11. E

    Limiting signed numbers to some value

    The inputs are decent controlled values, coming out of a PID algorithm, overflow risks are being controlled. 0 is $0000, sorry, my bad. Over $8000 are negative and counting backwards exactly as you say. Thank you for your input, Edmunds
  12. E

    Limiting signed numbers to some value

    Dear @hippy, Thank you once again for showing the way with how to feed some string of values to the function for testing. I'm now playing with the code and I can see this will not give up so easily. What you are doing now, is, you are capping the value of steer to not go over the limit on a per...
  13. E

    Limiting signed numbers to some value

    Great :). Thank you, @hippy. Edmunds
  14. E

    Limiting signed numbers to some value

    Dear all, I have a problem I have attempted to address a few times now with limited success. I think I even tried to ask this forum once or at least seriously considered it before :) - I will try to be more clear about what I'm trying to do this time. There is a signed word variable...
Top