This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Structutral

Hello to all who are reading my post.
I am a novice in C programming for At91sam7x. I am involved in an extensive project that my part include working with the device. But , Although I was bean reading several examples to understand such expressions:

(AT91C_BASE_PIOA->PIO_PDSR & AT91B_SW5) == 0
This expression placed as a conditional term in WHILE Structure in BLINKY example.
In advance I would thank a lot for your precious and useful answers.

Avi Muzaich

  • The pointer is just pointing to a struct that is mapped to the registers relevant for a specific port or device. This can be seen by the "base" part of the name.

    The data sheet/user manual of the processor should contain the description of all special function registers that the processor has for the different registers. So you should be able to locate a register that correlates with the PIO_PDSR field in the above struct. And when you have found that register, you should be able to figure out what it means to check the specific bit AT91B_SW5 and testing if that bit is cleared.

  • Do you just mean that you're a novice with the At91sam7x, or are you also a novice with the 'C' programming language in general?

    If you are a novice with the 'C' programming language in general (which certainly seems to be the case), then don't you think it would be sensible to start with a small project to gain experience?

    In fact, it may well be easier to learn the language on a PC - where you don't have the added complications of the hardware details, and usually have more supportive tools.

    Once you have a good understanding of the language, then you would move on to applying that in the embedded domain.

    Here are some resources to get you started:

    http://www.keil.com/books/

    A free online ‘C’ textbook can be found here: publications.gbdirect.co.uk/.../

    Answers to a range of Frequently-Asked Questions about ‘C’ programming can be found here: http://c-faq.com/

    A description of all the functions provided by the standard ‘C’ library can be found here: www.cplusplus.com/.../

    In my opinion, you can’t beat a good, taught class. I can recommend the following local training providers - others, of course, are available.
    http://www.doulos.co.uk
    http://www.feabhas.co.uk/

  • Thank you for your notation. But my basic and pricipal problem is about attributes such as _base_
    and etc that occur repeatedly in one line of program, for example iposed it before.
    Actually Iwant to know what is the anner of this attributes?

  • attributes such as _base_
    and etc that occur repeatedly in one line of program, for example iposed it before.

    Actually, no, you didn't. There was not a single attribute in that line. There may be some in that line's underlying macros or types, but they're not in what you posted.

    Actually Iwant to know what is the anner of this attributes?

    Hmmm... are you trying to win some "most atrocious spelling" contest, or what?

  • Not any atrocious spelling but typing in some little hurry!

  • but the STM32s have something similar, look at 3.2 in this document www.st.com/.../CD00228163.pdf

    Erik