🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: nl.comp.programmeren
Article #716

Re: bits van parallelle poort zetten

#716
From: Eric Paillet
Date: Fri, 05 Nov 1999 00:00
100 lines
4344 bytes
This is a multi-part message in MIME format.

------=_NextPart_000_0063_01BF27C2.8EA6D4A0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


>Mijn vraag dus: hoe kan ik =E9=E9n bit van de parallelle poort laten
>vari=A8eren zonder dat de andere bits van de parallelle poort  =
be=A8invloed
>worden?

Bit toggles worden normaal uitgevoerd met een XOR bewerking:
Stel dat je Bit 2 wilt togglen (2maal bijvoorbeeld)

bv
DATABYTE:       10011101
MASK:           00000100
XOR --------------------------------
                10011001     =E9=E9nmaal getoggled
MASK            00000100
XOR --------------------------------
                10011101     en terug
     =20
In C zou je bv deze functie kunnen schrijven (hopelijk vergis ik me =
niet, 'k heb het niet gecontroleerd in werkelijkheid)

int toggle (int bit, int value)
    {
    return (value^(1<<bit));
    }


PS, sorry, voor de HTML, maar 'k moest een niet-proportioneel lettertype =
hebben, anders klopte m'n tabelleke niet.

------=_NextPart_000_0063_01BF27C2.8EA6D4A0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Dwindows-1252" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR></HEAD>
<BODY>
<DIV><BR>&gt;Mijn vraag dus: hoe kan ik =E9=E9n bit van de parallelle =
poort=20
laten<BR>&gt;vari=A8eren zonder dat de andere bits van de parallelle =
poort&nbsp;=20
be=A8invloed<BR>&gt;worden?</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DCourier>Bit toggles worden normaal uitgevoerd met een =
XOR=20
bewerking:</FONT></DIV>
<DIV><FONT face=3DCourier>Stel dat je Bit 2 wilt togglen (2maal=20
bijvoorbeeld)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DCourier>bv</FONT></DIV>
<DIV><FONT face=3DCourier>DATABYTE:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
10011101</FONT></DIV>
<DIV><FONT=20
face=3DCourier>MASK:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;00000100</FONT></DIV>
<DIV><FONT face=3DCourier>XOR =
--------------------------------</FONT></DIV>
<DIV><FONT face=3DCourier>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; 10011001&nbsp;&nbsp;&nbsp;&nbsp; =E9=E9nmaal=20
getoggled</FONT></DIV>
<DIV><FONT=20
face=3DCourier>MASK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;00000100</FONT></DIV>
<DIV><FONT face=3DCourier>XOR =
--------------------------------</FONT></DIV>
<DIV><FONT=20
face=3DCourier>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10011101&nbsp;&nbsp;&nbsp;&nbsp;=20
en terug</FONT></DIV>
<DIV><FONT =
face=3DCourier>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></DIV>
<DIV><FONT face=3DCourier>In C zou je bv deze functie kunnen schrijven =
(hopelijk=20
vergis ik me niet, 'k heb het niet gecontroleerd in =
werkelijkheid)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DCourier>int toggle (int bit, int value)</FONT></DIV>
<DIV><FONT face=3DCourier>&nbsp;&nbsp;&nbsp; {</FONT></DIV>
<DIV><FONT face=3DCourier>&nbsp;&nbsp;&nbsp; return=20
(value^(1&lt;&lt;bit));</FONT></DIV>
<DIV><FONT face=3DCourier>&nbsp;&nbsp;&nbsp; }</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DCourier>PS, sorry, voor de HTML, maar 'k moest een=20
niet-proportioneel lettertype hebben, anders klopte m'n tabelleke=20
niet.</FONT></DIV></BODY></HTML>

------=_NextPart_000_0063_01BF27C2.8EA6D4A0--
Technical Details
Message-ID: <7vv758$eqq$1@nickel.uunet.be>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3821E2AC.468F1B5@skynet.be>

Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII
X-Google-Thread: 107324,93321832b0b4ae55
X-Google-Attributes: gid107324,public
X-Google-Thread: fcea4,93321832b0b4ae55
X-Google-Attributes: gidfcea4,public
From: "Eric Paillet" <epaillet@vt4.net>
Subject: Re: bits van parallelle poort zetten
Date: 1999/11/05
Message-ID: <7vv758$eqq$1@nickel.uunet.be>
X-Deja-AN: 544902533
References: <3821E2AC.468F1B5@skynet.be>
Content-Type: multipart/alternative; boundary="----=_NextPart_000_0063_01BF27C2.8EA6D4A0"
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Organization: UUNET Benelux (post does not reflect views of UUNET Benelux)
Mime-Version: 1.0
Newsgroups: nl.comp.programmeren,be.comp.programming