Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Problem with sending Chr(128) - Chr(255) to a serial port device

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-12-2010, 10:23 AM
Newbie
 
Join Date: Jan 2010
Posts: 5
Default Problem with sending Chr(128) - Chr(255) to a serial port device

Hello all

I am writing a software to communicate with a device via a serial port. I could send a single character of chr(0) - chr(127) and get the response from my device. But when sending chr(128), I got a communication error. It is the same for any character with the ascii code ranging from 128 to 255.

I use the following command:
serial.Output (Chr(Yag))
where Yag is a constant

I also checked the output string from my PPC using a RS232 terminal program. For chr(128) - chr(255), the string "?" was sent out from my PPC. This is not right.

How does Basic4PPC deal with chr(128) - chr(255) sent via a serial port? What is the workaround to send the string with the ascii code from 128 to 255?

Best regards,
Anat

Last edited by aruangra : 01-12-2010 at 11:19 AM.
Reply With Quote
  #2 (permalink)  
Old 01-12-2010, 01:16 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

You need to use my http://www.basic4ppc.com/forum/addit...html#post18998 which fixes several problems with using Serial2 for binary and non-ASCII communication.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #3 (permalink)  
Old 01-12-2010, 01:50 PM
Newbie
 
Join Date: Jan 2010
Posts: 5
Default

Thank you very much. I replaced the original Serial2.dll by SerialEx.dll, but I still have the same problem with chr(128) - chr(255) when using the "output" method. What is the appropriate method that I should use?

Thanks,
Anat

Last edited by aruangra : 01-12-2010 at 02:03 PM.
Reply With Quote
  #4 (permalink)  
Old 01-12-2010, 02:50 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

The standard encoding of SerialEx is ASCII so that it defaults to the same as Serial2. To send strings with characters > 127 you need to set the Encoding property to suit the expectation of whatever you are talking to. There is a list in the Encodings topic of the help.

If if is binary data you are sending then the encoding is irrelevant and you should use Output2 or OutputBytes.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #5 (permalink)  
Old 01-13-2010, 12:29 AM
Newbie
 
Join Date: Jan 2010
Posts: 5
Default

Thank you. The problem is solved using Output2.

Best regards,
Anat
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using the USB port as a serial port :-) taximania Questions (Windows Mobile) 9 10-03-2009 07:14 PM
Serial Port problems when compiling for the PDA device. pdablue Questions (Windows Mobile) 3 03-30-2009 02:56 PM
Crashed B4PPC on device trying serial port mjcoon Questions (Windows Mobile) 2 03-30-2009 12:49 PM
Serial Port ceaser Questions (Windows Mobile) 10 01-11-2009 03:26 PM
Open serial port crashes program on device Steve Bug Reports 2 05-23-2007 09:52 PM


All times are GMT. The time now is 10:42 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0