using macros in the DEBUG window?
terahertz
Posts: 55
I've searched around a bit and I can't find any useful information on how to use macros, maybe someone can help? I'm not even sure I need macros for what I'm trying to do, but I'd still like to know how to use them.
I'm controlling a motor's speed using DEBUGIN from a keyboard. Currently·I have 1-4 = reverse speeds, 5=stop, and 6-9 = forward speeds, everything works well this way.
What I want it to do is for instance I would press·the 1 key·and the motor starts, the longer I hold down the 1 key, the faster the motor goes, when I let the 1 key go the motor ramps back down to stopped. I know there are many ways to control motor speed using pots and such but I need to do it via a keyboard.
The reason I think I need macros is because I've been trying some sample code and it works but I need to press ENTER over and over again while in the DEBUG window. Can macros in effect press the ENTER key over and over again for me at like 500mS intervals? Do I even need macros to do this?
·
I'm controlling a motor's speed using DEBUGIN from a keyboard. Currently·I have 1-4 = reverse speeds, 5=stop, and 6-9 = forward speeds, everything works well this way.
What I want it to do is for instance I would press·the 1 key·and the motor starts, the longer I hold down the 1 key, the faster the motor goes, when I let the 1 key go the motor ramps back down to stopped. I know there are many ways to control motor speed using pots and such but I need to do it via a keyboard.
The reason I think I need macros is because I've been trying some sample code and it works but I need to press ENTER over and over again while in the DEBUG window. Can macros in effect press the ENTER key over and over again for me at like 500mS intervals? Do I even need macros to do this?
·
Comments
I believe if you have to keep pressing ENTER, then there must be code that is waiting for it. If you simply use something like "DEBUGIN char" in a loop, ANY key pressed will resume the program.
As far as the decrementing when the key is released, you might want to look at using a "SERIN 16, baud, timeout, no_data, char" type statement instead of DEBUGIN - check it out in PBasic Help.
If, however, by pressing the enter key manually you almost able to do what you need, you should be able to create a program that allows you to do what you want. You would need to use something like Visual Basic, or a similar programming language/environment. Basically the program would need to create the serial connection, read the keyboard, and send the info over the connection.
Just a small correction. The PBASIC IDE DOES support a somewhat limited macro language, but it's not at execution time, it's at compile time. See any of the excellent compile time macros written by Jon Williams, by way of example. If you need a link, just ask.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
Hmmm, wait a minute maybe I won't need to·download VB, I have this software suite I got somewhere . It has these CD's: Visual C++.net disks 1 and 2, VisualStudio.net prerequisites,·MSDN library disks1 2 and 3, and windows 2000 SP4. Anything I can use there, or would I be better of with the free begginers version? the only reason I have this software is from something I needed C++ for.
Bruce would you mind shooting me that link? I assumed macros must have some functionality with the BS2 since I can access the utility from a debug window. If it's just for compilation scripts I don't think I will have any use for it but who knows,·I don't like to have buttons where I don't know what they do.
It sounds like the compile time macros are similar to C or ASM macros, as opposed to Word or Excel macros.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->