![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
I’m trying to capture hi low pulse timing & save them in a binary form. I have attached my drawing that how the pulse streams are coming. In every stream the timing is T & 2T length of pulses. If the high pulse is 2T then the binary must be 11 If the high pulse is T then the binary must be 1 If the low pulse is 2T then the binary must be 00 If the low pulse is T then the binary must be 0 I want to arrange like above format. Any idea how to do. No need code just tell me the idea. Do not suggest capture modules. Want to do it from a general I/O pin with a timer. Thanks | |
| |
| | #2 |
|
Seems simple.... Since T is the normL length the count every T if it's high the OR in a 1 and shift left if it's low AND in a 0 and shift left. If u do this in every T u will get everything correct
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #3 |
|
to clarify... let's assume T= 10 us When u start counting check if high if high then or in a one if low and in a Zero shift left by one wait 1T (10us) then check if high if so or a One if low And a zero shift left by one repeat until complete and It should be good
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics Last edited by AtomSoft; 27th October 2009 at 06:03 AM. | |
| |
| | #4 |
|
(edit) deleted; sorry I posted wrong code, i didn't read your question clearly.
Last edited by Mr RB; 27th October 2009 at 06:31 AM. | |
| |
| | #5 |
|
How long is "T" in uS? We have to know how much time you have for housekeeping. What PIC chip are you using? Use Timer0 or Timer1 | |
| |
| | #6 |
|
Hi for everybody thanks for the support you all giving. The input pulses varying from 200uS to 2000uS.For example T=450uS,2T=900uS so the whole string goes with those two values.On next string it can start from T=550,2T=1100uS. I'm using TMR0 I don't like TMR1. I can prescale & give inputs. | |
| |
| | #7 |
|
Ok I'll tell whats my method. First you wait for a mark pulse.When mark pulse detected turn on the TMR0.Wait until space pulse & when space pulse detect save the "Mark_Time" & reset TMR0.Wait until next mark pulse,when next mark pulse save the "Space_Time". Now we have two values."Mark_Time" & "Space_Time". Now subtract “Mark_Time” from "Space_Time". Check the carry bit status & arrange the result registers. Likewise on every after Period subtract “Mark_Time” from "Space_Time & arrange the result registers. The problem with my method is when both the mark & spaces equal the result will be wrong. Last edited by Suraj143; 27th October 2009 at 11:11 AM. | |
| |
| | #8 |
|
Why does the timing change from one string to the next string???
| |
| |
| | #9 |
|
We need a little more information, How many bits are involved in a transmission? Is the line low between bytes/words? Is there a change that signifies the start of a byte or could a zero (or two?) come first? Does a byte/word always contain 00,11,01&10 sequences? Mike. | |
| |
| | #10 | |
| Quote:
*Per transmission they are about 25-30 bits. *Those are not bytes those are just high low pulses. *The start of a string always 1(T) or 11(2T) To detect end of the frame I'm checking the "space time" has gone above 2000uS.because the maximum T is 2000uS.So I can identify the frame is end or not. Mike as you understand lets assume you get 2T “Mark Time” & a 2T “Space Time” on start of the frame. According to my method if I just subtract “Mark Time” from “Space Time” It will be “10” format. But it should be “1100”.Now see the error. I think you understood now. | ||
| |
| | #11 |
|
I think you need to capture the whole data stream as a series of time values and look for the shortest pulse to work out the "baud" rate. If you are not guaranteed that the stream will contain a single T pulse then you will have to assume that the time for the shortest pulse that you received is a single T and see how many bits you have. If the bit count is less than 25 then recalculate with T=T/2. Mike. | |
| |
| | #12 | |
| Quote:
I'm trying to make a universal Infrared Remote Decoder.I need to store particular remote incoming data & compares the same remote code is coming on next time. I'm ignoring start bit & the first space time.After that only I'm capturing incoming data.If you study all remote codes based on T & 2T format. Many will tell that you can't make a UIR decoder.But at least I can make a one working for many remotes but not for all. Any method to capture those stream. | ||
| |
|
| Tags |
| capturing, code, high, low, problem, pulses |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Logic high/low | carlson | Electronic Projects Design/Ideas/Reviews | 4 | 14th June 2009 07:02 AM |
| low noise, high gain, low frequency amplifier | max1000000 | Electronic Projects Design/Ideas/Reviews | 2 | 29th June 2007 09:10 PM |
| converting active low pulses to DC | ikalogic | Electronic Projects Design/Ideas/Reviews | 4 | 16th April 2007 11:50 AM |
| Capturing high frequency pulses | Reynard | General Electronics Chat | 24 | 11th September 2006 04:29 PM |
| Simpel code for registrating high/Low on input pins | gobbles | Micro Controllers | 0 | 26th September 2005 03:57 PM |