Download mikroBasic PRO for AVR User Manual v100
Transcript
CHAPTER 3 mikroBasic PRO for AVR Specifics ACCESSING INDIVIDUAL BITS The mikroBasic PRO for AVR allows you to access individual bits of 8-bit variables. It also supports sbit and bit data types Accessing Individual Bits Of Variables To access the individual bits, simply use the direct member selector (.) with a variable, followed by one of identifiers B0, B1, … , B7, or 0, 1, … 7, with 7 being the most significant bit : // Clear bit 0 on PORTA PORTA.B0 = 0 // Clear bit 5 on PORTB PORTB.5 = 0 There is no need of any special declarations. This kind of selective access is an intrinsic feature of mikroBasic PRO for AVR and can be used anywhere in the code. Identifiers B0–B7 are not case sensitive and have a specific namespace. You may override them with your own members B0–B7 within any given structure. See Predefined Globals and Constants for more information on register/bit names. sbit type The mikroBasic PRO for AVR compiler has sbit data type which provides access to bit-addressable SFRs. You can access them in several ways: dim LEDA as sbit at PORTA.B0 dim Name as sbit at sfr-name.B<bit-position> dim LEDB as sbit at PORTB.0 dim Name as sbit at sfr-name.<bit-position> 90 MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Related documents
mikroC PRO for AVR User`s Manual
mikroPascal PRO for AVR User Manual v1.00
mikroC for 8051 User Manual
User manual - MikroElektronika
SGI01 Small Graphics LCD Interface User`s Manual
AnnoLab - User Manual
water level control system mohd shaiful iruan bin mohd aris
mikroPascal PRO for PIC32 User Manual
VPN on Nexys2
PIC Clicker User Manual
RTC2 User Manual - MikroElektronika
MINI-M0™ - Mouser Electronics