Electronic Components Datasheet Search |
|
AN1106 Datasheet(PDF) 5 Page - STMicroelectronics |
|
AN1106 Datasheet(HTML) 5 Page - STMicroelectronics |
5 / 9 page 5/9 TRANSLATING ASSEMBLY CODE FROM HC05 TO ST7 There are two ways to define a variable as public (which means visible from another module, the C equivalent directive is “extern”). The first one is the one used in the above example (the dot before the variable). The second one is to write the PUBLIC directive at the beginning of the variable.asm file followed by the name of the variables you want to be public. variable.inc: (file to include in all .asm source files) TITLE “variable.inc” EXTERN var2.b ; the ad- dress of var2 is a byte. EXTERN var3.w; the address of var3 is a word. EXTERN table.w; the address of table is a word. In this .inc file, only the variables which have been defined as public in the corresponding .asm file have to appear. That’s the reason why var1 doesn’t appear (it’s a local variable). Instead of writing a “.b” or “.w” after the variable to specify that its address is a byte, you can also write the BYTES or WORDS directives directly before the corresponding variables. 4.2 CONSTANTS The best way to define all your constants is to declare them in a file (called constant.inc for ex- ample) with the directive “#define constant_name value”. Constants defined in this way don’t take any space in memory. All you have to do is include this .inc file in all your source files (in all files where you use the constants): constant.inc: #define const125 ; const1 = 25 (decimal) #define const2 $1F ; const2 = 1F (hexadecimal) #define const3%11100001 ; const3=11100001 (binary) ........ You can define as many constants as you want. Just make sure that the “#” symbol is always the first character of the line but not in the first column. |
Similar Part No. - AN1106 |
|
Similar Description - AN1106 |
|
|
Link URL |
Privacy Policy |
ALLDATASHEET.NET |
Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
Family Site : ic2ic.com |
icmetro.com |