|
|
View previous topic :: View next topic |
Author |
Message |
young
Joined: 24 Jun 2004 Posts: 285
|
How to check if RCV port receives expecting signal? |
Posted: Thu Aug 05, 2004 2:07 pm |
|
|
I developed a GUI using vc++ to send char data to com port, but I could not get the expecting event, for example, I send 'a' to the chip, the chip will check if it is 'a' if it is 'a' send something back. I was being able to see the expected result by using hyperterminal, but I could not see result by my GUI. I need to find out what is send from my GUI. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Aug 05, 2004 5:29 pm |
|
|
Sounds like your GUI doesn't work! |
|
|
Guest
|
|
Posted: Fri Aug 06, 2004 6:08 am |
|
|
I did receive correct data from the chip, just sending! |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Fri Aug 06, 2004 6:17 am |
|
|
Well if Hyperterminal receives it correctly, then the chip must be sending it correctly. |
|
|
Guest
|
|
Posted: Fri Aug 06, 2004 6:46 am |
|
|
Yes, the chip receive and send correct right, there is no problem with the chip, in the hyperterminal, when I hit 'a' the return letter is 'b' everything works fine.
Code: |
#if defined(__PCM__)
#include <12f675.h>
#fuses INTRC_IO,NOWDT,NOPROTECT,PUT,NOMCLR
#use delay(clock=4000000)
#use rs232(baud=9600, parity=N, xmit=PIN_A5, RCV=PIN_A3)
void produce_pwm(int8 duty);
void main()
{
setup_comparator(NC_NC_NC_NC);
while(1) {
putc(getc()+1);
output_high(PIN_A0);
}
} |
In my GUI, I click a button, the button start a event to sent data 'a' to co mm, but nothing happened.
my button function is
Code: |
void CSerialView::OnBnClickedStart()
{
COleVariant var(_T("a"));
m_comm.put_Output(var);
} |
what is wrong with it? |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Fri Aug 06, 2004 7:03 am |
|
|
Have no idea. This is a CCS forum. I would suggest looking on the NET for some examples of sending serial data using Visual C. |
|
|
Ttelmah Guest
|
|
Posted: Fri Aug 06, 2004 7:09 am |
|
|
Anonymous wrote: | Yes, the chip receive and send correct right, there is no problem with the chip, in the hyperterminal, when I hit 'a' the return letter is 'b' everything works fine.
Code: |
#if defined(__PCM__)
#include <12f675.h>
#fuses INTRC_IO,NOWDT,NOPROTECT,PUT,NOMCLR
#use delay(clock=4000000)
#use rs232(baud=9600, parity=N, xmit=PIN_A5, RCV=PIN_A3)
void produce_pwm(int8 duty);
void main()
{
setup_comparator(NC_NC_NC_NC);
while(1) {
putc(getc()+1);
output_high(PIN_A0);
}
} |
In my GUI, I click a button, the button start a event to sent data 'a' to co mm, but nothing happened.
my button function is
Code: |
void CSerialView::OnBnClickedStart()
{
COleVariant var(_T("a"));
m_comm.put_Output(var);
} |
what is wrong with it? |
Realistically, the 'odds' are that it is something like the baud rate not being setup correctly for the com control (remember this is seperate from the settings used by hyperterminal). Assuming you have a second com port on the machine, make a 'crossover' cable, that takes the transmit output from your program, and routes it to the input pin on the other port. Setup hyperterm to look at the other port, and you will see if anything is sent. You will then be able to see if it is a failure to send, or perhaps a baud rate setting. If it is a failure to send, then look at the 'hanshaking' settings for the com control. If these are on and set to 'hardware', the port won't send without seeing a 'ready' signal. An RS232 'breakout' box, will give the ability to see what the signals are doing, if it is available.
Best Wishes |
|
|
Guest
|
|
Posted: Fri Aug 06, 2004 7:20 am |
|
|
Thank you, I solved it. The problem with my program is that I have to function relative to the button, and one is default, that one does not have send data function, so, it does not work. |
|
|
|
|
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
|