tx.txt

Warning: if you clip this code into your program, look out for possible html code slipping in.

REM   Example of RX() and TX() - Transmitter
REM
REM   Author: Steven R. Wheeler
REM
REM   Copyright 2000 Vesta Technology, Inc.
REM   All rights reserved.

REM   This application is intended to run on an SBC2000-074 or SBC2000-062
REM   which is connected to another SBC2000. As the applications are written,
REM   both boards must be the same (that is, if the receiver board is an
REM   SBC2000-074, the transmitter board must be also).

REM   Connections:
REM     Transmitter Keyboard.7 to Receiver Keyboard.7
REM     Transmitter Keyboard.8 to Receiver Keyboard.8

REM   Declare the I/O bits

CONSTANT PORT AS BYTE =  6
CONSTANT RCV  AS BYTE =  7
CONSTANT XMT  AS BYTE =  6
GLOBAL   INTS AS BIT  = 11,7

REM   Declare the timeout location

CONSTANT Timeout AS BYTE = 0x29


REM   Declare the variables we'll use

GLOBAL info AS INTEGER
GLOBAL back AS INTEGER
GLOBAL good AS INTEGER
GLOBAL bad  AS INTEGER


REM   Here is the application

good = 0						: REM   Initialize the counts
bad  = 0

LCD_Command(0x01)					: REM   Clear the display
PIPE PRINT LCD					    : REM   Normal output to LCD
PRINT "Good            Bad"
POKE(Timeout, 64)					: REM   Wait 1/2 second for reply

DO
	INTS = 1
	info = INKEY()				: REM   Get a character from the user
	IF info <> -1
		INTS = 0				: REM   Turn off interrupts
		TX(PORT, XMT, 100, 16, 0, info)	: REM   Send the character
		back = RX(PORT, RCV, 100, 16, 0): REM   Get it back

		REM   Determine errors
		IF back = info
			good = good + 1
		ELSE
			bad = bad + 1
		ENDIF

		REM   Update display
		LCD_Command(0xC0)			: REM   Position cursor
		PRINT good, "     "		: REM   Display received value
		LCD_Command(0xD0)			: REM   Reposition cursor
		PRINT bad, "     "		: REM   Display it
	ENDIF
LOOP UNTIL 0


 

VestaTech Home

© 2002 Vesta Technology