VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

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.