Name:
pokesfr
Syntax:

POKESFR location,data,data,...

Location - is a variable/constant specifying a register address. Valid values are 0 to 255 (not all implemented, see below).

Data - is a variable/constant which provides the data byte to be written.

Description:

Write data to the microcontroller special function registers.

This allows experienced users to adjust the on-board peripheral microcontroller settings. This command is for M2 and X2 parts only, for other parts see the poke command. The pokesfr command is for experienced users to adjust the internal microcontroller SFR (special function registers).

Only SFRs associated with peripherals (e.g. ADC or timers) may be accessed. Peeking or poking SFRs associated with PICAXE program operation (e.g. FSR, EEPROM or TABLE registers) will cause the PICAXE chip to immediately reset.

 

X2 parts

As location can only take the value 0-255 on X2 locations taken from the Microchip datasheet drop the initial 'F' from the hexadecimal value

e.g. BAUDCON FB8h becomes $B8

 

M2 parts

As location can only take the value 0-255 the value for M2 locations taken from the Microchip datasheet are created as follows:

Bit 7-5 Memory Bank $00-$07
Bit 4-0 Addresses $0C to $1F on this bank
    ($00-$0B are invalid and cause instant reset)

  e.g. BAUDCON, address 01Fh on bank 3, becomes %011 11111

Applies To:
08M2, 14M2, 18M2, 20M2, 20X2, 28X2, 40X2
See Also:
Related Create:
    Share:
    Print:

    Poking SFR values

    This program demonstrates setting the 'OSCTUNE' SFR to the value held in variable 'b1'.

    Code Example:
    	pokesfr $9B,b1	; put value of variable b1 into OSCTUNE
    Copy Code Submit an Example

    Submit Your Own Code!

    You must be logged in to submit code examples. Login now.

    Comments

    • Login to leave a comment.