beautypg.com

Remote Processing CAMBASIC User Manual

Page 93

background image

Comm ands - 60

INP

I/O Fu nction

SYNTAX:

n = INP(I/O addre ss)
OUT I/O a ddress, data

PURPOSE:

INP retur ns a byte from an I/O addre ss.
OUT writes a byte to an I/O addre ss.

REMARK S:

I/O addre ss is in the range of 0 to 65,536 (&FF FF).
data is in the range of 0 to 255 (&FF).

INP and OUT are used to rea d and write to har dware de vices, such as digital I/O and coun ters.

INP is the comp lementar y function to the O UT sta tement.

WARNING:

S o m e I / O ad d r es s a r e us e d i nt e rn a ll y a n d s h ou ld n ot be w r it te n to w it h t he O U T

statement. Gener ally, these are from &80 to &CF . See your har dware ma nual for
these addresses.

RELATED:

BIT

EXAMPLE:

100 A = INP(255)
120 OUT &40,12

ERROR:

< Data negative> – for I/O addre ss and data
< Illegal argument> – if I/O addre ss > 65,535
< Data > 255> – if data > 255