Welcome, guest | Sign In | My Account | Store | Cart

PAR: as a VOLUME in READ mode using Python 1.4 onwards on Classic AMIGAs...

Many years ago Irmen de Jong ported Python to the Classic AMIGA range of computers, (many thanks Irmen for your time in doing so). The versions were at least 1.4.x to 2.0.1 and now someone else has included version 2.4.6.

This gives we lowly users of the AMIGA at least a chance to see and use Python in some guise or another. This code shows how to access the AMIGA parallel port for 8 bit READ only. This is so that ADCs could be attached to the port, read by Python code EASILY and utilised as a Data Logger/Transient Recorder, as just one example.

There needs to be a single HW WIRE link only from the 23 way video port to the 25 way parallel port for this to work. See the archive......

http://aminet.net/package/docs/hard/PAR_READ

......on how to set about this extremely simple task.

NO knowledge of the parallel port programming is needed at all to grab 8 bit data from it using Python and other languages; (ARexx is used in the archive above).

There is a flaw, NOTE:- NOT A BUG!, in the Python code but for this DEMO it is ignored. ;o)

I'll let all you big guns work out what it is; you will need a good working knowledge of the Classic AMIGA.

Enjoy finding simple solutions to often very difficult problems. ;o)

This code is Public Domain and you may do with it as you please.

Bazza...

Python, 61 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# ParOpenAMIGA.py
# ---------------------------------------------------------------------------
# Accessing the parallel port to import 8 bit data, (C)2006, B.Walker, G0LCU.
# This is now Public Domain. AMIGA-heads may do with it as they please. :)
# ---------------------------------------------------------------------------
# A DEMO stand alone running program that will obtain a single byte of data
# from a classic STOCK AMIGA A1200 parallel port and display the value on
# screen in decimal.
# ---------------------------------------------------------------------------
# The Python version for my STOCK A1200 was only V1.4 but was more than
# adequate for this exercise as it shows how EXTREMELY powerful PAR: is when
# used as a VOLUME. There are Python versions to 2.4.6 for the 680x0 family
# of classic AMIGA computers up on AMINET...
# http://main.aminet.net/
# ---------------------------------------------------------------------------
# PAR_READ.lha from the /docs/hard drawer of AMINET IS REQUIRED for this to
# work because PAR: used as a VOLUME HAS to have the -ACK line, Pin 10 of
# the parallel port, toggled continuously...
# http://aminet.net/package/docs/hard/PAR_READ
# ---------------------------------------------------------------------------
# STOCK AMIGA A1200, OS3.0x and topaz.font 8 were used for this program.
# ---------------------------------------------------------------------------

# Set up a version number recognised by the AMIGAs version command.
version = '$VER: ParOpen.py_V1.00.00_(C)15-01-2006_B.Walker_G0LCU.'

# Set up a basic screen, NOTE:- ~print '\f'~ is used as the CLS command.
print '\f'
print '           ',version
print
print '           Parallel Port access on the AMIGA using PAR: as a VOLUME.'
print
print '                            Press Ctrl-C to stop.'
print
print '               The decimal value at the parallel port is:- 0 .'

# This is the start of the continuous loop to grab the data sitting on the
# parallel port. It does about 2 samples per second and there IS a flaw here.
# It is NOT a bug however...
def main():

	while 1:
		# -----------------------------------------------------------
		# Set a pointer to the PAR: device and OPEN it up.
		pointer = open('PAR:', 'rb', 1)
		# Once set, grab my byte and ~store~ it.
		mybyte = str(pointer.read(1))
		# As soon as my byte is grabbed CLOSE down PAR:.
		pointer.close()
		# ===========================================================
		# Over print the printed line AND convert mybyte to a decimal value.
		print '\v','               The decimal value at the parallel port is:-',ord(mybyte),'.    '
		# Ctrl-C is used for stopping the program, or set all DATA lines to 1.
		# -----------------------------------------------------------
		if mybyte == chr(255): break
		# -----------------------------------------------------------

main()

# End of DEMO.
# Enjoy finding simple solutions to often very difficult problems... ;o)

I am not bothered how you regard this recipe as it is purely for AMIGA nutters like myself, (and there are still a lot of us out there), who wish to experiment with Python and would like to know how to marry this computer language to AMIGA hardware. I haven't included writing to the port as this is SOOOO easy without Python as to not bother...

Enjoy finding simple solutions to often very difficult problems. ;o)

Bazza...

Created by Barry Walker on Sun, 12 Jun 2011 (MIT)
Python recipes (4591)
Barry Walker's recipes (73)

Required Modules

  • (none specified)

Other Information and Tasks