LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-26-2008, 05:31 AM   #1
nasr-noor
LQ Newbie
 
Registered: Aug 2005
Posts: 15
Blog Entries: 1

Rep: Reputation: 0
Question serial port problem


Hi,
I have 2 PC one has Windows and send data frame on serial port, and another is fedora 9 and receive data.
I convert my integer value to binary, and every value is one byte(char).
When I receive characters convert this char(binary) to int and use them.

when I send 13,17,19 binary character, I receive wrong value on fedora, but when I receive them on windows its ok.

do you know whats the problem?
 
Old 11-26-2008, 10:53 PM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Do you mind explaining a bit more in detail (and maybe sharing some code). I'm a bit confused as an integer is already a binary (so why convert).

What do you receive?

Thoughts that came up while reading your post:
  • little endian / big endian problem (will not be the case of both systems run on the same processor type (e.g. x86))
  • serial port configuration (7-bit / 8-bit, parity, ...)
 
Old 11-29-2008, 12:51 AM   #3
nasr-noor
LQ Newbie
 
Registered: Aug 2005
Posts: 15

Original Poster
Blog Entries: 1

Rep: Reputation: 0
Excuse me,
I send integer value(Not ASCII code),for example 00000000(Not 48) for number 0.
I convert my integer to char for send, and when I receive char convert it to integer.
problem:
when I send 00000000,00001101,00010001,00010011 for 0,13,17,19 on linux I receive NULL or wrong characters.
 
Old 11-30-2008, 10:30 PM   #4
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Difficult to say from your description. I assume that the NULL is generated by your code and probably means that there is no data received.

Sorry, but I don't think that I can help further.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Serial port problem! instcode Ubuntu 3 01-05-2007 11:19 PM
Problem with serial port billyseth Linux - Kernel 1 10-27-2006 01:07 PM
serial port problem... linux4john Linux - Software 1 10-30-2003 10:02 PM
Serial port problem ruchika Linux - Networking 0 08-15-2003 04:18 PM
Problem with Serial port mritunjay Linux - Networking 1 04-22-2002 01:59 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration