![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
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 |
|
|
|
|
|
|
(permalink) |
|
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. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
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. |
||
|
|
|
|
|
(permalink) | ||
|
Quote:
Quote:
|
|||
|
|
|
|
|
(permalink) | ||||
|
Quote:
Quote:
Quote:
Quote:
|
|||||
|
|
|
|
|
(permalink) | |
|
Quote:
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. |
||
|
|
|
|
|
(permalink) | |
|
Quote:
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... |
||
|
|
|
|
|
(permalink) |
|
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 |
|
|
|
|
|
|
(permalink) |
|
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.
|
|
|
|
|
|
|
(permalink) | ||
|
Quote:
If you really see a stable 0V signal we can forget the noise thing suggested by Philba. Quote:
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? |
|||
|
|
|
|
|
(permalink) |
|
good suggestion on using a terminal program.
he should also try running the java ap with out the pic connected at all. |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| 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 |