Tuesday, March 16, 2010

**March 16 Simulator + Lego HW with eCos+

Line Follower Simulator - using sub-applications seems to have destroyed what I had - which was simulated polling reading the light sensor using a slider. With I/O to verify/simulate reaction, the application was cluttered with Function Blocks not needed for the application using Lego HW.


17 Mar.Update - Workspace is still ok, except ReadLightValue simulator.Havn't tried to flatten to subapps.

     Dual Bot V2 document update in Wiki:
    Improvements 
    - not back heavy so doesn't almost tip over in curves
    - light sensors can easily to moved up

    4DIAC 
    error log in .metadata in workspace
    problem viewing system configuration for device with readLight application with subapps
    questions:
    Service Sequence - in SI FB type - delete works fine, add adds but can't rename it

    Lego HW with eCos
    goal: create SI type 4DIAC FBs for each sensor + motors 


    SI types / interfaces created so far in 4diac:
    shutdown; ltsensor.led; ltsensor.rd; touch; motor.basic


    HW Interface Functions:
    cyg_uint32 SetInputPower(cyg_uint32 pa_nInputPort, cyg_uint32 pa_nPowerType);
    cyg_uint32 SetOutputPower(cyg_uint32 pa_nOutputPort, 
                              cyg_int32  pa_nPercent,  
                              cyg_int32 pa_brake);
    cyg_uint32 SetSambaMode(void);
    cyg_uint32 SetShutdownMode(void);
    cyg_uint32 GetInputPower(cyg_uint32 pa_nInputPort);
    cyg_int32  GetOutputPower(cyg_uint32 pa_nOutputPort);
    cyg_uint32 GetBrakeMode(cyg_uint32 pa_nOutputPort);
    externC cyg_uint32 InitAVR(void);
    cyg_uint32 GetButtonState(void);
    cyg_uint32 GetBatteryVoltage(void);
    cyg_uint32 GetFirmwareVersion(void);
    cyg_uint32 GetAccupack(void);
    cyg_uint32 GetSensorState(cyg_uint32 pa_nInputPort);
    cyg_int32  ReceiveFromAVR(void);
    cyg_uint32 SendToAVR(void); 

    ARM HW info 
    annotated logic part of blinker cpp from Alois
    Is zur zeit so programmiert dass es nur in 1 sensor port geht. Für die anderen mußt du es wie folgt an passen:
     
    #27. PIO   Parallel
    Portpins für LMS_LED
    Nxt-ports
    Port-pins
    1
    PA23 (DIGIA0)
    2
    PA28 (DIGIB0)
    3
    PA29 (DIGIC0)
    4
    PA30 (DIGID0)
    Also see p.65 in LEGO_MINDSTORMS_TUTORIAL.pdf

    ref.s are to AT91 ARM HW pdf


     switch(pa_nEIID){
        case scm_nEventINITID:
          if(true == QI){
            HAL_WRITE_UINT32(AT91_PMC+AT91_PMC_PCER, AT91_PMC_PCER_PIOA); // enable parallel io-controller clock and power

    PMC = Power Mgt Cntlr under advanced power mgt in doc
    PCER = Power cntl enable Register
    PIOA = PIO port A= PA  (there is also a port B)
    see Table 27-2 for more abbrv.s
    27.6.10 / 11 PIO Cntlr Set & Clear Output Data Reg (PIO_CODR /PIO_SODR)

    #include // from eCos has constants and HAL_WRITE (hw abstraction layer)





    ....

            HAL_WRITE_UINT32(AT91_PIOA+AT91_PIO_IDR, (1<
            HAL_WRITE_UINT32(AT91_PIOA+AT91_PIO_OER, (1<
            HAL_WRITE_UINT32(AT91_PIOA+AT91_PIO_PER, (1<
            HAL_WRITE_UINT32(AT91_PIOA+AT91_PIO_SODR, (1<
          }
          sendOutputEvent(scm_nEventINITOID);
          break;
        case scm_nEventREQID:
          if(true == QI){
            if(true == Q){
              HAL_WRITE_UINT32(AT91_PIOA+AT91_PIO_CODR, (1<
            }
            else{
              HAL_WRITE_UINT32(AT91_PIOA+AT91_PIO_SODR, (1<
            }
          }
          sendOutputEvent(scm_nEventCNFID);
          break;

    Need for Ultrasound sensor:
    Lejos source code  http://lejos.svn.sourceforge.net/viewvc/lejos/

    No comments:

    Post a Comment