Skip to main content
Visitor II
May 27, 2003
Question

ST9 register calling in source code

  • May 27, 2003
  • 5 replies
  • 767 views
Posted on May 27, 2003 at 10:11

ST9 register calling in source code

    This topic has been closed for replies.

    5 replies

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 11:34

    I'm just starting to develop with ST92F150 and I have a problem.

    In my main.c, I have the right declaration:

    include

    If I try to write in main.c:

    P0DR = 0;

    and all is ok,

    but if I write, for example:

    WUCTRL = 0;

    the compiler generates the error ''WUCTRL undeclared''.

    And so on with other examples... some are working, other not

    Why? Where can I read the content of st92fh file (I think it's protect...)?

    Many thanks

    Aragorn

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 11:34

    Sorry, in my previous message, the declaration is:

    #include ''sys/st92f150/st92f150.h'',

    with '' substituted by triangular parenthesis... the triangular parenthesis symbol is not shown in Explorer.

    Bye
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 11:34

    You have to modify the page pointer using the spp instruction.

    When you use the name of a register, it is an #define, it will be replaced by the pre-processor by the register number. It is up to you to modify the page.

    If it was managed by the compiler, each access to a register will have its own spp instruction increasing the code size.

    Note: by default, when an interrupt routine is entered the page pointer is saved in the stack so that you can modify it within the interrupt routine.
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 11:34

    Many thanks Romain!

    But do I have to reference the correct page when I touch a register?

    Isn't the compiler toolchain that assembles the right code?

    Thanks
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 11:34

    All the general purpose include files are located in the directory:

    C:\ST9PlusV6.1.8\lib\gcc-lib\st9-elf\2.7.2\include\sys

    then the include files dedicated to the ST92F150 are in the sys\st92f150 directory.

    You can know the list of the include files by reading the sys\st92f150\st92f150.h file.

    WUCTRL is declared as WU_CTLR in the wk_up_it.h include file.

    Note: be careful that the WUCTRL register is located in the 57th page, you will need to use a ''spp'' instruction.