Received: from PCH.mit.edu (18.7.21.50) by mail.efplus.com (192.168.0.8) with Microsoft SMTP Server (TLS) id 8.3.485.1; Sun, 24 Jan 2021 00:01:40 -0800 Received: from PCH.MIT.EDU (localhost.localdomain [127.0.0.1]) by PCH.mit.edu (8.14.7/8.12.8) with ESMTP id 10O7oooR017447; Sun, 24 Jan 2021 02:54:03 -0500 Received: from outgoing-exchange-5.mit.edu (OUTGOING-EXCHANGE-5.MIT.EDU [18.9.28.59]) by PCH.mit.edu (8.14.7/8.12.8) with ESMTP id 10O7onGb017444 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Sun, 24 Jan 2021 02:50:49 -0500 Received: from oc11exedge1.exchange.mit.edu (OC11EXEDGE1.EXCHANGE.MIT.EDU [18.9.3.17]) by outgoing-exchange-5.mit.edu (8.14.7/8.12.4) with ESMTP id 10O7olJ2013556 for ; Sun, 24 Jan 2021 02:50:49 -0500 Received: from w92expo29.exchange.mit.edu (18.7.74.41) by oc11exedge1.exchange.mit.edu (18.9.3.17) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Sun, 24 Jan 2021 02:50:29 -0500 Received: from oc11exhyb1.exchange.mit.edu (18.9.1.60) by w92expo29.exchange.mit.edu (18.7.74.41) with Microsoft SMTP Server (TLS) id 15.0.1365.1; Sun, 24 Jan 2021 02:50:48 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by oc11exhyb1.exchange.mit.edu (18.9.1.60) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Sun, 24 Jan 2021 02:50:44 -0500 Received: from BN6PR03CA0022.namprd03.prod.outlook.com (2603:10b6:404:23::32) by SA0PR01MB6123.prod.exchangelabs.com (2603:10b6:806:eb::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11; Sun, 24 Jan 2021 07:50:43 +0000 Received: from BN8NAM11FT057.eop-nam11.prod.protection.outlook.com (2603:10b6:404:23:cafe::63) by BN6PR03CA0022.outlook.office365.com (2603:10b6:404:23::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Sun, 24 Jan 2021 07:50:43 +0000 Received: from mail-ed1-f47.google.com (209.85.208.47) by BN8NAM11FT057.mail.protection.outlook.com (10.13.177.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Sun, 24 Jan 2021 07:50:43 +0000 Received: by mail-ed1-f47.google.com with SMTP id a14so202692edu.7 for ; Sat, 23 Jan 2021 23:50:43 -0800 (PST) From: Joep Suijs To: Microcontroller discussion list - Public. Sender: "piclist-bounces@mit.edu" Date: Sat, 23 Jan 2021 23:50:30 -0800 Subject: Re: [PIC] PIC18F I2C Start/Stop condition detection Thread-Topic: [PIC] PIC18F I2C Start/Stop condition detection Thread-Index: AdbyJyX3JTB0k/BeSRyg14gD/YCe5Q== Message-ID: References: <600D0BC7.20406@narwani.org> List-Help: List-Subscribe: , List-Unsubscribe: , In-Reply-To: <600D0BC7.20406@narwani.org> Reply-To: Microcontroller discussion list - Public. Accept-Language: en-US X-MS-Exchange-Organization-AuthAs: Anonymous X-MS-Exchange-Organization-AuthSource: TS500.efplus4.local X-MS-Has-Attach: X-Auto-Response-Suppress: All X-MS-Exchange-Organization-SenderIdResult: Pass X-MS-Exchange-Organization-PRD: mit.edu X-MS-TNEF-Correlator: received-spf: Pass (protection.outlook.com: domain of gmail.com designates 209.85.208.47 as permitted sender) receiver=protection.outlook.com; client-ip=209.85.208.47; helo=mail-ed1-f47.google.com; dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=gfrUZP+38vcFxvElaJ62nz8Bot9uYpemU2RJWutmdj0=; b=qtyXfo+h4cxSaOA4QlvNQ7lE+51fpIjrJDnjysY8B1OQj9ystsYfHa9ugkeIDMMbec deI+CsGqS91Ps/Ber5xV0dSBwL7beNWcc5jGFWouc3aZpwXI/HMyoWIaM9/FjGshiguw JnexmHSU9XlRciCf7N0aZjWGjS5NE0qW4fLzcJ2s/QI7Xx4k0qRw3S6e7qq1RMOwIfep 6wAHmr1JYWYD5En+HJjBMWLbqoGfaCN0ZdK6COK4c6PKjFQ3sdXXX5OqKxZAozfTm/66 HrwnteddQLviIyXDzGMMiNAx6kw6zFnFRoxTuLd2VGmTmB547faUAvti3a2LiTAS5uiV 7ItA== authentication-results: spf=pass (sender IP is 209.85.208.47) smtp.mailfrom=gmail.com; mit.edu; dkim=pass (signature was verified) header.d=gmail.com; mit.edu; dmarc=pass action=none header.from=gmail.com; errors-to: piclist-bounces@mit.edu list-id: "Microcontroller discussion list - Public." list-post: x-beenthere: piclist@mit.edu x-mailman-version: 2.1.6 x-received: by 2002:a50:fc18:: with SMTP id i24mr189400edr.308.1611474642156; Sat, 23 Jan 2021 23:50:42 -0800 (PST) x-topics: [PIC] x-content-filtered-by: Mailman/MimeDel 2.1.6 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Neil, When looking at fig 26-17, it seems S remains high until stop is received. The description mentions 'detected last', which -although not very specific - might confirm that it remains high until a stop condition is detected. Joep Op zo 24 jan. 2021 om 06:59 schreef Neil : > Hi all, > > I'm using I2C in slave mode on a PIC18F24Q10. The incoming packets are > like this... > http://orlandorobotbuilders.com/stuff/WD-I2C-hold-packet-01.gif > > The PIC18F24Q10 datasheet is here... > > https://ww1.microchip.com/downloads/en/DeviceDoc/PIC18F24-25-Q10-Data-She= et-40001945D.pdf > > The MSSP has a flag and interrupt for Start and Stop condition (S & P > bits in SSPxSTAT) and I tried this code in the ISR to detect these... > > if (SSP1STATbits.S =3D=3D 1) > { > TX1REG =3D 'S'; > SSP1STATbits.S =3D 0; > } > > if (SSP1STATbits.P =3D=3D 1) > { > TX1REG =3D 'P'; > SSP1STATbits.P =3D 0; > } > > (I'm using EUSART1 for debugging to a serial terminal). > > But I'm getting the 'S' 6 times for each message, and It's repeating the > 'P' several times, even after the message is over. (The package is > being sent once only). Am I missing something obvious here? > BTW, I've worked around this already, but just want to know now. > > Cheers, > -Neil. > > > > -- > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .