Navigation bar
  Start Previous page
 159 of 206 
Next page End  

ZBasic Language Reference
151
ZX Microcontroller Family
Appendix B - Pre-Defined Structures
The following pre-defined structures are available for most ZX devices based on Atmel ATmega CPUs. 
However, due to irregularities in the arrangement of registers on some mega CPUs they are not available. 
In particular, the predefined structures are not available for ZX devices based on the mega32 or the
mega128.
One or more of the pre-defined structures may be added to your application with the Option Include
directive using the structure names below.
ATmega-based ZX Devices
' For accessing I/O ports:
Structure Port_t
    Public Volatile Pin as Byte
    Public Volatile DDR as Byte
    Public Volatile Port as Byte
End Structure
' For accessing 8-bit timers:
Structure Timer8_t
    Public Volatile TCCRA as Byte
    Public Volatile TCCRB as Byte
    Public Volatile CNT as Byte
    Public Volatile ICR as Byte
    Public Volatile OCRA as Byte
    Public Volatile OCRB as Byte
End Structure
' For accessing 16-bit timers:
Structure Timer16_t
    Public Volatile TCCRA as Byte
    Public Volatile TCCRB as Byte
    Public Volatile TCCRC as Byte
    Public Volatile unused_1 as Byte
    Public Volatile CNT as UnsignedInteger
    Public Volatile ICR as UnsignedInteger
    Public Volatile OCRA as UnsignedInteger
    Public Volatile OCRB as UnsignedInteger
    Public Volatile OCRC as UnsignedInteger  ' mega1280 and mega1281 only
End Structure
' For accessing USARTs:
Structure USART_t
    Public Volatile UCSRA as Byte
    Public Volatile UCSRB as Byte
    Public Volatile UCSRC as Byte
    Public Volatile unused_1 as Byte
    Public Volatile UBRR as UnsignedInteger
    Public Volatile UDR as Byte
End Structure
ATmega-based ZX Devices
' For accessing I/O ports:
Structure Port_t
    Public Volatile Dir as Byte
    Public Volatile DirSet as Byte
    Public Volatile DirClr as Byte
    Public Volatile DirTgl as Byte
    Public Volatile Out as Byte
Previous page Top Next page