VoyForums

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time ]
Subject: Re: How to read external input port signal status


Author:
Jano
[ Next Thread | Previous Thread | Next Message | Previous Message ]
Date Posted: 11:16:16 03/15/04 Mon
In reply to: Neoh Soon Huat 's message, "How to read external input port signal status" on 10:13:04 03/11/04 Thu

First of all, if you want to read something, you have to set the
corresponding
bits of TRISA to 1. For example, if you want to read from the 4. pin of
PORTA,
you need an insctruction like BitSet(TRISA,4); , or TRISA:=TRISA or $10; .
After this you can read the input via the 4th. bit of PORTA. For example
input:=PORTA and $10; // in this case the value of "input" will be $10 or 0
depending
on tha status of the pin. You can use also some conditinal expression to
test the pin, like:

if set PORTA.4 then
begin
// this code will be executed, if the pin is on TTL High level
end;
if clear PORTA.4 then
begin
// this code will be executed, if the pin is on TTL Low level
end;

[ Next Thread | Previous Thread | Next Message | Previous Message ]


Post a message:
This forum requires an account to post.
[ Create Account ]
[ Login ]
[ Contact Forum Admin ]


Forum timezone: GMT-8
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.