|
Smalltalk
Community
Versions
All Versions
Smalltalk Standard Extending Smalltalk Squeak Smalltalk GNU Smalltalk Little Smalltalk Java Smalltalk PDST MicroSeeker PIC/Smalltalk Sharp #Smalltalk Pocket Smalltalk Talks2 Smalltalk F-Script Squat Smalltalk Smalltalk/X StrongTalk Ambrai Smalltalk VisualWorks ObjectStudio VisualAge Smalltalk Dolphin Smalltalk Smalltalk MT S# Smallscript Smalltalk/JVM OOVM Embedded Gemstone/S LSW Vision-Smalltalk Slate Smalltalk Zoku Smalltalk VSE Smalltalk Smalltalk Express Smalltalk/V286 Smalltalk/VMac Smalltalk/V Smalltalk-80 |
MicroSeeker PIC/Smalltalk by Hylands Underwater Vehicles
PIC/Smalltalk allows one to write code for the PIC microcontroller in Smalltalk
(or at least something that looks like Smalltalk), and then translate it to assembler.
This is an embedded version of Smalltalk that allows you to create Smalltalk based software for devices with tiny computing resources. The development environment is the Squeak Smalltalk! Essentially MicroSeeker PIC/Smalltalk is a cross platform development environment for embedded applications. The clairity of the system is remarkable for what it accomplishes. Leaveraging a full Smalltalk as it's development environment is a move that enabled fast development without the need to build an entire Smalltalk, yet there are a number of nice extensions to Squeak that support and ease the cross platform aspects.
Why bother? Well, the real project I'm working on is to build a fairly complex autonomous underwater vehicle (AUV),
called Micro Seeker. This sub will use PIC microcontrollers for brains, and the language used to program a PIC is
pretty annoying to use, given that I've been using Smalltalk for over twelve years now. I've kind of gotten used to Smalltalk...
So, I decided to see if I could do something similar to what Squeak does for its VM, and write code in a Smalltalk-like syntax that is translated into assembler source code, and then assembled and run on the end platform. Resources MicroSeeker PIC/Smalltalk home MicroSeeker Pool Test 20040901
MicroSeeker PIC/Smalltalk Example
First, here's the Smalltalk code, the method processServo in class PICServoInterface: processServos "Process the servo. Basically, servos work using pulse-width modulation, where the frequency is about 50 Hz, and the duty cycle determines the servo position. The duty cycle should be between approximately 1000 and 2000 micro-seconds, although different servos may require different duty cylces. These ones in particular have a duty cycle between about 690 and 1690 us." "Turn on the port to start with, and wait the initial 1 ms." ServoPort setBit: Servo1Pin. self servoDelay: 195. "Now count down, doing a comparison on each interation. When the count is equal to the servo's position, turn off the port." servoCounter := 250. [ self clearWatchdogTimer. servoCounter = servoOnePosition ifTrue: [ ServoPort clearBit: Servo1Pin ] ] repeatWhile: [ servoCounter decrementSkipIfZero ]. ServoPort clearBit: Servo1Pin And now, the PIC assembler produced: ; ========================================== ; = processServos ; ========================================== processServos equ * bsf ServoPort, Servo1Pin ; Generating call to 'servoDelay:' movlw 195 ; Pushing WReg (next two instructions)... decf indirectAddressLatch movwf indirect call servoDelay ; Popping (and ignoring) 1 variable from the stack... incf indirectAddressLatch movlw 250 movwf servoCounter Label_00 equ * clrwdt movfw servoOnePosition, w xorwf servoCounter, w btfsc status, Zero bcf ServoPort, Servo1Pin decfsz servoCounter goto Label_00 bcf ServoPort, Servo1Pin return Copyright 1999-2009 by Smalltalk.org, All Rights Reserved. |
March 15 2010 Costa Rica El Salvador Guatemala Honduras Panama Central America
lingoize.me
naturally with ease aiming for fluid fluency. |