View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Apr 18, 2008 12:15 pm |
|
|
Try this improved version of your test program. Notice the several
changes. With this program, you can type in characters at your
serial terminal window (HyperTerminal) and watch it be sent back
by the PIC and displayed in the window.
Code: | #include <18F4520.H>
#fuses XT,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#int_rda
void rda_isr(void)
{
int8 c;
c = getc();
putc(c);
}
//========================
void main()
{
printf("Start: ");
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
while(1);
} |
|
|
|
AntonioB
Joined: 25 Oct 2007 Posts: 7 Location: Puebla Mexico
|
|
Posted: Mon Apr 21, 2008 10:10 am |
|
|
hi, well i already tried that but i didnt work, maybe its my computer, im going to check, because i do can send info from the pic to the PC but can't get the echo working, i'll post what i find once i know, thanks for the help. |
|
|
Matro Guest
|
|
Posted: Mon Apr 21, 2008 10:56 am |
|
|
In your #use rs232, set BIT, STOP and PARITY parameters to appropriate values.
Could you also post a quick description of your hardware?
Matro |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Apr 21, 2008 11:33 am |
|
|
Quote: | In your #use rs232, set BIT, STOP and PARITY parameters to appropriate values. |
You don't really have to do that. The CCS library defaults to 8 bits,
1 stop bit, and no parity. It's been that way for years. |
|
|
Matro Guest
|
|
Posted: Mon Apr 21, 2008 11:39 am |
|
|
PCM programmer wrote: | Quote: | In your #use rs232, set BIT, STOP and PARITY parameters to appropriate values. |
You don't really have to do that. The CCS library defaults to 8 bits,
1 stop bit, and no parity. It's been that way for years. |
I could agree with you if we knew the setting used by the poster. But here we don't know, so I did this proposal.
Matro. |
|
|
AntonioB
Joined: 25 Oct 2007 Posts: 7 Location: Puebla Mexico
|
|
Posted: Mon Apr 21, 2008 3:44 pm |
|
|
Hi there, yes im using for default 8 bits, 1 stop bit, 9600 baud rate, and none parity , but i still cant get the interruption to work, i dont know if the problem is my cable or what, because i already try a program that does an echo but using a CCS Kit, and it worked properly so the computer is working fine, i dont know what the problem is |
|
|
Gerhard
Joined: 30 Aug 2007 Posts: 144 Location: South Africa
|
|
Posted: Mon Apr 21, 2008 4:04 pm |
|
|
Can you give some more info on the hardware that you are using between the pic and the pc?
Are you using a max232 chip and so on. |
|
|
AntonioB
Joined: 25 Oct 2007 Posts: 7 Location: Puebla Mexico
|
|
Posted: Mon Apr 21, 2008 4:32 pm |
|
|
Hi there, yes I'm using a Max32, but I finally made it work, the problem was the cable!!!, I changed it and now is working verry good, thanks all for the help |
|
|
|