FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > DSP

DSP comp.dsp newsgroup, mailing list

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-13-2009, 12:18 PM
tom00
Guest
 
Posts: n/a
Default Schmitt trigger in software

Hello all!

I have to implement a Schmitt trigger in software on a DSP. I was thinkin
a while about a good implantation, but I just came to the simple solutio
with has nested if conditions (See Pseudo code below). Does anyone has
faster code??


-Thomas



for n = 1:length(x)
if flag
if x(n) > th
do something
flag = 0;
end
else
if x(n) < -th
do soming else
flag = 1;
end
end
end

Reply With Quote
  #2 (permalink)  
Old 11-13-2009, 12:26 PM
Christen Fihl
Guest
 
Posts: n/a
Default Re: Schmitt trigger in software

Table lookup like

State = Array [0..1] [0..15] of 0..1

State[0] = '0000000000011111'
State[1] = '0000011111111111'

Y := State[Y] [X]

X limited between 0..15, else bigger table

Christen Fihl


Reply With Quote
  #3 (permalink)  
Old 11-13-2009, 06:29 PM
Vladimir Vassilevsky
Guest
 
Posts: n/a
Default Re: Schmitt trigger in software



tom00 wrote:

> Hello all!
>
> I have to implement a Schmitt trigger in software on a DSP. I was thinking
> a while about a good implantation, but I just came to the simple solution
> with has nested if conditions (See Pseudo code below). Does anyone has a
> faster code??
>
>
> -Thomas
>
>
>
> for n = 1:length(x)
> if flag
> if x(n) > th
> do something
> flag = 0;
> end
> else
> if x(n) < -th
> do soming else
> flag = 1;
> end
> end
> end


^^^^^^^^^^^^^^^^^^^^^^^^^
Fie, stupident solution.




Here we go:

const s16 fubar[] = { nonsense, -nonsense };
const s16 void (*do_something[])() = { something_ , else_ };


s16 *x = blablabla;
s16 th = 0;

while(length--)
{
th = fubar[u16 state = ((u16)(*x++ +th)) >> 15];
do_something[state];
}


VLV
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set trigger in ChipScopePro for this Pratap FPGA 4 05-12-2008 04:00 PM
i need vhdl code for tristate logic and schmitt input trigger buffer uday424@gmail.com VHDL 1 03-11-2007 05:05 PM
ChipScope Pro : how to set up trigger pasacco FPGA 16 08-01-2005 06:08 PM
VOX Trigger O-Zone DSP 0 10-18-2004 11:28 AM
-> trigger usage Jason Zheng Verilog 2 07-20-2004 03:40 PM


All times are GMT +1. The time now is 07:37 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved