I to II conversion
CharlieC
Posts: 14
Ok, now I feel dumb.· I am trying to learn to control a stepper with the BS2.· I figured I'd try and convert the example in the Basic Stamp App notes to BS2.· For a guy like me that's been developing software for mor than 20 years, should be a piece of cake, right?
Well I understand the #=INC AND %=BIN? part ok, I think but when I try to convert ...
dirs = %01000011··· into······ dirs = BIN? 01000011, I get a "Constant exceeds 16 bits",
I don't get it.· Last time I checked 01000011 did not exceed 16 bits.
But then, my gray matter is getting a bit arthritic.· Just in case one of you guys what to help out a very old (and not so bright anymore) fart, I have attached the code I am trying to convert.· If not, I don't blame you.· This should not stop me.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Charlie Chisholm
That part, at least,·I'm sure of.
Well I understand the #=INC AND %=BIN? part ok, I think but when I try to convert ...
dirs = %01000011··· into······ dirs = BIN? 01000011, I get a "Constant exceeds 16 bits",
I don't get it.· Last time I checked 01000011 did not exceed 16 bits.
But then, my gray matter is getting a bit arthritic.· Just in case one of you guys what to help out a very old (and not so bright anymore) fart, I have attached the code I am trying to convert.· If not, I don't blame you.· This should not stop me.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Charlie Chisholm
That part, at least,·I'm sure of.
Comments
2. There is no "T2400" constant in BS2 -- you'll need to define it yourself
3. Each "Symbol" line: "Symbol xxx = YYY" must be converted to : "xxx VAR YYY"
4. DIRS is now a 16-bit variable (because the BS2 has 16 I/O pins). PINS similarly.
5. You no longer prefix variables with # or %.
SERIN 7,N2400,Dir_cmd,#Steps,#Delay ' Get orders from terminal.
becomes:
I2400 CON 16384 ' or whatever the 2400 baud number is for the BS2. Look it up under SERIN in the manual
SERIN 7, I2400, [noparse][[/noparse]Dir_cmd, Steps.HighByte, Steps.LowByte, Delay]
Update:
· Direction VAR BYTE· ' This makes an 8-bit variable in BS2
· Steps VAR WORD· ' This makes a 16-bit memory variable
·· Your code example posted uses the extension for older BS1 code.· Could you please confirm that this is for a standard BS2?· You should use the proper extensions when saving the file, as well as adding the proper Stamp directive.· That is in addition to what Allan pointed out.· Are you using the most current Stamp software?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Post Edited (Chris Savage (Parallax)) : 3/11/2005 6:11:30 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Charlie Chisholm
That part, at least,·I'm sure of.
·· I thought the attached code was the code you were trying to run.· Good luck, and if you get stuck again, please post the converted code for comparison.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com