Discussion forum for the BasicX family of microcontroller chips.
|
I am using the MotorMind C Got it to work the first time The Serial Send is &D0,&01,&04,Mot1HighByte,Mot1LowByte,Mot2HighByte,Mot2LowByte,CheckSum I have to send the motor PWM in High/Low byte Format (0-1024) I sould like to increment or decrement one variable per motor, and then break it up into High and low. Is there a way to assign a Variable to the High and Low bytes. Kind of like the BasicStamp has Motor Var Word MotHigh Var Motor.Highbyte MotLow Var Motor.LowByte So If I update Motor then MotLow and MotHigh follow suit. Make Sense? Thanks for any help, Eric |
|
|
|
From: "Eric" <> > [...] > Is there a way to assign a Variable to the High and > Low bytes. Kind of like the BasicStamp has > > Motor Var Word > MotHigh Var Motor.Highbyte > MotLow Var Motor.LowByte > > So If I update Motor then MotLow and MotHigh follow suit. > [...] Reminds me of the bad old days of Fortran's equivalence statements. BasicX doesn't have anything equivalent, but you can directly copy memory from one block to another, which allows you to interpret a given bit pattern as a different type. This allows you to sidestep BasicX's strong typing. Example: Dim Motor As Integer Dim Split(1 To 2) As Byte Motor = &H1234 Call BlockMove(2, MemAddressU(Motor), MemAddressU(Split)) ' High byte, Split(2) = &H12 ' Low byte, Split(1) = &H34 -- Frank Manning -- NetMedia, Inc. |