How do I control a hobby servo motor with SBasic?
The simplest way is to use the servos.bas library file included with the SBasic distribution package. This library contains working code for controlling up to four servo motors, and reduces the entire job to something like: gosub InstallServo, TOC5 This sets up the 68hc11 timer channel TOC5 to control a servo motor wired to PA3. The code in this library is a little complicated, but worth your time to examine closely. You will learn a lot about how the 68hc11 timer subsystems work. Be sure to have a copy of the Motorola 68hc11 Reference Manual (pink book) handy. To alter the servo’s position, your code must simply write a 16-bit value to register TOC5. The value written will generate a servo pulse at PA3 of a unique width. The servo will only respond to pulses with widths from about 0.5 to 1.5 msecs; these widths correspond to values from about $f400 to $fc00, though your mileage will vary. So your code can move a servo to a specified position by writing the appropriate value in the abo
The simplest way is to use the servos.bas library file included with the SBasic distribution package. This library contains working code for controlling up to four servo motors, and reduces the entire job to something like: gosub InstallServo, TOC5 This sets up the 68hc11 timer channel TOC5 to control a servo motor wired to PA3. The code in this library is a little complicated, but worth your time to examine closely. You will learn a lot about how the 68hc11 timer subsystems work. Be sure to have a copy of the Motorola 68hc11 Reference Manual (pink book) handy. To alter the servo’s position, your code must simply write a 16-bit value to register TOC5. The value written will generate a servo pulse at PA3 of a unique width. The servo will only respond to pulses with widths from about 0.5 to 1.5 msecs; these widths correspond to values from about $f400 to $fc00, though your mileage will vary. So your code can move a servo to a specified position by writing the appropriate value in the abo