|
|
View previous topic :: View next topic |
Author |
Message |
chava
Joined: 07 Sep 2003 Posts: 56
|
Urgent: Communicating PIC to PC |
Posted: Thu Feb 05, 2004 8:01 am |
|
|
Hello
I have a PICDEM2 PLUSE board in my house and I connected it to the PC.
I assembled a PIC16f877a on the PICDEM2 PLUSE and wrote a simple program to send data to the PC via the RS232 connector (which is on the picdem2 pluse board).
BUT every time I activate the pic program, the PC stops to respond and I have to reboot it
note:
1. what I did is - I placed the PIC on another board and connected only the lines related to the Power supply, MCLR, RS232 communication and the LCD to the picdem2pluse.
then I saw that I connected C5,C6 instead of C6, C7 ( on both connctions, the PIC transmitted to the PC when the hyper terminal works).
I fixed it but nothing changed.
2. I run the pic when the hyper terminal is active - and it works good. when the hyper terminal is not connected, the pc stops to respond the minute I press "debugger --> run "(in the mplab menue)
3. I once did activated the pic that way and I succeeded to make the communication but it was with a nother pic program
Does any of you have a clue - what is the problem? why the PC stops to respond (nothing works, no mouse, no keyboard, no respond to ctrl+alt+del )
what may be the problem?
Jukin Chava
E2D
Electronic Embedded Development |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Thu Feb 05, 2004 10:37 am |
|
|
Are you running Hyperterminal on the same PC as the debugger?
A couple of suggestions in order of preference:
1) Find a "dumb terminal" to view the serial output instead of a PC.
2) Don't use Hyperterminal, it sucks. Instead use SIO that comes with the compiler or better yet "terminal" which can be found at:
http://bray.velenje.cx/avr/terminal
3) Close the debugger while running whichever terminal program you choose. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 05, 2004 11:28 am |
|
|
Post a very short program that demonstrates the problem.
Strip out all unessential code, and leave in only the code that
causes the problem. Also, post all pre-processor statements
in your program, such as #use delay, #fuses, ICD=TRUE, etc.
Tell us what debugger you are using. That's the key to the
whole problem. It's not "PIC can't talk to PC", it's more like
"My ICD2 locks up my PC when I run my program. Help,
I have an ICD2 problem".
So, we need the full truth, to work on it for you.
Also, you should update all the software that you are using.
Update MPLAB. Update the internal ICD2 firmware, etc. |
|
|
chava
Joined: 07 Sep 2003 Posts: 56
|
|
Posted: Thu Feb 05, 2004 4:33 pm |
|
|
Hi, Tanks for the reply
I use PCM 3.178
MPLAB 6.
ICD2
PICDEM2 PLUSE board
win xp- home edition
when I add the lines: "putc('p');
puts("string to pc");"
and activate the program (running the mplab under debugging ICD2)
the PC stops to respond (no respond to mouse, no keyboard, no alt+ctrl+del, not even an error message from windows to inform me that a program was endded due to an unautorized action.)
I did that when the Hyper terminal is active and I saw the data ("pstring to pc" on the hyper terminals' window.the pc didnt stop to respond when the hyper terminal was active.
I thougth that it may have something to do with the RS232 bufer been full... or something like that.
here is the code
Code: |
#include "E:\chava\ccs_header\16f877a.h"
#fuses XT,NOWDT,NOPROTECT,PUT,BROWNOUT
#device ICD=TRUE
#use DELAY (CLOCK=4000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,parity=N,bits=8)
void rs232_init(){
set_uart_speed(9600);
}
void main(void){
option_reg=RBPU_OFF | T0CS_INT | PSA_T0 | PS_7;
rs232_init();
lcd_init();
putc('p');//those two lines making the problem
puts("string to pc");// without those line the pc not stop to respond
while (1){
}
}
|
tanks
Chava
E2D
Electronic Embedded Development
jukingh@zahav.net.il |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Feb 06, 2004 12:05 pm |
|
|
I think the problem must either be in your O/S or in MPLAB/ICD2.
You didn't give your exact version of MPLAB.
I think the best course of action is to install the latest version of MPLAB,
and then install the latest ICD2 firmware (which comes with MPLAB). |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Feb 08, 2004 3:03 pm |
|
|
What version of MPLAB are you using ?
We have a Win2K system at our company, and we tried to
use ICD2 and MPLAB 6.42 on it. It acted in a very flakey way.
It would lock up, and the mouse would stop working.
This was just during normal debugging. We were not trying
to use the serial port for communications, as you were doing.
We un-installed MPLAB vs. 6.42, and installed vs. 6.40, and
it seems to be much more stable. Since Win2K is similar
to XP, I suggest that you try this. |
|
|
chava
Joined: 07 Sep 2003 Posts: 56
|
|
|
|
|
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
|