
adccommunitymod (AutomationDirect) asked a question.
Created Date: December 17,2006
Created By: stgbruce
**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****
I am trying to implement some filtering with a 260 cpu and F2-04THM analogog input module. I have a signal that is very low and am seeing the signal fluctuate about +/- 25 bits around 0 volts input. (Set up for +/- % VDc, input, 2's complement, pointer method). If I implement the filtering as shown in the manual, skipping the BCD conversions since I am in binary already, I see large spikes when my signal jumps between positive and negative values. An example fo the digital filtering, or help on whether this is normal for the input modules would be helpful. Thanks.
Created Date: December 19,2006
Created by: yura
Easy. For example you have your 2's complement value in V2000. Look:
V2000.15
-| |------------------|LD kffff |
|out V2001|
V2000.15
-|/|------------------|LD k0 |
|out V2001|
SP1
-| |------------------|LDD v2000|
|BTOR |
......
That's all. No tricks. BTOR converts the whole accumulator, not only the lower word so you MUST copy the value of sign bit (15,dec) in your THM value to ALL the bits of upper accumulator word. http://forum1.automationdirect.com/board/wink.gif
Created Date: December 19,2006
Created by: AZRoger
Another option would be to add a bias number to the 16 bit value returned by the module. Your signal seems to swing +/- about 4 millivolts with full range being 5 Volts (I assumed the % meant 5). You could easily add the equivalent of one volt (6554) to the module result and continue working with 16 bit math. http://forum1.automationdirect.com/board/smile.gif
If you need to, you can subtract the volt out later in the process. There have been several topics on how to display negative numbers. This also requires different logic for positive and negative numbers as does yura's solution for making proper 32-bit numbers.
Created Date: December 19,2006
Created by: stgbruce
Originally posted by yura:
Easy. For example you have your 2's complement value in V2000. Look:
V2000.15
-| |
yura,
Thanks for the help, but I am still having difficulties.
I entered the following lines
V1600.15
-| |----------|LD kffff|
|out V1601|
-|/|---------|LD k0|
|out V1601|
SP1
-| |----------|LDD V1600|
|BTOR|
|OUTD V1610|
V1600 is a value thaty I manually enter so I know what is there. If I enter a positive value the conversion works fine. Negative values do not.
I then look at the values using Dataview in V1600, V1601 and V1610.
For V1600 signed decimal 1 word value = -45
For V1601 signed decimal 1 word value = (-1) or FFFF in HEX.
For V1600 signed decimal 2 word value = -45.
For V1610 Real 2 word value (only option) = 4.294967E+009.
Created Date: December 19,2006
Created by: stgbruce
Originally posted by AZRoger:
Another option would be to add a bias number to the 16 bit value returned by the module. Your signal seems to swing +/- about 4 millivolts with full range being 5 Volts (I assumed the % meant 5). You could easily add the equivalent of one volt (6554) to the module result and continue working with 16 bit math. http://forum1.automationdirect.com/board/smile.gif
Thanks for the help. You are correct the % was supposed to be 5. If this was the only analog input on the system I would consider this option, but I have 4 others some of which use the entire range of the card.
Created Date: December 17,2006
Created by: stgbruce
I am trying to implement some filtering with a 260 cpu and F2-04THM analogog input module. I have a signal that is very low and am seeing the signal fluctuate about +/- 25 bits around 0 volts input. (Set up for +/- % VDc, input, 2's complement, pointer method). If I implement the filtering as shown in the manual, skipping the BCD conversions since I am in binary already, I see large spikes when my signal jumps between positive and negative values. An example fo the digital filtering, or help on whether this is normal for the input modules would be helpful.
Thanks.