Home: Perl Programming Help: Beginner:
9 databits in Device::SerialPort



FPeter
Novice

Nov 9, 2012, 2:17 PM


Views: 8882
9 databits in Device::SerialPort

Hi All!

As i see, its not possible to set databits to 9 directly when using Device::SerialPort. Is there any way to read 9 bit frames from a special serial source? 9th bit means the starting of new packages, so it should be handled somehow... Is it possible to use the parity bit for this? Only reading is required, sending is not necessary...

Best regards


Laurent_R
Veteran / Moderator

Nov 10, 2012, 12:51 AM


Views: 8875
Re: [FPeter] 9 databits in Device::SerialPort

Hmm, not sure what you mean exactly by databits, but it could be that the number of bits has to be a power of 2.


FPeter
Novice

Nov 10, 2012, 1:06 AM


Views: 8874
Re: [Laurent_R] 9 databits in Device::SerialPort

in normal case, we use 8N1 mode, means 1 startbit + 8 databit + 1 stopbit

but now i need 1 startbit + 9 databit + 1 stopbit, where the 9th databit is a control bit. on PIC microcontrollers, You can write/read the parity bit register by software to implement the 9th bit - but i dont know if its possible in perl...


Laurent_R
Veteran / Moderator

Nov 10, 2012, 3:39 AM


Views: 8871
Re: [FPeter] 9 databits in Device::SerialPort

I had not seen that you were dealing with serial ports, and understood something different, therefore my previous answer was irrelevant.

I know nothing about serial ports, but the CPAN documentation (http://search.cpan.org/~cook/Device-SerialPort-1.000002/SerialPort.pm) seems to be saying:


Quote
databits

An integer from 5 to 8.



FPeter
Novice

Nov 10, 2012, 4:50 AM


Views: 8868
Re: [Laurent_R] 9 databits in Device::SerialPort

yes, it gives error message when i try to set databits parameter to 9

so im asking if there is an alternative roundabout to handle 9th bit, like soft reading of parity bit or any other way