Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 4th October 2006, 05:42 PM   (permalink)
Default Somthing Wrong

hello all,

i have a small question , i use pic16f877a and get signal from function generator to computer at a certain time (about 640 Hz) , its work ok at first then it begin to display wrong data unless i get the power off from the pic then return it it work probably again then the same problem occur , and another thing i observed it that the computer still get data from the port after the pic is turned off in about 5-6 sec ,
Why these two actioin occur i hope you help me
thnxs
note : i use TIMER1 to set 640 Hz
Eng.Abbasi is offline   Reply With Quote
Old 4th October 2006, 06:20 PM   (permalink)
Default

I hate to nit-pick on grammer and language ability but this is a case where I simply do not follow what you are trying to communicate.

From your question it sounds like you are using a PIC to determine the frequency of a signal from a function generator and then displaying that frequency on a PC. In your "note", you go on to say that you use TIMER1 to set 640Hz which has nothing to do with your question.

If you are using your hardware UART and you start having transmission problems over time then the issue must be in your code. Until people can see it, there is no way to know what you might have done wrong.

Depending on the power draw of your circuit and the capacity of the filter/decoupling capacitors of your project, it is quite possible for it to run sever seconds after unplugging the power supply.

Can you restate what your project is with better clarity?

Last edited by phalanx; 4th October 2006 at 06:24 PM.
phalanx is offline   Reply With Quote
Old 5th October 2006, 05:37 AM   (permalink)
Default

Quote:
Originally Posted by phalanx
Depending on the power draw of your circuit and the capacity of the filter/decoupling capacitors of your project, it is quite possible for it to run sever seconds after unplugging the power supply.
5 to 6 sec is a verry loooooong time unless you have a huge capacitor.

Another possibility is that his PC software can't catch up with the PIC datarate filling the PC UART buffer.
Once the PIC is powered off, the PC software continue to read from the buffer until it's empty what takes 5 to 6 sec.
mcs51mc is offline   Reply With Quote
Old 5th October 2006, 07:17 AM   (permalink)
Default

Quote:
Originally Posted by Eng.Abbasi
Works ok at first then it begins to display wrong data...
Something is getting hot. Check Fuction Generator interface to PIC.
Quote:
Originally Posted by Eng.Abbasi
Computer still gets data from the port after the PIC is turned off for about 5-6 sec...
The signal from the Function Generator is leaking through other circuits to keep the PIC powered. Again, this is a problem with your interface. You are driving the PIC input too hard. Make the input resistor larger.
keithK is offline   Reply With Quote
Old 5th October 2006, 09:06 AM   (permalink)
Default

Quote:
Originally Posted by phalanx
From your question it sounds like you are using a PIC to determine the frequency of a signal from a function generator and then displaying that frequency on a PC.
you got it wrong, I say that i have a signal from function generator and i displayed it on the PC using pic16f877a .

Quote:
Originally Posted by phalanx
In your "note", you go on to say that you use TIMER1 to set 640Hz which has nothing to do with your question.
i dont write this Information for nothing , i think that its hard for the PC program to keep up with the speed of data out of the pic and so after an interval of time the data was displayed wrong (perhaps i should use multithreating to get the data from the serial port and at the same time plot it on the PC) .

Quote:
Originally Posted by phalanx
If you are using your hardware UART and you start having transmission problems over time then the issue must be in your code. Until people can see it, there is no way to know what you might have done wrong.
ok i dont mind , but i tried my software with a constant analog values and its work ok without problems , i'll attach my code.

Quote:
Originally Posted by keithK
Something is getting hot. Check Fuction Generator interface to PIC.
i dont think so becuase at the same time i display the signal on oscilloscope and there wasn't any problem.
Attached Files
File Type: txt pic.txt (2.3 KB, 19 views)
Eng.Abbasi is offline   Reply With Quote
Old 6th October 2006, 05:56 AM   (permalink)
Default

Quote:
Originally Posted by Eng.Abbasi
I don't think so because at the same time I display the signal on oscilloscope and there wasn't any problem.
I suspect a problem with grounds. The ground of the Signal Generator, PIC, and PC are at different potentials. Did you tie them together?
You said the PIC sends data for 6 seconds after power off. Why? Find the source of this voltage, and I think you'll find the cause of the other problem.
There is a back-circuit somewhere.
I believe the output of the signal generator has several ma of drive. You power off the PIC, but the power from the Signal Generator leaks back to the +5 of the PIC via it's internal op-amp.
You shouldn't have power to the PIC inputs when +5 is dropped. The high signals will leak back internally in the PIC and keep it powered.
The scenarios above may not be totally accurate, but I'm sure it's something along these lines.
keithK is offline   Reply With Quote
Old 6th October 2006, 10:23 AM   (permalink)
Talking Many questions...

Quote:
Originally Posted by keithK
You said the PIC sends data for 6 seconds after power off. Why? Find the source of this voltage, and I think you'll find the cause of the other problem.
He didn't said that!
He wrote " ... ... the computer still get data ... ..." but we don't know where the data, after power down the PIC, is coming from.
Is it really from the PIC or is it from the serial comm buffer? We don't know yet!

Put the scope on the RS232 line and check for signals after you power down the PIC. That way you will know if the PIC is still sending, like keithK suggested.

What code is running on your PC? What's your baud rate? How do you send data ASCII, binary?

You wrote that it works fine with constant analog values. That's wierd because software don't care for DC or AC signals unless.......

What's the peak to peak value of the signal from the function generator?
Is it AC or DC?
In case of AC, does the negative alternation goes below 0V, GND level?
Does the PIC like that (I don't know PIC's hardware, shame on me...)

Many questions I know but only then we maybe solve your problem...
mcs51mc is offline   Reply With Quote
Old 16th October 2006, 03:41 PM   (permalink)
Default

im sorry for being very late
but after many tries i discovered that the pic has nothing to do with this problem , it's 90% that the problem is from my java program becuase my java class still get data when i turn off the pic and if i measure the output of the pic there is nothing .

so of any one tried before interfacing with serial port by java , i appreciate if he told me

thanks all
Eng.Abbasi is offline   Reply With Quote
Old 16th October 2006, 04:52 PM   (permalink)
Default

assuming your java code isn't introducing the mystery data, I suspect you are picking up noise on your serial cable. powered off devices don't usually send data. otherwise, follow msc51mc's advice.
philba is offline   Reply With Quote
Old 18th October 2006, 10:26 AM   (permalink)
Default

Quote:
Originally Posted by Eng.Abbasi
... ... when i turn off the pic and if i measure the output of the pic there is nothing .
You placed a scoop on the TXD, RXD lines between PIC and PC and saw nothing at all while your PC still gets data. Is that what you did or did you use a multimeter ?

If you really see a stable 0V signal we can forget the noise thing suggested by Philba.


Quote:
Originally Posted by Eng.Abbasi
...so of any one tried before interfacing with serial port by java , i appreciate if he told me thanks all
Never did, always used VB or LabView with 8031 µP, never had problems like yours.



A few new questions. Hopefully you will answer this ones...
1) The data you receive after power down the PIC, is it correct data?
I mean if you generate a square wave, I suppose you get data from which you can rebuild a square wave in your java application, what about the data received while the PIC is powered down? Can you still make a square wave out of it?
If yes, I think that's data stored in a buffer somewhere on the PC side, so nothing to worry about (unless you buffer overflows in time, but that's for later... ...).
If no, Philba's noise thing is back on track or ... ...

2) Can you use Hyperterminal to see if you have the same issues?
mcs51mc is offline   Reply With Quote
Old 18th October 2006, 03:19 PM   (permalink)
Default

good suggestion on using a terminal program.

he should also try running the java ap with out the pic connected at all.
philba is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
What's wrong with my H-bridge drivers? user1453 General Electronics Chat 22 13th August 2006 05:07 AM
PICAXE-08M, whats wrong with it....(picture) rancid rock Electronic Projects Design/Ideas/Reviews 16 3rd July 2006 08:05 AM
Am i wrong here Megamox General Electronics Chat 18 23rd December 2005 10:54 PM
Oh so nearly completed - what have I done wrong here? CNO81 General Electronics Chat 2 25th August 2003 10:24 PM
Hmm what's wrong? daviddoria General Electronics Chat 10 27th March 2003 07:24 PM



All times are GMT. The time now is 11:23 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.