CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PICmicro Serial Com with VB - Inquiry and Help

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
chingB



Joined: 29 Dec 2003
Posts: 81

View user's profile Send private message

PICmicro Serial Com with VB - Inquiry and Help
PostPosted: Sun Jan 23, 2005 7:07 am     Reply with quote

Hi,

I have a setup with a VB program that can sends command to my PICmicro!

My problem:
When I send a command to my PIC then it reply by sending 16byte character... when I debug my VB code I found out that the last three(4) character were not received.

With this I made an experiment... that my PIC will only send 8byte character once a command is receive and I found-out that it receive the 8byte character?

Does anybody in the community who can help me with this problem? Do I miss something especially the MSComm Object setup in VB. Is there an alternative Com object that is freeware which is better than the built-in MSComm object.

BTW, my setting is 115200, 8, N, 1

Thanx
Ttelmah
Guest







Re: PICmicro Serial Com with VB - Inquiry and Help
PostPosted: Sun Jan 23, 2005 8:23 am     Reply with quote

chingB wrote:
Hi,

I have a setup with a VB program that can sends command to my PICmicro!

My problem:
When I send a command to my PIC then it reply by sending 16byte character... when I debug my VB code I found out that the last three(4) character were not received.

With this I made an experiment... that my PIC will only send 8byte character once a command is receive and I found-out that it receive the 8byte character?

Does anybody in the community who can help me with this problem? Do I miss something especially the MSComm Object setup in VB. Is there an alternative Com object that is freeware which is better than the built-in MSComm object.

BTW, my setting is 115200, 8, N, 1

Thanx

MSCOMM, can a a bit of a pain. However given the loss of just the 'last' characters (I hope you mean that you send '16 characters', and '8 characters', an '8 byte character', would be sending 64bits at once...), it is possible that you are just running into the 'sleep' problem.
This is a commonly hit one on the PIC, where you must realise, that code like:
printf("Some text");
If using the hardware UART, will return to the caller, with three bytes still to send (this is because of the hardware buffering in the UART chip), and the code must ensure that the processor remains running to send these. If the instruction is placed at the end of 'main', because there is a hidden 'sleep' here, the processor will execute this, and not send the last three characters.
MSCOMM, lacks any ability to control the comm timeouts, and for some applications, this can be necessary, but generally for all it's problems, I'd suspect the fault is elsewhere.
Are you sure your crystal gives reasonable baud rate timings at 115200?. Unless you are using a crystal that is a nice even multiple of this rate, the bit rate error may be unacceptably high, and cause problems.

Best Wishes
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Sun Jan 23, 2005 9:44 am     Reply with quote

Post a small test program (PIC) the demonstrates the problem.
seegoon



Joined: 19 Jan 2005
Posts: 8

View user's profile Send private message

Re: PICmicro Serial Com with VB - Inquiry and Help
PostPosted: Tue Jan 25, 2005 1:15 am     Reply with quote

Hi there. I had a similar problem before. I was a buffer overflow problem in the PIC.
Check that you have the ,errors option in the use rs232(....) . This solved my problem. You can also manually check for errors and then clear.
Cheers
rob
Bill Boucher



Joined: 04 Feb 2005
Posts: 34
Location: Chatham,ON,CA

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Feb 04, 2005 3:17 pm     Reply with quote

In VB's mscomm, you can make sure there's no character in the "parity replace" property and set "NullDiscard" to none. Also, turn the handshaking off, set DTR & RTS & EOF to false.

From the PIC, you might want to try using only "putch" to send bytes instead of printf. Several other's on this forum had mentioned that although I can't say from experience myself if that matters.

Also, in VB, try using mscomm's "binary" mode. I find it works a lot smoother although you have to mess with arrays because you can't tx/rx strings. In "binary" mode, you can send any byte value from 0 to 255 as in text mode but there seems to be far fewer errors than in text mode.
jma_1



Joined: 08 Feb 2005
Posts: 147
Location: Wisconsin

View user's profile Send private message

another pc com solution
PostPosted: Tue Feb 08, 2005 2:41 pm     Reply with quote

Greetings,

There are other alternatives to VB that are relatively straight forward to use. My choices would be java (javax.comm package) or labview / labwindows. Labview / Labwindows can be downloaded from National Instruments (trial version). Labwindows might be a better choice -> directly create an executable. The java package is available directly from Sun and is free to use. If you want a java example, try the 'SimpleWrite' or 'SimpleRead' that comes with the javax.comm package. Both Windows & Linux version of the javax.comm package are available.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group