We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
another newbie question.
I have a piece of code that I am porting from PICC. In PICC, you can make reference to specific pins ("#define sclk GPIO5" for example), and in your code, you can write to sclk to change the pin output on GPOI5. This makes porting code or changing pin layout so much easier as you can simple redefine sclk to a different pin to make the code work.
ARM seems to prefer to change its pin output through IOSET / IOCLR.
To make the existing PICC code work, I would prefer to be able to define certain pins logically, and change their states by referencing their logic names.
how do you do that in ARM? Thanks in advance.
Ashely; It still appears that you are more intent on defending the PIC design than understanding the ARM when no one has challanged the PIC design. The statement is just the ARM concept is different. Instead of attempting to redesign the ARM core, why don't you review a few of the examples in the Keil toolset. What part of setting/clearing a bit troubles you?
The GPIO register addresses are defined in the furnished header files. The Mask and Direction registers are normally set one time in a GPIO init module.
Then: #define sensor_pwr_on 0x00001000 #define sensor_pwr_off 0x00001000 #define set_two_bit_on 0x00001001
IOSET1 = sensor_pwr_on; //Zero bits are ignored IOCLR1 = sensor_pwr_off;
IOSET1 = set_two_bits_on;
In the MCB23xx Blinky example they use a macro definition then write:
LED_E(0) // LED OFF LED_E(1) // LED ON
So there are many different ways to get symbolic addressing of single bits.
Bradford
"It still appears that you are more intent on defending the PIC design than understanding the ARM when no one has challanged the PIC design. "
Al, once you start questioning a person's intent, you are going down a very slippery slope.
let's just leave it at that.