Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.raspberry-pi > #9722 > unrolled thread

[serial com (rs232)] 9 bits needed

Started byandre <ahr@blabla.be>
First post2015-09-30 10:19 +0200
Last post2015-10-11 00:28 -0400
Articles 6 — 6 participants

Back to article view | Back to comp.sys.raspberry-pi


Contents

  [serial com (rs232)] 9 bits needed andre <ahr@blabla.be> - 2015-09-30 10:19 +0200
    Re: [serial com (rs232)] 9 bits needed Dom <domafp@blueyonder.co.uk> - 2015-09-30 09:39 +0100
      Re: [serial com (rs232)] 9 bits needed Rob <nomail@example.com> - 2015-09-30 10:37 +0000
    Re: [serial com (rs232)] 9 bits needed colonel_hack@yahoo.com - 2015-09-30 13:25 -0700
    Re: [serial com (rs232)] 9 bits needed Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2015-10-01 10:31 +0300
    Re: [serial com (rs232)] 9 bits needed jeffj@panix.com (Jeff Jonas) - 2015-10-11 00:28 -0400

#9722 — [serial com (rs232)] 9 bits needed

Fromandre <ahr@blabla.be>
Date2015-09-30 10:19 +0200
Subject[serial com (rs232)] 9 bits needed
Message-ID<mug5tm$r8s$1@speranza.aioe.org>
I am trying to build a rs485 network using microcontrolers
Microcontrolers have the hability to recieve 9 bits data.
They use this as an 'adress'. If the adresse matches the folowing data 
(8bits) are read (causing an interrupt) otherwize they are ignored until 
the next adress.
gcc can't be configurated for 9 bits (CS9 doesn't exist)
Is there another way to do it??
Many thanks in advances
Andre

[toc] | [next] | [standalone]


#9723

FromDom <domafp@blueyonder.co.uk>
Date2015-09-30 09:39 +0100
Message-ID<HcNOx.17845$Eo2.4840@fx47.am4>
In reply to#9722
On 30/09/15 09:19, andre wrote:
> I am trying to build a rs485 network using microcontrolers
> Microcontrolers have the hability to recieve 9 bits data.
> They use this as an 'adress'. If the adresse matches the folowing data
> (8bits) are read (causing an interrupt) otherwize they are ignored until
> the next adress.
> gcc can't be configurated for 9 bits (CS9 doesn't exist)
> Is there another way to do it??
> Many thanks in advances
> Andre
Is it 9 bits with no parity? If so, maybe you could bodge it by fiddling 
the parity bit for each byte sent.

For example:

101010100 = 10101010 + 0 parity (set parity to even before sending this 
byte)
101010101 = 10101010 + 1 parity (set parity to odd before sending this byte)

[toc] | [prev] | [next] | [standalone]


#9724

FromRob <nomail@example.com>
Date2015-09-30 10:37 +0000
Message-ID<slrnn0neqr.na9.nomail@xs9.xs4all.nl>
In reply to#9723
Dom <domafp@blueyonder.co.uk> wrote:
> On 30/09/15 09:19, andre wrote:
>> I am trying to build a rs485 network using microcontrolers
>> Microcontrolers have the hability to recieve 9 bits data.
>> They use this as an 'adress'. If the adresse matches the folowing data
>> (8bits) are read (causing an interrupt) otherwize they are ignored until
>> the next adress.
>> gcc can't be configurated for 9 bits (CS9 doesn't exist)
>> Is there another way to do it??
>> Many thanks in advances
>> Andre
> Is it 9 bits with no parity? If so, maybe you could bodge it by fiddling 
> the parity bit for each byte sent.
>
> For example:
>
> 101010100 = 10101010 + 0 parity (set parity to even before sending this 
> byte)
> 101010101 = 10101010 + 1 parity (set parity to odd before sending this byte)

And when receiving you can set the receiver for 8 bits + parity (odd
or even) with PARMRK (i.e. characters with bad parity are not discarded
but marked in the datastream), then calculate the parity of the 8 bits
and combine it with the "parity error" indication to know what the 9th
bit must have been.

[toc] | [prev] | [next] | [standalone]


#9732

Fromcolonel_hack@yahoo.com
Date2015-09-30 13:25 -0700
Message-ID<alpine.BSF.2.00.1509301249500.26213@bunrab.ronnet.moc>
In reply to#9722
On Wed, 30 Sep 2015, andre wrote:

> gcc can't be configurated for 9 bits (CS9 doesn't exist)
> Is there another way to do it??
bitfields?

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[], char *env[]){
   int i;
   struct {
     /*9 bit field*/
     unsigned  x:9;
   } y;
   y.x=500;
   for (i=0;i<20;i++){
     printf("%5d\n",y.x++);
   }
}

counts to 511 then rolls over. You might have to check how the bits are 
actually stored to interface w/ hardware.

   Ron

[toc] | [prev] | [next] | [standalone]


#9733

FromTauno Voipio <tauno.voipio@notused.fi.invalid>
Date2015-10-01 10:31 +0300
Message-ID<muindd$mui$1@dont-email.me>
In reply to#9722
On 30.9.15 11:19, andre wrote:
> I am trying to build a rs485 network using microcontrolers
> Microcontrolers have the hability to recieve 9 bits data.
> They use this as an 'adress'. If the adresse matches the folowing data
> (8bits) are read (causing an interrupt) otherwize they are ignored until
> the next adress.
> gcc can't be configurated for 9 bits (CS9 doesn't exist)
> Is there another way to do it??
> Many thanks in advances
> Andre

GCC is the compiler - it has nothing to do with serial communication.

On the 8250 family of serial interfaces (in the IBM PC way) have a
mode called 'stick parity' where you can send the ninth bit,
controlling it with the parity selection. On receive, you can
follow the parity error bit. Clumsy, but working.

-- 

-TV

[toc] | [prev] | [next] | [standalone]


#9789

Fromjeffj@panix.com (Jeff Jonas)
Date2015-10-11 00:28 -0400
Message-ID<mvcoi3$mgj$1@panix5.panix.com>
In reply to#9722
In article <mug5tm$r8s$1@speranza.aioe.org>, andre  <ahr@blabla.be> wrote:
>I am trying to build a rs485 network using microcontrolers
>Microcontrolers have the hability to recieve 9 bits data.
>They use this as an 'adress'. If the adresse matches the folowing data
>(8bits) are read (causing an interrupt) otherwize they are ignored until
>the next adress.

"9 bit" is a hardware feature of the UART.
Hardware support is best,
unless you "bit-bang" the serial bits totally in software.

>gcc can't be configurated for 9 bits (CS9 doesn't exist)

It's not a compiler issue.
Look at how the Microchip PIC or Atmel AVR do it:
it's via control registers and data that are all 8-bit-bytes.

>Is there another way to do it??

Software bit-banging.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.raspberry-pi


csiph-web