QuarterArcade Coin-Op Tech Net

IntroductionFIDE SoftwareSign UtilityProgramming9010A Code Generator
Intro to ScriptingIntermediate Programming


This article will give you some background information for programming for the Fluke 9010A. It will assume that you have a little knowledge of programming.

Overview of the 9LC language

The "9LC" language is the language that is supported by the Fluke compiler. This is the same compiler that FIDE uses, although at some point in the future FIDE may implement a more complex programming language. 9LC is a fairly simple language, and you can only script the same commands that you see on the keypad. Luckily, there are a few constructs that will allow us to write reasonably sophisticated programs.

Basically, the 9LC scripting language has the following features: Some limitations to note:

Creating a Simple Program

The general format of a program is the setup block, and then your program block. For the first program example ("Hello World"), we can start with the first program:
!! SUB: Hello
!! PURPOSE: To display a simple message
program Hello

	!! display our message, note that we only have 39 characters
Not terribly interesting, but it shows you the structure of a very simple program. Note that the dpy command is used to both display results to the user, but to also capture input. Let's look at creating a program that gets inputs and then displays the results:
!! SUB: MainProgram
!! PURPOSE: Start our program
program MainProgram
	assign REG9 to Params

	execute Intro			!! invoke another program
	dpy READY TO WORK			!! time to chew bubble gum
					!! and write code.
					!!   .. and I'm all outta gum
	dpy YOU PRESSED $Params

!! SUB: Intro
!! PURPOSE: Tell the user what this program is, in case they forgot.
program Intro
	assign REG9 to INPUT		!! we will capture input

	!! get input
Now you can see that you can output information, and you can input information. A couple of additional commands, and you can make full blown programs. A summary of what you'll probably need to learn first are: Note that all this information and much more is covered in the official Fluke programming documentation. The FIDE program also contains a summary of commands built into the program. (If you turn off auto-help, you can always get help on your current line number by pressing F1 as long as the output window is not minimized.)

Routines, Include Files, and Parameter Passing

Building modular, re-usable code requires that you build small routines that you can invoke from various different programs. For example, once you figure out how to use your probe (if you have one), you might as well write that code once and then re-use it again and again.

Parameter Declarations

As demonstrated above, you can use a "declarations" section (must be right after the program statement) can be used to give variables logical names. Only the first eight letters are significant, so "MyNewVariableToday" is the same as "MyNewVariableTomorrow." Also, you can designate two different variables to the same register. Probably not good programming practice.

Some notes about the registers:

Parameter Passing

So in general you can use REG1-REG7 for parameters within a given program or sub-routine and you will not cause any side effects. To pass parameters, you have to use REG8-REGF. Frequently you'll use this to pass in an address or to pass back a result.

Include Files

In order to make your code really reusable, you'll want to put your function in an include file. If you are only using the fluke compiler, you need to note that the file that you include must be located in the same directory as your main file. The FIDE program has expanded the include feature so that this is not the case. With the FIDE program, you can use the tilda to include a file relative to your project root.

Memory Dump Test

Bringing it all together, here is a coding example that nicely dumps out a range of memory. The Fluke Troubleshooter documentation has a very similar program (although I developed this variation on my own). It consists of two files: the utility library file, and the main program. You could use this utility to dump out memory you want to inspect, or you could ask for the memory range as I do in this case.

Dump Memory.9lc
!! SUB: DumpMemory
!! PURPOSE: Dumps a range of address space and sends it to aux
!!	REG8 = start address
!!	REG9 = end address
program DumpMemory

	assign REG1 to lowAddr
	assign REG2 to highAddr
	assign REG3 to currAddr
	assign REG4 to loopCnt
	lowAddr = REG8				!! redundant, but very clear
	highAddr = REG9				!! our stopping point
	currAddr = lowAddr				!! we'll read from this address

	aux _
	aux ADDR__00_01_02_03+
	aux _04_05_06_07_08+
	aux _09_0A_0B_0C_0D+
	aux _0E_0F
	aux ====__==_==_==_==+
	aux _==_==_==_==_==+
	aux _==_==_==_==_==+
	aux _==_==+

	aux _					!! new line
	REG9 = currAddr				!! parameter to AuxAddress
	execute AuxAddress				!! display it in HHHH format

	aux _+					!! space
						!! we are always going to do 8 bytes
						!! reguardless of the range.
	loopCnt = 10
	READ @ currAddr				!! read data
	aux _+					!! space
	REG9 = DAT				!! pass parameter
	execute AuxData				!! send data to aux 
	inc currAddr				!! increment our current counter
	dec loopCnt				!! decrement line counter
	if loopCnt > 0 goto Loop2			!! still more to output on this line

	!! are we done? Did we output all of the data?
	if highAddr >= currAddr goto Loop1
!! SUB: AuxAddress
!! PURPOSE: Sends an address to the aux channel
!!	REG9 = address to ouput
program AuxAddress

	assign REG1 to addr1
	!! get parameter
	addr1 = REG9

	!! more readable output
	if addr1 > 0FFF goto SendAddr
	aux 0+
	if addr1 > 00FF goto SendAddr
	aux 0+
	if addr1 > 000F goto SendAddr
	aux 0+
	aux $addr1+

!! SUB: AuxData
!! PURPOSE: Sends data to the aux channel
!!	REG9 = data to ouput
program AuxData

	assign REG1 to data1
	!! get parameter
	data1 = REG9

	!! more readable output
	if data1 > 000F goto SendData
	aux 0+
	aux $data1+	
Scan Memory.9lc
!! Set up code
	exercise errors yes
	include "6809E.POD"	!! your POD may vary...
	POD 6809E			!! tells compiler what POD we're using

!! Main Menu: 
program Menu

	dpy END DUMP AT /9
	execute DumpMemory

	goto Menu 

!! assumes this is where you placed Dump Memory.9lc
!! assumes that you are using FIDE
!! and note that include files get included right where you
!! put the include statement.
include "~/Utils/Lib/Dump Memory.9lc"
Now this is just a simple of example of a pretty passive program. It doesn't really do anything to your unit under test (UUT) other than dump out a particular memory range. However, it does illistrate several programming specifics that you'll need if you start developing scripts of your own.

powered by ggdb.com this page took approx. 0.001s