VCL语法教程——4.map的使用

VCL语法教程——4.map的使用

  1. map类似于pspice里面的建模,输入一个X对应一个Y。通过点的数量,来绘制出曲线,在通过给定一个值X,带入曲线得到对应的输出Y。

  2. 如何定义一个map,
    例,定义一个名叫map1的图标,通过5个点进行绘制。图形见:
    在这里插入图片描述
    实现代码如下:
    第一个参数是map的命名,
    第二个参数是map点的数量,
    后面5对数据对应5个点的X,Y。这里默认最大的I16就是100%,所以100%对应32767,80%就是26214,40%就是13107
    setup_map(map1,5, 0,32767, 14746,32767, 19660,26214, 26214,13107)

  3. map的使用
    map使用采用接口函数get_map_output( mapname,X_value)
    第一个参数就是调用的map的名字
    第二个参数就是输入的X值
    例,调用map1,输入temp1得到对应的Y值temp2

temp2=get_map_output(map1,temp1)
  1. 配套api,值的缩放。
1.自动缩放,4ms一次,缩放的值保存在SCL#_output
automate_scale(SCL#,Input,SF)
参数定义:1.SCL#, 选择缩放模块,SCL1~SCL4
				2.Input,输入值
				3.SF,缩放因子,是一个I16的值,如果想缩放50%就设定为16383。如果不缩放就是100%,32767.
	
2.手动缩放,返回缩放以后的值scale_value(SCL#,Input) 
temp1 equals user12
temp1=scale_value(SCL1,temp1) 

3.设置SCL#通道的缩放因子
setup_scale_factor(SCL#,SF)
  1. 自动功能,类似于DMA功能,自动绑定好后就可以自行处理。
    例,
    1. 从POT2自动得到数据代入到MAP1中,得到缩放比例MAP1_OUTPUT
    2. 将POT1的数据通过MAP1_OUTPUT的缩放因子使用SCL3进行缩放,并且自动保存在SCL3_output。
    3. 将得到的SCL3_output的值通过DAC输出。
 setup_pot(POT1, THREE_WIRE)
 setup_pot(POT2, THREE_WIRE)
 setup_map(MAP1, 5,   ; Number of points used         
  		   0, 32767,   ; X = 0%   Y = +100%     
  		   14746, 32767,   ; X = 45%  Y = +100%     
  		   19660, 26214,   ; X = 60%  Y = +80%     
  		   26214, 13107,   ; X = 80%  Y = +40%     
  		   32767, 13107,   ; X =100%  Y = +40%         
  		   0,     0,   ;(point pair not used)         
  		   0,     0)   ;(point pair not used)
automate_map(MAP1,POT2_output) 
automate_scale(SCL3,POT1_output,MAP1_output) 
automate_dac(DAC1,SCL3_output,1,0)
while (1=1) {}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
RAD Studio VCL Reference (VCL参考) ContentsActnColorMaps Namespace Classes TStandardColorMap Class TStandardColorMap Members TStandardColorMap Methods TStandardColorMap.SetColor Method TStandardColorMap.UpdateColors Method TStandardColorMap Properties TStandardColorMap.BtnFrameColor Property TStandardColorMap.BtnSelectedColor Property TStandardColorMap.BtnSelectedFont Property TStandardColorMap.Color Property TStandardColorMap.DisabledColor Property TStandardColorMap.DisabledFontColor Property TStandardColorMap.DisabledFontShadow Property TStandardColorMap.FontColor Property TStandardColorMap.FrameBottomRightInner Property TStandardColorMap.FrameBottomRightOuter Property TStandardColorMap.FrameTopLeftInner Property TStandardColorMap.FrameTopLeftOuter Property TStandardColorMap.HighlightColor Property TStandardColorMap.HotColor Property TStandardColorMap.HotFontColor Property TStandardColorMap.MenuColor Property TStandardColorMap.SelectedColor Property TStandardColorMap.SelectedFontColor Property TStandardColorMap.ShadowColor Property TStandardColorMap.UnusedColor Property TStandardColorMap Events TStandardColorMap.OnColorChange Event TThemedColorMap Class TThemedColorMap Members TThemedColorMap Methods TThemedColorMap.UpdateColors Method TThemedColorMap Properties TThemedColorMap.BtnFrameColor Property TThemedColorMap.BtnSelectedColor Property TThemedColorMap.BtnSelectedFont Property TThemedColorMap.Color Property TThemedColorMap.DisabledColor Property TThemedColorMap.DisabledFontColor Property TThemedColorMap.DisabledFontShadow Property TThemedColorMap.FontColor Property TThemedColorMap.FrameBottomRightInner Property TThemedColorMap.FrameBottomRightOuter Property TThemedColorMap.FrameTopLeftInner Property TThemedColorMap.FrameTopLeftOuter Property TThemedColorMap.HighlightColor Property TThemedColorMap.HotColor Property TThemedColorMap.HotFontColor Property TThemedColorMap.MenuColor Property TThemedColorMap.SelectedColor Property TThemedColorMap.SelectedFontColor Property TThemedColorMap.ShadowColor Property TThemedColorMap.UnusedColor Property TThemedColorMap Events TThemedColorMap.OnColorChange Event TTwilightColorMap Class TTwilightColorMap Members TTwilightColorMap Methods TTwilightColorMap.UpdateColors Method TTwilightColorMap Properties TTwilightColorMap.BtnFrameColor Property TTwilightColorMap.BtnSelectedColor Property TTwilightColorMap.BtnSelectedFont Property TTwilightColorMap.Color Property TTwilightColorMap.DisabledColor Property TTwilightColorMap.DisabledFontColor Property TTwilightColorMap.DisabledFontShadow Property TTwilightColorMap.FontColor Property TTwilightColorMap.FrameBottomRightInner Property TTwilightColorMap.FrameBottomRightOuter Property TTwilightColorMap.FrameTopLeftInner Property TTwilightColorMap.FrameTopLeftOuter Property TTwilightColorMap.HighlightColor Property TTwilightColorMap.HotColor Property TTwilightColorMap.HotFontColor Property TTwilightColorMap.MenuColor Property TTwilightColorMap.SelectedColor Property TTwilightColorMap.SelectedFontColor Property TTwilightColorMap.ShadowColor Property TTwilightColorMap.UnusedColor Property TTwilightColorMap Events TTwilightColorMap.OnColorChange Event TXPColorMap Class TXPColorMap Members TXPColorMap Methods TXPColorMap.UpdateColors Method TXPColorMap Properties TXPColorMap.BtnFrameColor Property TXPColorMap.BtnSelectedColor Property TXPColorMap.BtnSelectedFont Property TXPColorMap.Color Property TXPColorMap.DisabledColor Property TXPColorMap.DisabledFontColor Property TXPColorMap.DisabledFontShadow Property TXPColorMap.FontColor Property TXPColorMap.FrameBottomRightInner Property TXPColorMap.FrameBottomRightOuter Property TXPColorMap.FrameTopLeftInner Property TXPColorMap.FrameTopLeftOuter Property TXPColorMap.HighlightColor Property TXPColorMap.HotColor Property TXPColorMap.HotFontColor Property TXPColorMap.MenuColor Property TXPColorMap.SelectedColor Property TXPColorMap.SelectedFontColor Property TXPColorMap.ShadowColor Property TXPColorMap.UnusedColor Property TXPColorMap Events TXPColorMap.OnColorChange Event Constants ActnColorMaps.cXPBtnFrameColor Constant ActnColorMaps.cXPFrameOuter Constant ActnColorMaps.cXPSelectedColor Constant ActnCtrls Namespace Classes TActionToolBar Class TActionToolBar Members TActionToolBar Properties TActionToolBar.ActionManager Property TActionToolBar.Align Property TActionToolBar.AllowHiding Property TActionToolBar.Anchors Property TActionToolBar.BiDiMode Property TActionToolBar.Canvas Property TActionToolBar.Caption Property TActionToolBar.Color Property TActionToolBar.ColorMap Property TActionToolBar.Constraints Property TActionToolBar.Cursor Property TActionToolBar.DragCursor Property TActionToolBar.DragKind Property TActionToolBar.DragMode Property TActionToolBar.EdgeBorders Property TActionToolBar.EdgeInner Property TActionToolBar.EdgeOuter Property TActionToolBar.Enabled Property TActionToolBar.Font Property TActionToolBar.HorzMargin Property TActionToolBar.HorzSeparator Property TActionToolBar.Orientation Property TActionToolBar.ParentBackground Property TActionToolBar.ParentBiDiMode Property TActionToolBar.ParentColor Property TActionToolBar.ParentFont Property TActionToolBar.ParentShowHint Property TActionToolBar.PersistentHotKeys Property TActionToolBar.PopupMenu Property TActionToolBar.ShowHint Property TActionToolBar.Spacing Property TActionToolBar.VertMargin Property TActionToolBar.Visible Property TActionToolBar Events TActionToolBar.OnAlignInsertBefore Event TActionToolBar.OnAlignPosition Event TActionToolBar.OnCanResize Event TActionToolBar.OnClick Event TActionToolBar.OnConstrainedResize Event TActionToolBar.OnContextPopup Event TActionToolBar.OnControlCreated Event TActionToolBar.OnDblClick Event TActionToolBar.OnDockDrop Event TActionToolBar.OnDockOver Event TActionToolBar.OnDragDrop Event TActionToolBar.OnDragOver Event TActionToolBar.OnEndDock Event TActionToolBar.OnEndDrag Event TActionToolBar.OnEnter Event TActionToolBar.OnExit Event TActionToolBar.OnGetControlClass Event TActionToolBar.OnGetSiteInfo Event TActionToolBar.OnMouseActivate Event TActionToolBar.OnMouseDown Event TActionToolBar.OnMouseMove Event TActionToolBar.OnMouseUp Event TActionToolBar.OnPaint Event TActionToolBar.OnResize Event TActionToolBar.OnStartDock Event TActionToolBar.OnStartDrag Event TActionToolBar.OnUnDock Event TCustomActionCombo Class TCustomActionCombo Members TCustomActionCombo Methods TCustomActionCombo.BeginAutoDrag Method TCustomActionCombo.ComboWndProc Method TCustomActionCombo.DesignWndProc Method TCustomActionCombo.DragDrop Method TCustomActionCombo.DragOver Method TCustomActionCombo Properties TCustomActionCombo.DragMode Property TCustomActionCombo Events TCustomActionCombo.OnClick Event TCustomActionDockBar Class TCustomActionDockBar Members TCustomActionDockBar.Create Constructor TCustomActionDockBar Fields TCustomActionDockBar.FControlHeightIndexes Field TCustomActionDockBar.FScrollDown Field TCustomActionDockBar.FScrollUp Field TCustomActionDockBar Methods TCustomActionDockBar.CalcDockedWidth Method TCustomActionDockBar.CreateControls Method TCustomActionDockBar.CreateScrollButtons Method TCustomActionDockBar.CustomAlignPosition Method TCustomActionDockBar.Dock Method TCustomActionDockBar.DoEndDock Method TCustomActionDockBar.DoScrollDown Method TCustomActionDockBar.DoScrollUp Method TCustomActionDockBar.DoStartDock Method TCustomActionDockBar.GenerateControlHeightLookup Method TCustomActionDockBar.GetFloatingDockSiteClass Method TCustomActionDockBar.GetSiteInfo Method TCustomActionDockBar.Loaded Method TCustomActionDockBar.MakeLastItemVisible Method TCustomActionDockBar.Resize Method TCustomActionDockBar.SetOrientation Method TCustomActionDockBar.SetupScrolling Method TCustomActionDockBar.ShowScrollButtons Method TCustomActionDockBar Properties TCustomActionDockBar.AllowScrolling Property TCustomActionDockBar.ScrollingRate Property TCustomActionDockBar.VisibleIndex Property TCustomActionToolBar Class TCustomActionToolBar Members TCustomActionToolBar.Create Constructor TCustomActionToolBar.Destroy Destructor TCustomActionToolBar Fields TCustomActionToolBar.FHiddenItems Field TCustomActionToolBar.FPopupBar Field TCustomActionToolBar.FScrollBtn Field TCustomActionToolBar Methods TCustomActionToolBar.AutoSizingChanged Method TCustomActionToolBar.CalcButtonWidth Method TCustomActionToolBar.CalcDockedWidth Method TCustomActionToolBar.CMColorchanged Method TCustomActionToolBar.CreateControl Method TCustomActionToolBar.CreateControls Method TCustomActionToolBar.DisableHiding Method TCustomActionToolBar.DoDropCategory Method TCustomActionToolBar.DoScrollBtnClick Method TCustomActionToolBar.DragDrop Method TCustomActionToolBar.DrawBackground Method TCustomActionToolBar.DrawSeparator Method TCustomActionToolBar.EnableHiding Method TCustomActionToolBar.GetControlClass Method TCustomActionToolBar.GetPopupClass Method TCustomActionToolBar.GetScrollBtnClass Method TCustomActionToolBar.HideUnusedItems Method TCustomActionToolBar.Reset Method TCustomActionToolBar.SetBounds Method TCustomActionToolBar.SetOrientation Method TCustomActionToolBar.SetupDropDownBtn Method TCustomActionToolBar Properties TCustomActionToolBar.HiddenCount Property TCustomButtonControl Class TCustomButtonControl Members TCustomButtonControl.Create Constructor TCustomButtonControl Fields TCustomButtonControl.FFlat Field TCustomButtonControl.FState Field TCustomButtonControl Methods TCustomButtonControl.CalcBounds Method TCustomButtonControl.Click Method TCustomButtonControl.CMDialogChar Method TCustomButtonControl.CMEnabledChanged Method TCustomButtonControl.CMMouseEnter Method TCustomButtonControl.CMMouseLeave Method TCustomButtonControl.CMTextChanged Method TCustomButtonControl.DrawBackground Method TCustomButtonControl.DrawFrame Method TCustomButtonControl.DrawLargeGlyph Method TCustomButtonControl.GetShowShortCut Method TCustomButtonControl.Loaded Method TCustomButtonControl.MouseDown Method TCustomButtonControl.MouseMove Method TCustomButtonControl.MouseUp Method TCustomButtonControl.Paint Method TCustomButtonControl.SetActionClient Method TCustomButtonControl.SetBounds Method TCustomButtonControl.SetGlyphLayout Method TCustomButtonControl.SetSelected Method TCustomButtonControl.WMLButtonDblClk Method TCustomButtonControl Properties TCustomButtonControl.AllowAllUp Property TCustomButtonControl.Caption Property TCustomButtonControl.Down Property TCustomButtonControl.Flat Property TCustomButtonControl.MouseInControl Property TCustomButtonControl.ShowCaption Property TCustomButtonControl.ShowShortCut Property TCustomButtonControl.State Property TCustomButtonControl.TrackButton Property TCustomComboControl Class TCustomComboControl Members ........(全)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值