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 support@ccsinfo.com

MScomm1 with PICC

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







MScomm1 with PICC
PostPosted: Wed Mar 28, 2007 2:27 am     Reply with quote

I am writing a code in PICC to receive RS232 data 9600,N,8,1 from Visual Basic 5 or 6. I am using the simple PICC command:

if (InByte = 0X02)
{
putc(0x0A);
delay_us (700);
Temp = InByte ; // both are bytes char
}

to receive data via RS232 in PICC. What Visual Basic command code should I use to send InByte from within VB? How it should be defined?

How about sending from PICC and receiving from VB?

I am using MSComm1 VB command.
Ttelmah
Guest







PostPosted: Wed Mar 28, 2007 2:52 am     Reply with quote

First comment. Nothing you show in the posted code, _receives_ characters, yet you say you are using this 'to receive data via RS232 in PICC'...
Look at getc.
You are already 'sending data'. This is what _putc_ does...
The MSCOMM control in VB, is not the greatest serial handler around (it explains a lot of serial problems in application!), but can work well if handled carefully. There are two different setup 'modes' for the control (text or binary). Probably the easiest to use, will be 'text', and if you have the control called 'MSCom', set in this mode, then:

MSCom.output = chr$(&H0A)

Will send the same decimal '10' character, as the putc(0xa) shown in your C.

Best Wishes
davekelly



Joined: 04 Oct 2006
Posts: 53
Location: Berkshire, England

View user's profile Send private message

Re: MScomm1 with PICC
PostPosted: Wed Mar 28, 2007 7:43 am     Reply with quote

sonya27y wrote:

if (InByte = 0X02)
{
putc(0x0A);
delay_us (700);
Temp = InByte ; // both are bytes char
}



Another small comment: the test for equality should use '==', else it is an assignment. ie use
Code:

if (InByte == 0X02)
{
...
}
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