Sign in

username:

password:



Not a member?

Search rabbit-semi



Search tips

Subscribe to rabbit-semi



Ads

Discussion Groups

Discussion Groups | Rabbit-Semi | Saving time of signal

This is a group for folks designing and programming embedded systems using the Rabbit Semiconductor C-programmable microcontroller. Rabbit Semi is a spin-off from Z-World who makes a variety of embedded modules and tools. This group is not affiliated with either Rabbit or Z-World, but is a user forum for sharing ideas, asking questions, flaunting knowledge, and other typical user group stuff. The Rabbit is a powerful uC, supported by a full-featured C-compiler.

Saving time of signal - Omar - May 7 8:46:27 2008

Hello,
I need to save in memory the length of time in which a Pin input port
is in the low o high state.

for example this signal.

___-----___---_------________--__

I need toggle an output port with this same signal latter by reading
the times of each state from memory.

Can you get me some idea how can I make this ?

Thank you in advance.
------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )


Re: Saving time of signal - dtriskel - May 7 9:12:22 2008

Read and save initial time (MS_TIMER) and initial status of the input.
Read and save MS_TIMER everytime there's a change in the input.

So then you have length duration for every state and value for every time.

You could also save status for every change. Even though it is
redundant it is also safer.

--- In r...@yahoogroups.com, "Omar" wrote:
>
> Hello,
> I need to save in memory the length of time in which a Pin input port
> is in the low o high state.
>
> for example this signal.
>
> ___-----___---_------________--__
>
> I need toggle an output port with this same signal latter by reading
> the times of each state from memory.
>
> Can you get me some idea how can I make this ?
>
> Thank you in advance.
>

------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )

Re: Saving time of signal - Omar - May 7 10:09:22 2008

Thank you ! I have another question (relationated with this project).
How can I create a square signal of 20 Khz (for example) and put this
into a output port.?

Thank you again.

--- In r...@yahoogroups.com, "dtriskel" wrote:
>
> Read and save initial time (MS_TIMER) and initial status of the input.
> Read and save MS_TIMER everytime there's a change in the input.
>
> So then you have length duration for every state and value for every
time.
>
> You could also save status for every change. Even though it is
> redundant it is also safer.
>
> --- In r...@yahoogroups.com, "Omar" wrote:
> >
> > Hello,
> > I need to save in memory the length of time in which a Pin input port
> > is in the low o high state.
> >
> > for example this signal.
> >
> > ___-----___---_------________--__
> >
> > I need toggle an output port with this same signal latter by reading
> > the times of each state from memory.
> >
> > Can you get me some idea how can I make this ?
> >
> > Thank you in advance.
>
------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )

Re: Saving time of signal - dtriskel - May 8 4:03:02 2008

That's beyond my knowledge at the moment. Look for pwm related topics.
As far as I remember frequency below 56KHz cannot be obtained directly
but using some tricks (or at least it is true for some rabbit cores).
Anyway I can't help you with this.

--- In r...@yahoogroups.com, "Omar" wrote:
>
> Thank you ! I have another question (relationated with this project).
> How can I create a square signal of 20 Khz (for example) and put this
> into a output port.?
>
> Thank you again.
>
> --- In r...@yahoogroups.com, "dtriskel" wrote:
> >
> > Read and save initial time (MS_TIMER) and initial status of the input.
> > Read and save MS_TIMER everytime there's a change in the input.
> >
> > So then you have length duration for every state and value for every
> time.
> >
> > You could also save status for every change. Even though it is
> > redundant it is also safer.
> >
> > --- In r...@yahoogroups.com, "Omar" wrote:
> > >
> > > Hello,
> > > I need to save in memory the length of time in which a Pin input
port
> > > is in the low o high state.
> > >
> > > for example this signal.
> > >
> > > ___-----___---_------________--__
> > >
> > > I need toggle an output port with this same signal latter by reading
> > > the times of each state from memory.
> > >
> > > Can you get me some idea how can I make this ?
> > >
> > > Thank you in advance.
> > >
>
------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )

Re: Saving time of signal - "eng.mzaki" - May 8 17:18:32 2008

to dtriskel
why " below 56KHz cannot be obtained "
what is wrong if he uses Delaysec function like
waitfor(DelaySec(2L)) which give .5 hz

--- In r...@yahoogroups.com, "dtriskel" wrote:
>
> That's beyond my knowledge at the moment. Look for pwm related
topics.
> As far as I remember frequency below 56KHz cannot be obtained
directly
> but using some tricks (or at least it is true for some rabbit
cores).
> Anyway I can't help you with this.
>
> --- In r...@yahoogroups.com, "Omar" wrote:
> >
> > Thank you ! I have another question (relationated with this
project).
> > How can I create a square signal of 20 Khz (for example) and put
this
> > into a output port.?
> >
> > Thank you again.
> >
> > --- In r...@yahoogroups.com, "dtriskel" wrote:
> > >
> > > Read and save initial time (MS_TIMER) and initial status of the
input.
> > > Read and save MS_TIMER everytime there's a change in the input.
> > >
> > > So then you have length duration for every state and value for
every
> > time.
> > >
> > > You could also save status for every change. Even though it is
> > > redundant it is also safer.
> > >
> > > --- In r...@yahoogroups.com, "Omar" wrote:
> > > >
> > > > Hello,
> > > > I need to save in memory the length of time in which a Pin
input
> port
> > > > is in the low o high state.
> > > >
> > > > for example this signal.
> > > >
> > > > ___-----___---_------________--__
> > > >
> > > > I need toggle an output port with this same signal latter by
reading
> > > > the times of each state from memory.
> > > >
> > > > Can you get me some idea how can I make this ?
> > > >
> > > > Thank you in advance.
> > > >
> > >
>
------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )

Re: Re: Saving time of signal - Scott Henion - May 8 17:35:35 2008

Omar wrote:
> Thank you ! I have another question (relationated with this project).
> How can I create a square signal of 20 Khz (for example) and put this
> into a output port.?
>
Set a serial port for sync mode but don't clear the data ports or status
reg. It will output a continuous clock:
http://shdesigns.org/tips/genclock.shtml

Sounds like you are wanting to sample a infrared remote and them play
back. You could use the input capture and measure high/low times. But at
the higher freqs the rabbit will be too slow to save the data.

Another option is to set up a clocked serial port. Start sampling
continuously and store into a large buffer. You can then just play it
back by sending it out the port.

Most IR signals are 20-40khz pulses. If you add external decode logic to
remove the 40khz signal (simple retriggerable FF,) you can then just
record the data part. The to generate the signal, set up a serial port
as clocked to generate a clock, then feed through an AND gate with the
data. That will regenerate the 40khz modulated signal and you will be
storing only the low-frequency part.

--
------------------------------------------
| Scott G. Henion| s...@shdesigns.org |
| Consultant | Stone Mountain, GA |
| SHDesigns http://www.shdesigns.org |
------------------------------------------
Rabbit libs: http://www.shdesigns.org/rabbit/
today's fortune
Programmers do it bit by bit.
------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )

Re: Saving time of signal - dtriskel - May 9 3:52:53 2008

Sounds to me I've read that in some pwm related topics. But I've never
used them so better don't listen to my words because as I said before
that's beyond my knowledge, and I'll probably misleading you
unintentionally.

On the other hand as far as I know waitfor(DelaySec(2L)) would wait 2
seconds until next operation (in the same costatement) but you have to
add time wasted in executing the operations.

Example:

costate
{
Do something that lasts 1 second
Switch output state
waitfor( DelaySec(2L));
}

Output state will be switched every 3 seconds (aprox.). That's 2
seconds waiting + 1 second doing something + time cost for switching
output.

--- In r...@yahoogroups.com, "eng.mzaki" wrote:
>
> to dtriskel
> why " below 56KHz cannot be obtained "
> what is wrong if he uses Delaysec function like
> waitfor(DelaySec(2L)) which give .5 hz
>
> --- In r...@yahoogroups.com, "dtriskel" wrote:
> >
> > That's beyond my knowledge at the moment. Look for pwm related
> topics.
> > As far as I remember frequency below 56KHz cannot be obtained
> directly
> > but using some tricks (or at least it is true for some rabbit
> cores).
> > Anyway I can't help you with this.
> >
> > --- In r...@yahoogroups.com, "Omar" wrote:
> > >
> > > Thank you ! I have another question (relationated with this
> project).
> > > How can I create a square signal of 20 Khz (for example) and put
> this
> > > into a output port.?
> > >
> > > Thank you again.
> > >
> > > --- In r...@yahoogroups.com, "dtriskel" wrote:
> > > >
> > > > Read and save initial time (MS_TIMER) and initial status of the
> input.
> > > > Read and save MS_TIMER everytime there's a change in the input.
> > > >
> > > > So then you have length duration for every state and value for
> every
> > > time.
> > > >
> > > > You could also save status for every change. Even though it is
> > > > redundant it is also safer.
> > > >
> > > > --- In r...@yahoogroups.com, "Omar" wrote:
> > > > >
> > > > > Hello,
> > > > > I need to save in memory the length of time in which a Pin
> input
> > port
> > > > > is in the low o high state.
> > > > >
> > > > > for example this signal.
> > > > >
> > > > > ___-----___---_------________--__
> > > > >
> > > > > I need toggle an output port with this same signal latter by
> reading
> > > > > the times of each state from memory.
> > > > >
> > > > > Can you get me some idea how can I make this ?
> > > > >
> > > > > Thank you in advance.
> > > > >
> > > >
> > >
>
------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )

TCP/IP basic - Matias Cordero - May 9 8:24:52 2008


Hello,

Does any body know how could I send and recieve data via tcp whithout
using ftp or http? I must send some values to a computer which sholud draw
these on a picture. This is a .Net software. Is it possible ? I mean, can I
say this is for computer 1 so i put the data in a packet and send it.
Thank you for hearing and helping.

Matsss



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )

Re: Saving time of signal - Omar - May 9 12:13:57 2008

--- In r...@yahoogroups.com, Scott Henion wrote:
>
> Omar wrote:
> > Thank you ! I have another question (relationated with this project).
> > How can I create a square signal of 20 Khz (for example) and put this
> > into a output port.?
> >
> Set a serial port for sync mode but don't clear the data ports or status
> reg. It will output a continuous clock:
> http://shdesigns.org/tips/genclock.shtml
>
> Sounds like you are wanting to sample a infrared remote and them play
> back. You could use the input capture and measure high/low times. But at
> the higher freqs the rabbit will be too slow to save the data.
>
> Another option is to set up a clocked serial port. Start sampling
> continuously and store into a large buffer. You can then just play it
> back by sending it out the port.
>
> Most IR signals are 20-40khz pulses. If you add external decode logic to
> remove the 40khz signal (simple retriggerable FF,) you can then just
> record the data part. The to generate the signal, set up a serial port
> as clocked to generate a clock, then feed through an AND gate with the
> data. That will regenerate the 40khz modulated signal and you will be
> storing only the low-frequency part.
>
> --
> ------------------------------------------
> | Scott G. Henion| shenion@... |
> | Consultant | Stone Mountain, GA |
> | SHDesigns http://www.shdesigns.org |
> ------------------------------------------
> Rabbit libs: http://www.shdesigns.org/rabbit/
> today's fortune
> Programmers do it bit by bit.
>

Yes, Scott it is for record the Remote control data for play into out
port latter.
I have read the sample in the link you have send. I understand how
commands sets the input and outputs of serial ports, but I do no
understand how read "pulses" instead of characters and which
statements I need use.
I read characters with serXread() por example and save the remote
control in char format ?.
Can you help me to clarify this ?

Thank you very much

------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )

Re: Re: Saving time of signal - Scott Henion - May 9 12:37:01 2008

Omar wrote:
> --- In r...@yahoogroups.com, Scott Henion wrote:
>
>> Omar wrote:
>>
>>> Thank you ! I have another question (relationated with this project).
>>> How can I create a square signal of 20 Khz (for example) and put this
>>> into a output port.?
>>>
>>>
>> Set a serial port for sync mode but don't clear the data ports or status
>> reg. It will output a continuous clock:
>> http://shdesigns.org/tips/genclock.shtml
>>
>> Sounds like you are wanting to sample a infrared remote and them play
>> back. You could use the input capture and measure high/low times. But at
>> the higher freqs the rabbit will be too slow to save the data.
>>
>> Another option is to set up a clocked serial port. Start sampling
>> continuously and store into a large buffer. You can then just play it
>> back by sending it out the port.
>>
>> Most IR signals are 20-40khz pulses. If you add external decode logic to
>> remove the 40khz signal (simple retriggerable FF,) you can then just
>> record the data part. The to generate the signal, set up a serial port
>> as clocked to generate a clock, then feed through an AND gate with the
>> data. That will regenerate the 40khz modulated signal and you will be
>> storing only the low-frequency part.
>>
>> --
>> ------------------------------------------
>> | Scott G. Henion| shenion@... |
>> | Consultant | Stone Mountain, GA |
>> | SHDesigns http://www.shdesigns.org |
>> ------------------------------------------
>> Rabbit libs: http://www.shdesigns.org/rabbit/
>> today's fortune
>> Programmers do it bit by bit.
>>
>>
>
> Yes, Scott it is for record the Remote control data for play into out
> port latter.
> I have read the sample in the link you have send. I understand how
> commands sets the input and outputs of serial ports, but I do no
> understand how read "pulses" instead of characters
Syncronous serial on the rabbit outputs 8 clocks and samples the RX pin.
There are no start or stop bits. It assumes you have already
synchronized the data.

When used to sample an input, it will read 8 samples and store in a
byte. Then you only have to store each byte rather than code to sample a
bit at a time. It is like a 1-bit logic analyzer. Would be a lot of
data, but could easily be compressed. For example:

0xf0 // low bit is first sample
0xff
0xff
0x07
0x00
0x00
0xf0

could be stored as 4,23,25,4 (4 0's, 23 1's, 25 0's, 4 1's.)
> and which
> statements I need use.
> I read characters with serXread() por example and save the remote
> control in char format ?.
> Can you help me to clarify this ?
>

You would have to set up the serial port for sync mode by writing to the
control registers. Then in a tight loop, write to the control register
to start a read, wait for data then start another read and read the
serial port data register.

You can not use the DC serial routines they are for async serial ports.

If you add hardware to remove the carrier, then you could probably use
the input capture logic to measure pulse widths and store a list of
high/low times.
--
------------------------------------------
| Scott G. Henion| s...@shdesigns.org |
| Consultant | Stone Mountain, GA |
| SHDesigns http://www.shdesigns.org |
------------------------------------------
Rabbit libs: http://www.shdesigns.org/rabbit/
today's fortune
Mr. Universe: "You guys always bring me the very best violence."



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )

Re: Saving time of signal - "eng.mzaki" - May 9 14:06:52 2008

no one commnted what i said about generating square wave

when some one here said
" below 56KHz cannot be obtained " what is wrong if he uses Delaysec
function like waitfor(DelaySec(2L)) which give .5 hz ... topics.

--- In r...@yahoogroups.com, "Omar" wrote:
>
> Hello,
> I need to save in memory the length of time in which a Pin input
port
> is in the low o high state.
>
> for example this signal.
>
> ___-----___---_------________--__
>
> I need toggle an output port with this same signal latter by reading
> the times of each state from memory.
>
> Can you get me some idea how can I make this ?
>
> Thank you in advance.
>

------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )

Re: Saving time of signal - mehiegl - May 9 15:16:45 2008

I believe the comment stating a limit of 56kHz was aimed at using the
PWM to generate a square wave, not in software. The original
question was how to generate a 20 kHz square wave. The limit on the
PWM frequency depends on what core is being used since there are
several different clock rates among the various 3000 cores.

Your solution is a software solution that works for slow signals but
would not be practical to use for what the original question was
about. The better approach is to use a timer, or serial port clock as
Scott suggested.

Mark

--- In r...@yahoogroups.com, "eng.mzaki" wrote:
>
> no one commnted what i said about generating square wave
>
> when some one here said
> " below 56KHz cannot be obtained " what is wrong if he uses
Delaysec
> function like waitfor(DelaySec(2L)) which give .5 hz ... topics.
>
> --- In r...@yahoogroups.com, "Omar" wrote:
> >
> > Hello,
> > I need to save in memory the length of time in which a Pin input
> port
> > is in the low o high state.
> >
> > for example this signal.
> >
> > ___-----___---_------________--__
> >
> > I need toggle an output port with this same signal latter by
reading
> > the times of each state from memory.
> >
> > Can you get me some idea how can I make this ?
> >
> > Thank you in advance.
>
------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )