这里的代码跟踪是运行ATSysPosisPixalII:/*PART初始化*/PLIPHPORTSUPopDunRunEnter(PosisSIDID0,PosithChhannLyA,SysSurtPosiaAODC);PrimsPosisScript写(PursStId0,PosithChhanelyA,SysStPixaaLaT);PrPixPosisTrimeOutOutsPoT(PoxsSIDID0,PothChhannvia,SysSpPursiaaTrIS)PiBixPosisStEnEnoCeTePrPurTurNo(PosisS.IdE0,Potol ChhannLyA);PrimsIdPosisNo.0,PosithChhanelyA,SysStPosia AyANSEL ^ 0xFFFF,PosisSpIn MyDeDigEdio;PrimsPosisPhansChaneleNooCeEnabl(PoxsSIDID0,PothChhannvia,SyssiPosiaA.CNEN);EpulLopEnabl(PosisSIDIO0,PosithChhanelyA,SyssiPosiaA.CNPU);PrimpPosisThanChaneleNooCePululLoDelabt(PoxsSIDIO0,PotoShannEnvia,SysSurtPosiaA.CNPD);我没有看到明确的模式集,但是AsSELX ReGs对于所讨论的PIN有零,所以我假设这符合我的配置从和谐这表明它们是数字模式。我对使用和声有点困惑。我使用引脚布局面板设置引脚上升。现在PLIB从应用程序任务调用来切换它们。(当然,它适用于Rigs B和G)。我这样做是正确的吗?用PLIB吗?或者其他一些和谐配置工具或宏隐藏在过多的DOC中?还有协调框架配置降下来做配置,但我猜这是多余的引脚面板。这似乎是一个非常基本的和谐任务,应该简单地工作。也许我不理解这里的教程,但我找不到任何进一步的例子。
以上来自于百度翻译
以下为原文
Tracing into the code here is what runs at SYS_PORTS_Initializ:
/* PORT A Initialization */
PLIB_PORTS_OpenDrainEnable(PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_ODC);
PLIB_PORTS_Write( PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_LAT);
PLIB_PORTS_DirectionOutputSet( PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_TRIS ^ 0xFFFF);
PLIB_PORTS_ChangeNoticePerPortTurnOn(PORTS_ID_0, PORT_CHANNEL_A);
PLIB_PORTS_ChannelModeSelect(PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_ANSEL ^ 0xFFFF, PORTS_PIN_MODE_DIGITAL);
PLIB_PORTS_ChannelChangeNoticeEnable(PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_CNEN);
PLIB_PORTS_ChannelChangeNoticePullUpEnable(PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_CNPU);
PLIB_PORTS_ChannelChangeNoticePullDownEnable(PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_CNPD);
I don't see an explicit mode set but the ANSELx regs have zeros for the pins in question so I assume this complies with my configuration from Harmony which shows them to be digital mode.
I am a little confused about my use of Harmony. I am using the pin-layout panel to set the pins up. And now PLIB calls from the app task to toggle them. (And of course it works for regs B and G). So am I doing this correctly? Is PLIB to be used? Or some other Harmony configuration tool or macros hidden in the plethora of doc? There is also the Harmony Framework Configuration drop downs to do the configuration but I am guessing this is redundant with the pin panel.
It seems as though this is a very fundamental Harmony task and should work simply. Perhaps I didn't understand the tutorial here but I cannot find any further examples.
Thanks
Fritz