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.
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.
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
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
Submit Your Own Code!
You must be logged in to submit code examples. Login now.