The following small code example shows how all 8 bits of Port D can be made available for I/O by switching off the hardware UART for COM1. The latter operation makes D.0 and D.1 accessible to standard I/O operations via Register.PortD (although the compiler blocks PutPin operations on these two pins). This may be relevant for the smaller ZX variants where a full port is not always available, or for larger variants where a combination of I2C and ADC use excludes a fully available port as well.
The code is an outcome of the following discussion : http://www.zbasic.net/forum/about1278.html. The example in the attachment describes the use of a common-anode 7-segment display on port D. The code includes a description of the test hardware.
Jurjen Kranenborg
Small ZX devices: switching off COM1 -> freeing port D
-
- Posts: 57
- Joined: 27 July 2009, 14:20 PM
- Location: Groningen, The Netherlands
- Contact:
Small ZX devices: switching off COM1 -> freeing port D
- Attachments
-
- SevenSegmentTest.zip
- (1.12 KiB) Downloaded 2113 times
Last edited by kranenborg on 07 August 2019, 7:38 AM, edited 2 times in total.
This code can only be used for native devices I believe. The code should have the following around it
Code: Select all
#if Option.TargetCode="ZVM"
#error Unsupported device
#else
<< code goes here >>
#endif
Mike Perks