| Example: |
.ORG 0x1000
ADIW R26, 0 ; If there is a command line tail, skip past
BREQ ALocal_Ret ; the immediate exit
MOVW R30, R26 ; Save the pointer to the command tail
MOVW R24, R26 ; Set the command line tail pointer passed
CALL AParseValue ; Get the first value specifed
SBRS R21, BIT_PV_VALID
Local_Ret: RET
MOV R26, R22 ; Save the index of the Register specified
MOV R24, R22 ; Same value for the Register index to pass
MOVW R22, R30 ; Reuse the command tail pointer as target
CALL AnRF_Read1Register ; Return values = R25: Register's first BYTE,
MOV R27, R22 ; R24: REG_7_STATUS, R22: count (1 or 5) and
LDI R25, ACSZ_Reg >> 8 ; either 1 or 5 BYTEs in the target buffer
LDI R24, ACSZ_Reg & 0xFF ; Point to the first string
MOV R22, R26 ; Transfer the index to R22 (the Hex BYTE to
LDI R19, ' ' ; be printed after the string) and set a
CALL APrintDescAndHexBYTE ; single space as the separator
LDI R25, ACSZ_Val >> 8 ; The second string preceeds the first data
LDI R24, ACSZ_Val & 0xFF ; value
LD R22, Z+ ; Load the first Register contents data BYTE
LDI R19, '=' ; returned and set the separator
CALL APrintDescAndHexBYTE
PrintLoop:
DEC R27 ; Decrement the reply BYTE count returned in
BREQ ALocal_CRLF ; R22 and exit upon reaching zero
LDI R24, ',' ; Print the intermediate ", " between values
CALL APrint1CHARAnd1Space
LD R24, Z+ ; Read the next BYTE returned from the target
CALL APrint0xHexBYTE ; buffer and print its value
RJMP APrintLoop ; Always loop back; the check is at the top
Local_CRLF:
JMP APrintNewLine ; Be polite; advance to the next line
CSZ_Reg: .STRING "nRF Register"
CSZ_Val: .STRING " value" |
| Test it: |
>N ; Read the complete set of Register values
0x00 (0E) -> 0x7F = B01111111
0x01 (0E) -> 0x00 = B00000000
0x02 (0E) -> 0x3F = B00111111
0x03 (0E) -> 0x03 = B00000011
0x04 (0E) -> 0x34 = B00110100
0x05 (0E) -> 0x4E = B01001110
0x06 (0E) -> 0x06 = B00000110
0x07 (0E) -> 0x0E = B00001110
0x08 (0E) -> 0x00 = B00000000
0x09 (0E) -> 0x00 = B00000000
0x0A (0E) -> 0x32, 0x44, 0x65, 0x6D, 0x6F
0x0B (0E) -> 0x31, 0x44, 0x65, 0x6D, 0x6F
0x0C (0E) -> 0x33 = B00110011
0x0D (0E) -> 0x34 = B00110100
0x0E (0E) -> 0x35 = B00110101
0x0F (0E) -> 0x36 = B00110110
0x10 (0E) -> 0x32, 0x44, 0x65, 0x6D, 0x6F
0x11 (0E) -> 0x00 = B00000000
0x12 (0E) -> 0x00 = B00000000
0x13 (0E) -> 0x00 = B00000000
0x14 (0E) -> 0x00 = B00000000
0x15 (0E) -> 0x00 = B00000000
0x16 (0E) -> 0x00 = B00000000
0x17 (0E) -> 0x11 = B00010001
0x1C (0E) -> 0x3F = B00111111
0x1D (0E) -> 0x07 = B00000111
> ; Logon to use the '@' command
m>@ 4096 0 ; Using our demo routine, ...
nRF Register 0x00 value = 0x7F
m>@ 4096 1
nRF Register 0x01 value = 0x00
m>@ 4096 2
nRF Register 0x02 value = 0x3F
m>@ 4096 3
nRF Register 0x03 value = 0x03
m>@ 4096 7
nRF Register 0x07 value = 0x0E
m>@ 4096 10
nRF Register 0x0A value = 0x32, 0x44, 0x65, 0x6D, 0x6F
m>@ 4096 11
nRF Register 0x0B value = 0x31, 0x44, 0x65, 0x6D, 0x6F
m>@ 4096 12
nRF Register 0x0C value = 0x33
m>@ 4096 16
nRF Register 0x10 value = 0x32, 0x44, 0x65, 0x6D, 0x6F
m>@ 4096 17
nRF Register 0x11 value = 0x00
m>@ 4096 0x17
nRF Register 0x17 value = 0x11
m>
> ; Only need to be logged on for the '@' commands
>N 0x17 ? ; To read single nRF24L01+ Register from the command line:
0x17 (0E) -> 0x11 = B00010001
>
|