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.
Marcus, thank you so much.
so GPIO A in LM3S628, per the datasheet, is at 0x4000.4000 - 0x4000.4FFF (24 bits for an 8-bit port? for compatibility reasons?). so its 0th pin / bit (0x4000.4000) should be a word at 0x4200.0000+0x4000 << 7 + 0x00<<2?
if I want to set the 0th pin to 1, do I just set that word to anything other than 0?
yeah, this is hugely helpful. I hope the mapping is consistent at least within the Cortex-M3 family?
thanks a lot.
> if I want to set the 0th pin to 1, do I just set that > word to anything other than 0?
The LSB determines the value. But do keep in mind that this will actually result in a R-M-W access on the bus. If that is an issue in your application you should get used to using set/clear registers that are quasi-standard on ARM MCU. If you are considering a switch from PIC to ARM, that might be a good idea anyway.
It is not that hard to search/replace 'sclk = 0' with a suitable macro definition.
> I hope the mapping is consistent at least within the > Cortex-M3 family?
The concept is consistent, but register addresses are not.
Regards Marcus http://www.doulos.com/arm/