Assembly-language use of Smart Pin repository?
JonTitus
Posts: 193
in Propeller 2
I have tried to write a program that demonstrates how to set up and use a Smart-Pin repository:
I want the program to set the P12 pin (or any pin) as a Smart Pin and then save the value in Alpha in the repository and then fetch the value into Beta. The result should light three of the LEDs on a P2 EVAL board. If Beta does not update, only one LED will turn on. However when the program runs, all six LEDs (P61..P56) light.
I'm new to assembly language on the Prop-2 so I appreciate any help. Thanks. --Jon
' Simple I/O program for Propeller P2 EVAL board. 05-03-2020 con _clkfreq = 160_000_000 dat org 0 ' Save program starting at cog RAM address 0 ' Use P12 as a Smart Pin wrpin #jat, #12 ' Set repository mode for Smart Pin P12 [0000_0000_000_0000000000000_00_00001_0] wxpin #Alpha, #12 ' Move Alpha to register X at P12 rqpin #Beta, #12 ' Read data from register at P12 mov dirb, pins ' Set direction for P61..P59 as output (logic-1) mov outb, Beta ' Turn some LEDs on .myloop nop jmp #.myloop ' infinite loop ends program. Optional pins long $3F00_0000 ' Set bits for pins P61..P56 as outputs (LEDs) Alpha long $1500_0000 ' LED-on pattern for LEDs, P61, P59, P57 on P2 EVAL Board Beta long $2FFF_FFFF ' Set Beta to turn on only LED P60 if Beta not updated jat long %0000_0000_000_0000000000000_00_00001_0 ' Repository-mode bits
I want the program to set the P12 pin (or any pin) as a Smart Pin and then save the value in Alpha in the repository and then fetch the value into Beta. The result should light three of the LEDs on a P2 EVAL board. If Beta does not update, only one LED will turn on. However when the program runs, all six LEDs (P61..P56) light.
I'm new to assembly language on the Prop-2 so I appreciate any help. Thanks. --Jon
Comments
EDIT: Oh, and reading further, WRPIN #jat and WXPIN #Alpha and RQPIN #Beta should be WRPIN jat and WXPIN Alpha and RQPIN Beta, without the "#".
Try this.
Or relatedly the cordic results falling off into oblivion. If you think of the vertical as a time scale, there could be some kind of signal ready graphical lines or hints. Just thinking out loud.
Or again here flag the questionable use of # on a label that is unambiguously being used as a data register. Or hover over the label in the instruction and see an address value instead of the data pointed at.
Code text editors are stuck in 1978. It's really time for some radical thinking.
So a 1 instruction spacer is all that is needed.
ozpropdev, appreciate your NOP addition.
All: It might be good to have a list of all the Propeller-2 registers.
Unfortunately, it probably won't happen until I'm retired in several decades.