Navigation bar
  Start Previous page
 68 of 172 
Next page End  

ZBasic Language Reference
61
ZX Microcontroller Family
3.8.1 CPU Registers
ZX-24, ZX-40, and ZX-44 Registers
The pre-defined CPU registers for the ZX-24, ZX40 and ZX-44 match those available on the ATmega32
CPU and all are Byte values.  Discussion of the use of these registers is beyond the scope of this
document.  See the Atmel documentation for a full description.  Also, be advised that modifying some of
these registers may severely alter the behavior of the control program, possibly even rendering it
inoperable.
The register value may be accessed by using the register name, from the table below, prefixed by the
keyword Register, e.g. Register.PortC.
CPU Registers for mega32-based ZX Models
ACSR
EECR
OCR1AL
PORTD
TCCR2
UBRRH
ADCH
EEDR
OCR1BH
SFIOR
TCNT0
UBRRL
ADCL
GICR
OCR1BL
SPCR
TCNT1H
UCSRA
ADCSRA
GIFR
OCR2
SPDR
TCNT1L
UCSRB
ADMUX
GIMSK
OSCCAL
SPH
TCNT2
UCSRC
ASSR
ICR1H
PINA
SPL
TIFR
UDR
DDRA
ICR1L
PINB
SPMCR
TIMSK
WDTCR
DDRB
MCUCR
PINC
SPSR
TWAR
DDRC
MCUSR
PIND
SREG
TWBR
DDRD
MCUCSR
PORTA
TCCR0
TWCR
EEARH
OCR0
PORTB
TCCR1A
TWDR
EEARL
OCR1AH
PORTC
TCCR1B
TWSR
Some CPU registers are 16-bit values that have register names in the table above corresponding to the
high and low bytes.  For convenience of access, the following UnsignedInteger register names are
available.  When reading and writing to these registers, the control program ensures that the high and low
bytes are accessed in the correct order as required by the CPU.  Note that UBRR cannot be supported
because the high and low bytes are not adjacent in the I/O address space.
ADC
EEAR
ICR1
OCR1A 
OCR1B
SP
TCNT1
Because the ZX microcontrollers are implemented using a more powerful CPU, some registers available
in BasicX don’t actually exist on the ZX CPU but there are equivalent registers.  For compatibility, both
the original register name and the actual register name are supported on similar ZX models.  For new
applications, the new register names should be used.
BasicX Register
New Register
ADCSR
ADCSRA
GIMSK
GICR
MCUSR
MCUCSR
UBRR
UBRRL¹
UCR
UCSRB
USR
UCSRA
Notes:
¹ The serial port baud rate control register is
16-bits wide in the mega32 CPU.  The upper
bits are referred to as UBRRH.
Previous page Top Next page