Start Back Next End
  
ZBasic Language Reference
171
ZBasic Microcontrollers
Appendix C - Pre-Defined Structures
The following pre-defined structures are available for most ZBasic 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 ZBasic 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.
ATTiny- and ATmega-based ZBasic 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 (if present in standard form):
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 (if present in standard form):
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   (if applicable)
End Structure
' For accessing USARTs (if present in standard form):
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
' For representing Microtime:
Structure Microtime_t
    Public Volatile timerTicks as Byte
    Public Volatile fastTicks UnsignedLong
End Structure
Previous page Top Next page