hi,
i want to controll i.e.set ,clear GPIO pins in Assembly
i tried to find it in documentation but couldn't
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
hi,
i want to controll i.e.set ,clear GPIO pins in Assembly
i tried to find it in documentation but couldn't
I am not sure if there is any documentation on this specific topic. If you want to implement all these in assembly then please go through CPU and Instruction Set Reference Guide to get familair with assembly instructions. The guide provides examples on how to use each instruction.
Muhammad Waqar Azhar said:i want to controll i.e.set ,clear GPIO pins in Assembly
i tried to find it in documentation but couldn't
Most, if not all, of our examples in C configure at least some GPIO pins. There is a "GPIO toggle" example with the device_support/header files and peripheral examples that set/clear/toggle the pins. You could take a look at the assembly generated by the compiler to get an idea.
-Lori
Muhammad
Can you be more specific, what did not work?? Did you find and understand the assembly code?
Regards
Andreas
i put a c -instruction in my code,build it,checked coreponding assembly instruction and then used these instruction but i couldnot understand it ,itried but i could not
here is the code
MOVW DP,#0x01BF
OR 12,#0x1000
can you explain this
I can try
Muhammad Waqar Azhar said:MOVW DP,#0x01BF
this line loads the datapage with the corresponding address of the GPIO Registers. In direct addressing mode C2000 memory is organized in pages containing 64 words. In order to get the "real" memory address, multiply the datapage value by 64. In our case the real address would be 0x6FC0 which is exactly the Address of the GPADAT Register.
Muhammad Waqar Azhar said:OR 12,#0x1000
Now as your datapage is loaded into the memory, you can work within this page. The second line toggles Bit 3 (#0x1000) of the Register 12 memory spaces above GPADAT Register, which will be GPBSET in my understanding.
In plain c code the line would be
GpioDataRegs.GPBSET.bit.GPIO35 = 1;
right?
The following documents are helpful to make the first steps through assembly:
spru430e.pdf CPU Instruction Set Reference Guide. This Guide explains all the assembly instructions in detail
sprufn3c.pdf Piccolo System Control and Interrupts Reference Guide where you can find the GPIO Register Addresses
Hope my explanations are clear enough...
Best regards
Andreas
You can alternatively use the peripheral header files by the following
include the following line at top of the assembly file (*.asm) where you want to change registers...
;Gives peripheral addresses visibility in assembly
.cdecls C,LIST,"PeripheralHeaderIncludes.h"
Note the PeripheralHeaderIncludes.h includes all the individual peripheral header files...you can alternatively include the individual peripheral header file..
the file itself can be found at controlSUITE\development_kits\~SupportFiles\<device>_headers
now where you want to toggle the GPIO you can use the peripheral header file for more readable code...
MOVW DP,#_GpioDataRegs.GPACLEAR
ZAPA
MOV AL,#0xFF00
MOVL @_GpioDataRegs.GPACLEAR,ACC
Please NOte the code above may not be the most cycle efficient way of doing this, but the code is very readable if you do this..
Hope this helps,
-Manish