I think this article has a lot of good stuff.
If not used as described it does give a lot of great odds and ends information.
...Chrissi
I was extremely disappointed. With a little extra effort he could have
shown how to interface the sensors with a single chip microcomputer
and written and published a bit of source code. Nuts & Volts magazine
does that every month.
Apparently Jim Weir is stuck in an analog age.
Paul Lamar
Still, you have to walk before you can run.
Nuts N Volts appeals to a geek and techie readership who are willing and capable of dealing with microprocessors and code.
I guarantee a similar article would never get published in Kitplanes because the material is over the heads and intimidating to the readers, most would just turn the page.
What Jim offers is within the grasp of those who follow his hand holding column.
I am sure there are those that subscribe to this list in the same situation. Build Jim's circuit and you will have a greater chance of success. Those that get that far and have a hunger for more tech can then take a known working system and replace the brain with a microprocessor, multiplexed inputs and an LCD display.
...Chrissi
It might be intimating at first but when you get down on that level
and the light lights in your brain it is probably the most simple
thing I can think of. Programing in assemble language a single chipper
is a piece of cake. It is like having bunch of different things and you
are moving them around from box to box. Put something in the out box
and out it goes. Each box has an address. All memory
locations and CPU registers are boxes with an address. It is no more
complicated than that. Any post office worker could learn to program in
single chipper assemble language in a flash. It is very mechanical.
Furthermore assembly language pneumonic are much much easier to remember
than stupid terse C. This is what is used in C for commands ! @ # @$ % < >' :.
By comparison assembly language pneumonics are self documenting such as
MOV or LDA for move or load. Besides, all this can be done in PIC BASIC.
Commands in BASIC are even more simple. IN, OUT, PRINT etc..
A couple of paragraphs explaining this or a complete article should be
all that is necessary to get started.
When I first started programming I used only about ten commands for
the longest time.
Paul Lamar
P.S. This is a simple assemble language simulator and trainer that should run
in a DOS Window. If somebody wants the compiled version let me
know. It would be simple to convert this to a PIC version.
The AirCraft Rotary Engine NewsLetter. Powered by Linux.
ACRE NL web site.
http://home.earthlink.net/~rotaryeng/ http://www.linux.org
CLS
PRINT
PRINT "Microprocessor simulator by Paul Lamar Copyright 1989"
PRINT
PRINT "This simulated microprocessor has only 6 nemonic instructions'"
PRINT "LDA Load the Accumulator, STA Store the contents of the accumulator,"
PRINT "JMP Jump to an absolute memory location, SED Set the decimal mode,"
PRINT "STX Store the X register, STY Store the Y register."
PRINT
PRINT "It also has only 2 addressing modes. The immediate addressing mode"
PRINT "is indicated by a # character in the fifth column of the nemonic field."
PRINT "Example; LDA #00"
PRINT
PRINT "The absolute address mode is indicated by a four digit hex address"
PRINT "Starting in the fifth column of the nemonic field."
PRINT "Example; LDA 0816"
PRINT
PRINT "There are only 23 memory locations in this simulated computer."
PRINT "They range from 0800 to 0816 in the hexidecimal numbering system."
PRINT "When the computer is first powered up these memory locations contain Hex FF"
PRINT
PRINT "When entering nemonics (LDA) they must be followed by a space character."
PRINT
INPUT "Press any key to begin"; z$
CLS
LineNumber = 2
AddressCount = 2
Contains$ = "FF"
PRINT "Address Data Nemonic Errors and Information"
PRINT "0800 FF " 'line 2
PRINT "0801 FF "
PRINT "0802 FF "
PRINT "0803 FF "
PRINT "0804 FF "
PRINT "0805 FF "
PRINT "0806 FF "
PRINT "0807 FF "
PRINT "0808 FF "
PRINT "0809 FF "
PRINT "080A FF "
PRINT "080B FF " 'line 13
PRINT "080C FF " ' 14
PRINT "080D FF " ' 15
PRINT "080E FF " 'line 16
PRINT "080F FF " ' 17
PRINT "0810 FF " ' 18
PRINT "0811 FF " 'line 19
PRINT "0812 FF " ' 20
PRINT "0813 FF " ' 21
PRINT "0814 FF " 'line 22
PRINT "0815 FF " 'line 23
PRINT "0816 FF ";
NegativeBit$ = "Not Negative"
CarrBit$ = "No Carry"
DecmalMode$ = "No"
ZeroBit$ = "Not Zero"
GOSUB StoreStatus
CursorControl2: 'Main loop
Temp$ = ""
LOCATE AddressCount, 22: INPUT Temp$
Temp$ = LTRIM$(Temp$)
Nemonic$ = MID$(Temp$, 1, 4)
HighAddData$ = MID$(Temp$, 5, 2)
LowAddData$ = MID$(Temp$, 7, 2)
Operator$ = MID$(Temp$, 5, 1)
IF Nemonic$ = "LDA " THEN GOTO LDA
IF Nemonic$ = "lda " THEN GOTO LDA
IF Nemonic$ = "STA " THEN GOTO STA
IF Nemonic$ = "sta " THEN GOTO STA
IF Nemonic$ = "JMP " THEN GOTO JMP
IF Nemonic$ = "jmp " THEN GOTO JMP
IF Nemonic$ = "LDX " THEN GOTO LDX
IF Nemonic$ = "ldx " THEN GOTO LDX
IF Nemonic$ = "STX " THEN GOTO STX
IF Nemonic$ = "stx " THEN GOTO STX
IF Nemonic$ = "LDY " THEN GOTO LDY
IF Nemonic$ = "ldy " THEN GOTO LDY
IF Nemonic$ = "STY " THEN GOTO STY
IF Nemonic$ = "sty " THEN GOTO STY
IF Nemonic$ = "SED " THEN GOTO SED
IF Nemonic$ = "sed " THEN GOTO SED
LOCATE 2, 45: PRINT "Invalid Instruction "; Temp$
GOTO CursorControl2
SED:
DecmalMode$ = "Decmal Mode"
GOSUB StoreStatus
LOCATE AddressCount, 9: PRINT "AD";
LOCATE 2, 45: PRINT " "
GOTO CursorControl2
LDA:
LOCATE 2, 45: PRINT " "
IF Operator$ = "#" THEN GOTO Immediate
Address = VAL("&H" + LowAddData$)
RowNum = Address + 2
GOSUB GetContents
AContains$ = Contains$
Contains$ = "FF"
LOCATE 3, 45: PRINT "The Accumulator now holds "; AContains$;
LOCATE AddressCount, 9: PRINT "AD";
GOTO StoreHighLow
STA:
LOCATE 2, 45: PRINT " "
Address = VAL("&H" + LowAddData$)
Address2 = Address + 2
IF Address2 >= 25 THEN GOTO StoreError
LOCATE Address2, 9: PRINT Contains$;
LOCATE AddressCount, 9: PRINT "8D";
GOTO StoreHighLow
Immediate:
AContains$ = MID$(Temp$, 6, 2)
LOCATE 3, 45: PRINT "The Accumulator now holds "; AContains$;
LOCATE AddressCount, 9: PRINT "A9";
GOSUB IncrementAdd
LOCATE AddressCount, 9: PRINT AContains$;
GOSUB IncrementAdd
AddressCount2 = AddressCount - 2
GOSUB PrintAddCount
LineNumber = LineNumber + 1
GOTO CursorControl2
JMP:
LOCATE 2, 45: PRINT " "
LOCATE AddressCount, 9: PRINT "4C";
GOTO StoreHighLow
LDX:
LOCATE 2, 45: PRINT " "
IF Operator$ = "#" THEN GOTO ImmediateX
Address = VAL("&H" + LowAddData$)
RowNum = Address + 2
GOSUB GetContents
XContains$ = Contains$
Contains$ = "FF"
LOCATE 5, 45: PRINT "The X register now holds "; XContains$;
LOCATE AddressCount, 9: PRINT "AD";
GOTO StoreHighLow
LDY:
LOCATE 2, 45: PRINT " "
IF Operator$ = "#" THEN GOTO ImmediateY
Address = VAL("&H" + LowAddData$)
RowNum = Address + 2
GOSUB GetContents
YContains$ = Contains$
Contains$ = "FF"
LOCATE 6, 45: PRINT "The Y Register now holds "; YContains$;
LOCATE AddressCount, 9: PRINT "AD";
GOTO StoreHighLow
STX:
LOCATE 2, 45: PRINT " "
Address = VAL("&H" + LowAddData$)
Address = Address + 2
IF Address >= 25 THEN GOTO StoreError
LOCATE Address, 9: PRINT XContains$;
LOCATE AddressCount, 9: PRINT "8D";
GOTO StoreHighLow
STY:
LOCATE 2, 45: PRINT " "
Address = VAL("&H" + LowAddData$)
Address = Address + 2
IF Address >= 25 THEN GOTO StoreError
LOCATE Address, 9: PRINT YContains$;
LOCATE AddressCount, 9: PRINT "8D";
GOTO StoreHighLow
ImmediateX:
XContains$ = MID$(Temp$, 6, 2)
LOCATE 5, 45: PRINT "The X Register now holds "; XContains$;
LOCATE AddressCount, 9: PRINT "A9";
GOSUB IncrementAdd
LOCATE AddressCount, 9: PRINT XContains$;
GOSUB IncrementAdd
AddressCount2 = AddressCount - 2
GOSUB PrintAddCount
LineNumber = LineNumber + 1
GOTO CursorControl2
ImmediateY:
YContains$ = MID$(Temp$, 6, 2)
LOCATE 6, 45: PRINT "The Y Register now holds "; YContains$;
LOCATE AddressCount, 9: PRINT "A9";
GOSUB IncrementAdd
LOCATE AddressCount, 9: PRINT YContains$;
GOSUB IncrementAdd
AddressCount2 = AddressCount - 2
GOSUB PrintAddCount
LineNumber = LineNumber + 1
GOTO CursorControl2
endit:
END
GetContents:
Contains$ = "" 'Erase the temp string.
FOR ColNum = 9 TO 10 'Get all characters on the line.
CharactVal = SCREEN(RowNum, ColNum) 'Read the screen memory.
Charact$ = CHR$(CharactVal)
Contains$ = Contains$ + Charact$ 'Concatenate all the characters.
NEXT ColNum
RETURN 'Go back with the data in the Temp$
StoreError:
LOCATE 9, 45: PRINT "I have no memory to store it there.";
FOR x = 1 TO 9999: NEXT x
LOCATE 9, 45: PRINT " ";
GOTO CursorControl2
StoreStatus:
LOCATE 11, 45: PRINT "Negative bit = "; NegativeBit$
LOCATE 12, 45: PRINT "Carry bit = "; CarrBit$
LOCATE 13, 45: PRINT "Zero bit = "; ZeroBit$
LOCATE 14, 45: PRINT "Decimal mode "; DecmalMode$
RETURN
IncrementAdd:
AddressCount = AddressCount + 1
IF AddressCount <> 24 THEN RETURN
IF AddressCount < 24 THEN RETURN
IncAdd:
LOCATE 10, 45: PRINT "The memory, such as it is, is full. ";
GOTO IncAdd
StoreHighLow:
GOSUB IncrementAdd
LOCATE AddressCount, 9: PRINT LowAddData$;
GOSUB IncrementAdd
LOCATE AddressCount, 9: PRINT HighAddData$;
GOSUB IncrementAdd
AddressCount2 = AddressCount - 2
GOSUB PrintAddCount
LineNumber = LineNumber + 1
GOTO CursorControl2
PrintAddCount:
AddCount$ = STR$(AddressCount2)
IF AddressCount2 < 10 THEN AddCount$ = "0" + STR$(AddressCount2)
LOCATE 4, 45: PRINT "The Address Counter now holds 08"; AddCount$;
RETURN