GPIO Driver Setting

  • Hello,


    iam a little bit insecure in set the GPIO Driver on armstone A5 on WEC2013 (no experience in gpio programming, sorry) . I just want to use PIN 1-8 as a Writer. I am programming in c# and i found a vb.net class, which is no problem to translate or to use. But i don't understand to set the GPIO Driver correctly (I think it is enough to set these Parameters?):


    reg open \Drivers\BuiltIn\DIGITALIO
    reg set val Port DWord 0
    reg set val UseAsIO DWord ?
    reg set val DataDir DWord ?
    reg set val DataInit DWord 1 'by Default ever PiN should be 1
    reg save


    Please help me, I found the documentation but i don't understand the hex part for UseAsIO/ DataDir/ DataInit.


    Thank you very much and sorry for this maybe stupid question, but i Need your help

  • Hello,


    at an earlier time the boards have less than 32 IOs so a DWORD was enough for configuration, with in creasing number of IOs we used two, ... DWORDS (UseASIOA, UseAsIOB) and so on .... For get completely independent from the number of IOs we decide to change data type to "hex".


    You can use pin 3-10 on 66 pin feature connector (pin 1-2 are power pins). This are IO 3-10 and results:

    Code
    1. reg open \Drivers\builtin\digitalio
    2. REM Use these ten pins
    3. reg set value UseAsIO hex 0x3F, 0x0c
    4. REM Use These ten pin as outputs
    5. reg set value DataDir hex 0x3F, 0x0c
    6. REM Note this pins have pull-ups
    7. reg set value DataInit hex 0x00, 0x00
    8. REM This results information on Serial debug line - remove it later
    9. reg set value Debug dword 0xff
    10. reg save

    Hope this helps.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • YYEEEAAAHH it works perfekt!!! The vb.net class is also working but you have to Change the variable "value" into uint32 type not integer (Overflow exception):


    Sub SetPort(ByVal port As Integer)
    Dim value As UInt32
    value = CESetFilePointer(hPort, port, IntPtr.Zero, FILE_BEGIN)
    'TODO: Error, value=...
    End Sub